42 lines
929 B
GDScript
42 lines
929 B
GDScript
extends Control
|
|
|
|
var credits_text = """
|
|
CREDITS:
|
|
-----------
|
|
Programming: Jannis, Fabio
|
|
Design: Leon
|
|
Music: TBN
|
|
"""
|
|
|
|
var current_text = ""
|
|
var char_index = 0
|
|
var typing_speed = 0.05
|
|
var fast_typing_speed = 0.005
|
|
|
|
func _ready():
|
|
_start_typing()
|
|
|
|
func _process(_delta: float) -> void:
|
|
if Input.is_action_pressed("ui_accept") or Input.is_action_pressed("click"):
|
|
typing_speed = fast_typing_speed
|
|
else:
|
|
typing_speed = 0.05
|
|
|
|
func _start_typing() -> void:
|
|
current_text = ""
|
|
char_index = 0
|
|
_update_text()
|
|
|
|
func _update_text() -> void:
|
|
if char_index < credits_text.length():
|
|
current_text += credits_text[char_index]
|
|
$Label.text = current_text
|
|
char_index += 1
|
|
await get_tree().create_timer(typing_speed).timeout
|
|
_update_text()
|
|
else:
|
|
_return_to_main_menu()
|
|
|
|
func _return_to_main_menu() -> void:
|
|
await get_tree().create_timer(2).timeout
|
|
get_tree().change_scene_to_file("res://menu/main_menu/MainMenu.tscn")
|