add a credit scene
This commit is contained in:
parent
036c42b5bc
commit
78ef008e6a
5 changed files with 94 additions and 23 deletions
68
gmtk_2024/scripts/menu_main_control.gd
Normal file
68
gmtk_2024/scripts/menu_main_control.gd
Normal file
|
@ -0,0 +1,68 @@
|
|||
extends Control
|
||||
|
||||
var display_text = """
|
||||
SYSTEM INITIALIZATION...
|
||||
---------------------------------------
|
||||
PLACEHOLDER BOOT SEQUENCE
|
||||
COPYRIGHT PLACEHOLDER
|
||||
|
||||
> CPU:
|
||||
> MEMORY:
|
||||
> STORAGE:
|
||||
> GPU:
|
||||
|
||||
>> WARNING:
|
||||
>> RECOMMENDED ACTION:
|
||||
|
||||
SYSTEM READY.
|
||||
PRESS START TO INITIATE.
|
||||
|
||||
"""
|
||||
|
||||
var current_text = ""
|
||||
var char_index = 0
|
||||
var typing_speed = 0.05
|
||||
var fast_typing_speed = 0.005
|
||||
|
||||
func _ready():
|
||||
for hbox in $VBoxContainer/VBoxContainer3.get_children():
|
||||
hbox.visible = false
|
||||
|
||||
_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 < display_text.length():
|
||||
current_text += display_text[char_index]
|
||||
$VBoxContainer/VBoxContainer2/Label.text = current_text
|
||||
char_index += 1
|
||||
await get_tree().create_timer(typing_speed).timeout
|
||||
_update_text()
|
||||
else:
|
||||
_show_menu_options()
|
||||
|
||||
func _show_menu_options() -> void:
|
||||
for hbox in $VBoxContainer/VBoxContainer3.get_children():
|
||||
hbox.visible = true
|
||||
|
||||
|
||||
func _on_start_button_pressed() -> void:
|
||||
print("Start Button Clicked")
|
||||
|
||||
func _on_credits_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://menu/main_menu/CreditsScene.tscn")
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
$VBoxContainer/VBoxContainer2/Label.text += "\nLogging out!"
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
get_tree().quit()
|
Loading…
Add table
Add a link
Reference in a new issue