add main menu
This commit is contained in:
parent
13c5b5f074
commit
18e144e81d
4 changed files with 116 additions and 0 deletions
59
gmtk_2024/control.gd
Normal file
59
gmtk_2024/control.gd
Normal file
|
@ -0,0 +1,59 @@
|
|||
extends Control
|
||||
|
||||
var display_text = "ULTIM809 COMPUTER BY MATT SARNOFF\nDEBUG ROM V0.3 - 28 JUN 2010\n512KB AVAILABLE RAM\n\nCARD: NO NAME\n128040960 BYTES\nOFFSETS: F:33 R:279 D:311\n\nMONITOR READY."
|
||||
|
||||
var current_text = ""
|
||||
var char_index = 0
|
||||
var typing_speed = 0.05
|
||||
var fast_typing_speed = 0.01
|
||||
|
||||
func _ready():
|
||||
modulate = Color(0, 0, 0)
|
||||
|
||||
$VBoxContainer/Label.add_theme_color_override("font_color", Color(0, 1, 0))
|
||||
|
||||
$VBoxContainer/Label.set_custom_minimum_size(Vector2(20, 0))
|
||||
|
||||
for button in $VBoxContainer.get_children():
|
||||
if button is Button:
|
||||
button.visible = false
|
||||
button.add_theme_color_override("font_color", Color(0, 1, 0))
|
||||
button.add_theme_stylebox_override("normal", StyleBoxEmpty.new())
|
||||
|
||||
_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/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 button in $VBoxContainer.get_children():
|
||||
button.visible = true
|
||||
|
||||
func _on_start_button_pressed() -> void:
|
||||
print("Start Button Clicked")
|
||||
|
||||
func _on_credits_button_pressed() -> void:
|
||||
print("Credits Button Clicked")
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
$VBoxContainer/Label.text += "\nBye!"
|
||||
await get_tree().create_timer(1).timeout
|
||||
get_tree().quit()
|
18
gmtk_2024/menu/main_menu/conFBFE.tmp
Normal file
18
gmtk_2024/menu/main_menu/conFBFE.tmp
Normal file
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cscsuljo8ivad"]
|
||||
|
||||
[ext_resource type="Script" path="res://control.gd" id="1_demfw"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxbalfjqtp06t" path="res://canvas_layer.tscn" id="2_jr3s0"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_demfw")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
|
||||
[node name="CanvasLayer" parent="." instance=ExtResource("2_jr3s0")]
|
34
gmtk_2024/menu/main_menu/control.tscn
Normal file
34
gmtk_2024/menu/main_menu/control.tscn
Normal file
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cscsuljo8ivad"]
|
||||
|
||||
[ext_resource type="Script" path="res://control.gd" id="1_demfw"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_demfw")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
offset_right = 70.0
|
||||
offset_bottom = 101.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="start" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = ">start"
|
||||
|
||||
[node name="credits" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = ">credits"
|
||||
|
||||
[node name="quit" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = ">quit"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/start" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/credits" to="." method="_on_credits_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/quit" to="." method="_on_quit_button_pressed"]
|
|
@ -39,6 +39,11 @@ player_jump={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
click={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue