diff --git a/gmtk_2024/menu/main_menu/CreditsScene.tscn b/gmtk_2024/menu/main_menu/CreditsScene.tscn new file mode 100644 index 0000000..95c7a98 --- /dev/null +++ b/gmtk_2024/menu/main_menu/CreditsScene.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=3 format=3 uid="uid://cut2xjnvh8i58"] + +[ext_resource type="Theme" uid="uid://cohbys634cf18" path="res://menu/main_menu/MainMenuTheme.tres" id="1_tmf11"] +[ext_resource type="Script" path="res://scripts/menu_credit_control.gd" id="2_ogwi7"] + +[node name="CreditScene" type="MarginContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("1_tmf11") + +[node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 2 +color = Color(0, 0, 0, 1) + +[node name="Control" type="Control" parent="."] +layout_mode = 2 +script = ExtResource("2_ogwi7") + +[node name="Label" type="Label" parent="Control"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 13.0 diff --git a/gmtk_2024/menu/main_menu/MainMenu.tscn b/gmtk_2024/menu/main_menu/MainMenu.tscn index 32ee0fc..7f15265 100644 --- a/gmtk_2024/menu/main_menu/MainMenu.tscn +++ b/gmtk_2024/menu/main_menu/MainMenu.tscn @@ -1,23 +1,8 @@ -[gd_scene load_steps=5 format=3 uid="uid://1h2urto6y63r"] +[gd_scene load_steps=4 format=3 uid="uid://1h2urto6y63r"] [ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="1_1tx2i"] -[ext_resource type="Script" path="res://control.gd" id="2_deavt"] - -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vnp6n"] - -[sub_resource type="Theme" id="Theme_p2nm6"] -default_font = ExtResource("1_1tx2i") -Button/colors/font_color = Color(0, 1, 0, 1) -Label/colors/font_color = Color(0, 1, 0, 1) -Label/colors/font_outline_color = Color(0, 0, 0, 1) -Label/colors/font_shadow_color = Color(0, 0, 0, 0) -Label/constants/line_spacing = 3 -Label/constants/outline_size = 0 -Label/constants/shadow_offset_x = 1 -Label/constants/shadow_offset_y = 1 -Label/constants/shadow_outline_size = 1 -Label/font_sizes/font_size = 16 -Label/styles/normal = SubResource("StyleBoxEmpty_vnp6n") +[ext_resource type="Theme" uid="uid://cohbys634cf18" path="res://menu/main_menu/MainMenuTheme.tres" id="1_kkajn"] +[ext_resource type="Script" path="res://scripts/menu_main_control.gd" id="2_g8c7b"] [node name="MainMenu" type="MarginContainer"] anchors_preset = 15 @@ -25,7 +10,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -theme = SubResource("Theme_p2nm6") +theme = ExtResource("1_kkajn") [node name="ColorRect" type="ColorRect" parent="."] layout_mode = 2 @@ -33,7 +18,7 @@ color = Color(0, 0, 0, 1) [node name="Control" type="Control" parent="."] layout_mode = 2 -script = ExtResource("2_deavt") +script = ExtResource("2_g8c7b") [node name="VBoxContainer" type="VBoxContainer" parent="Control"] layout_mode = 0 diff --git a/gmtk_2024/menu/main_menu/MainMenuTheme.tres b/gmtk_2024/menu/main_menu/MainMenuTheme.tres new file mode 100644 index 0000000..13841fe --- /dev/null +++ b/gmtk_2024/menu/main_menu/MainMenuTheme.tres @@ -0,0 +1,19 @@ +[gd_resource type="Theme" load_steps=3 format=3 uid="uid://cohbys634cf18"] + +[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="1_ep67t"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_vnp6n"] + +[resource] +default_font = ExtResource("1_ep67t") +Button/colors/font_color = Color(0, 1, 0, 1) +Label/colors/font_color = Color(0, 1, 0, 1) +Label/colors/font_outline_color = Color(0, 0, 0, 1) +Label/colors/font_shadow_color = Color(0, 0, 0, 0) +Label/constants/line_spacing = 3 +Label/constants/outline_size = 0 +Label/constants/shadow_offset_x = 1 +Label/constants/shadow_offset_y = 1 +Label/constants/shadow_outline_size = 1 +Label/font_sizes/font_size = 16 +Label/styles/normal = SubResource("StyleBoxEmpty_vnp6n") diff --git a/gmtk_2024/scripts/menu_credit_control.gd b/gmtk_2024/scripts/menu_credit_control.gd new file mode 100644 index 0000000..c6e6147 --- /dev/null +++ b/gmtk_2024/scripts/menu_credit_control.gd @@ -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") diff --git a/gmtk_2024/control.gd b/gmtk_2024/scripts/menu_main_control.gd similarity index 88% rename from gmtk_2024/control.gd rename to gmtk_2024/scripts/menu_main_control.gd index 3bf34ed..869b1d9 100644 --- a/gmtk_2024/control.gd +++ b/gmtk_2024/scripts/menu_main_control.gd @@ -30,7 +30,7 @@ func _ready(): _start_typing() -func _process(delta: float) -> void: +func _process(_delta: float) -> void: if Input.is_action_pressed("ui_accept") or Input.is_action_pressed("click"): typing_speed = fast_typing_speed else: @@ -60,9 +60,9 @@ func _on_start_button_pressed() -> void: print("Start Button Clicked") func _on_credits_button_pressed() -> void: - print("Credits Button Clicked") + get_tree().change_scene_to_file("res://menu/main_menu/CreditsScene.tscn") func _on_quit_button_pressed() -> void: - $VBoxContainer/VBoxContainer2/Label.text += "\nBye!" + $VBoxContainer/VBoxContainer2/Label.text += "\nLogging out!" await get_tree().create_timer(0.5).timeout get_tree().quit()