add a credit scene
This commit is contained in:
parent
036c42b5bc
commit
78ef008e6a
5 changed files with 94 additions and 23 deletions
42
gmtk_2024/scripts/menu_credit_control.gd
Normal file
42
gmtk_2024/scripts/menu_credit_control.gd
Normal file
|
@ -0,0 +1,42 @@
|
|||
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")
|
Loading…
Add table
Add a link
Reference in a new issue