diff --git a/Scenes/Main Menu Music Fix.tscn b/Scenes/Main Menu Music Fix.tscn new file mode 100644 index 0000000..d4f7f50 --- /dev/null +++ b/Scenes/Main Menu Music Fix.tscn @@ -0,0 +1,286 @@ +[gd_scene load_steps=16 format=3 uid="uid://bnutmwl2vuvqe"] + +[ext_resource type="Script" path="res://Scripts/UI/MainMenuManager.gd" id="1_35kaq"] +[ext_resource type="PackedScene" uid="uid://c4btepmue6d7p" path="res://Scenes/Game.tscn" id="2_kitxe"] +[ext_resource type="PackedScene" uid="uid://btxarutbkchmb" path="res://Prefabs/Settings Menu.tscn" id="3_q44re"] +[ext_resource type="Theme" uid="uid://b0b3fxesfrpb7" path="res://Assets/UI/Theme.tres" id="4_bajby"] +[ext_resource type="Texture2D" uid="uid://tjxkew3m4v8m" path="res://Assets/Sprites/UI/Shadow.png" id="5_btlv0"] +[ext_resource type="Texture2D" uid="uid://ojlfqxj5bilo" path="res://Assets/Sprites/Jesus/jesus_spritesheet.png" id="6_sfeq6"] +[ext_resource type="Texture2D" uid="uid://dlr823rtwhtq2" path="res://Assets/Sprites/EasterEgg.png" id="7_hhotb"] +[ext_resource type="Texture2D" uid="uid://c54k7fn4fu42s" path="res://Assets/Sprites/Bunny/good_bunny_spritesheet.png" id="8_kscix"] +[ext_resource type="AudioStream" uid="uid://c6nf5s6xy2uii" path="res://Assets/Music/omw-to-beat-the-big-bad.wav" id="9_gyelf"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5uvie"] +bg_color = Color(0.439216, 0.631373, 0.537255, 1) + +[sub_resource type="Animation" id="Animation_iq7o3"] +resource_name = "Walk" +length = 0.8 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1), +"update": 1, +"values": [0, 1, 2, 3, 4, 5, 6, 7] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_xufdy"] +_data = { +"Autostart": SubResource("Animation_iq7o3") +} + +[sub_resource type="Animation" id="Animation_53kbk"] +resource_name = "Autostart" +length = 0.5 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1), +"update": 1, +"values": [0, 1, 2, 3, 4] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_5tgwk"] +_data = { +"Autostart": SubResource("Animation_53kbk") +} + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h5db4"] +bg_color = Color(0, 0, 0, 0.313726) + +[node name="MainMenu" type="Control" node_paths=PackedStringArray("default_focus", "music_player")] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 6 +size_flags_vertical = 3 +script = ExtResource("1_35kaq") +game_scene = ExtResource("2_kitxe") +settings_scene = ExtResource("3_q44re") +default_focus = NodePath("VBoxContainer/MarginBox2/ButtonsVbox/PlayButton") +autostart_animations = Array[NodePath]([NodePath("Decorations/Left Decor/Jesus/AnimationPlayer"), NodePath("Decorations/Right Decor/GoodBunny/AnimationPlayer")]) +music_player = NodePath("MusicPlayer") + +[node name="Panel" type="Panel" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("4_bajby") +theme_override_styles/panel = SubResource("StyleBoxFlat_5uvie") + +[node name="Decorations" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Left Decor" type="CenterContainer" parent="Decorations"] +custom_minimum_size = Vector2(576, 0) +layout_mode = 1 +anchors_preset = 9 +anchor_bottom = 1.0 +grow_vertical = 2 + +[node name="Shadow" type="Sprite2D" parent="Decorations/Left Decor"] +position = Vector2(272, 686) +scale = Vector2(10, 10) +texture = ExtResource("5_btlv0") + +[node name="Jesus" type="Sprite2D" parent="Decorations/Left Decor"] +position = Vector2(279, 408) +scale = Vector2(10, 10) +texture = ExtResource("6_sfeq6") +hframes = 8 +vframes = 4 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Decorations/Left Decor/Jesus"] +libraries = { +"": SubResource("AnimationLibrary_xufdy") +} + +[node name="EasterEgg" type="Sprite2D" parent="Decorations/Left Decor"] +position = Vector2(142, 555) +scale = Vector2(10, 10) +texture = ExtResource("7_hhotb") +hframes = 6 + +[node name="EasterEgg2" type="Sprite2D" parent="Decorations/Left Decor"] +position = Vector2(450, 572) +rotation = 0.633555 +scale = Vector2(10, 10) +texture = ExtResource("7_hhotb") +hframes = 6 +frame = 4 + +[node name="Right Decor" type="CenterContainer" parent="Decorations"] +custom_minimum_size = Vector2(576, 0) +layout_mode = 1 +anchors_preset = 11 +anchor_left = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 0 +grow_vertical = 2 + +[node name="Shadow" type="Sprite2D" parent="Decorations/Right Decor"] +position = Vector2(300, 681) +scale = Vector2(10, 10) +texture = ExtResource("5_btlv0") + +[node name="EasterEgg" type="Sprite2D" parent="Decorations/Right Decor"] +position = Vector2(416, 537) +rotation = 0.289725 +scale = Vector2(10, 10) +texture = ExtResource("7_hhotb") +hframes = 6 +frame = 2 + +[node name="GoodBunny" type="Sprite2D" parent="Decorations/Right Decor"] +position = Vector2(235, 579) +scale = Vector2(10, 10) +texture = ExtResource("8_kscix") +hframes = 5 +vframes = 4 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Decorations/Right Decor/GoodBunny"] +libraries = { +"": SubResource("AnimationLibrary_5tgwk") +} + +[node name="Panel" type="Panel" parent="Decorations"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_h5db4") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 0 + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 32 +theme_override_constants/margin_top = 32 +theme_override_constants/margin_right = 32 +theme_override_constants/margin_bottom = 32 + +[node name="Label" type="Label" parent="VBoxContainer/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 5 +theme_override_font_sizes/font_size = 96 +text = "Happy Easter Game Thing" +horizontal_alignment = 1 +autowrap_mode = 2 + +[node name="MarginBox2" type="MarginContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/margin_left = 32 +theme_override_constants/margin_top = 32 +theme_override_constants/margin_right = 32 +theme_override_constants/margin_bottom = 32 + +[node name="ButtonsVbox" type="VBoxContainer" parent="VBoxContainer/MarginBox2"] +custom_minimum_size = Vector2(0, 495) +layout_mode = 2 +size_flags_horizontal = 4 +theme = ExtResource("4_bajby") +theme_override_constants/separation = 8 +alignment = 1 + +[node name="Spacer" type="MarginContainer" parent="VBoxContainer/MarginBox2/ButtonsVbox"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="PlayButton" type="Button" parent="VBoxContainer/MarginBox2/ButtonsVbox"] +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +focus_neighbor_left = NodePath("../QuitButton") +focus_neighbor_top = NodePath("../QuitButton") +focus_neighbor_right = NodePath("../SettingsButton") +focus_neighbor_bottom = NodePath("../SettingsButton") +focus_next = NodePath("../SettingsButton") +focus_previous = NodePath("../QuitButton") +theme = ExtResource("4_bajby") +theme_override_font_sizes/font_size = 64 +text = "Play" + +[node name="SettingsButton" type="Button" parent="VBoxContainer/MarginBox2/ButtonsVbox"] +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +focus_neighbor_left = NodePath("../PlayButton") +focus_neighbor_top = NodePath("../PlayButton") +focus_neighbor_right = NodePath("../AboutButton") +focus_neighbor_bottom = NodePath("../AboutButton") +focus_next = NodePath("../AboutButton") +focus_previous = NodePath("../PlayButton") +theme = ExtResource("4_bajby") +theme_override_font_sizes/font_size = 64 +text = "Settings" + +[node name="AboutButton" type="Button" parent="VBoxContainer/MarginBox2/ButtonsVbox"] +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +focus_neighbor_left = NodePath("../SettingsButton") +focus_neighbor_top = NodePath("../SettingsButton") +focus_neighbor_right = NodePath("../QuitButton") +focus_neighbor_bottom = NodePath("../QuitButton") +focus_next = NodePath("../QuitButton") +focus_previous = NodePath("../SettingsButton") +theme = ExtResource("4_bajby") +theme_override_font_sizes/font_size = 64 +text = "About" + +[node name="Spacer2" type="MarginContainer" parent="VBoxContainer/MarginBox2/ButtonsVbox"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="QuitButton" type="Button" parent="VBoxContainer/MarginBox2/ButtonsVbox"] +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +focus_neighbor_left = NodePath("../AboutButton") +focus_neighbor_top = NodePath("../AboutButton") +focus_neighbor_right = NodePath("../PlayButton") +focus_neighbor_bottom = NodePath("../PlayButton") +focus_next = NodePath("../PlayButton") +focus_previous = NodePath("../AboutButton") +theme = ExtResource("4_bajby") +theme_override_font_sizes/font_size = 64 +text = "Quit" + +[node name="MusicPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("9_gyelf") +bus = &"Music" + +[connection signal="pressed" from="VBoxContainer/MarginBox2/ButtonsVbox/PlayButton" to="." method="_on_play_button_pressed"] +[connection signal="pressed" from="VBoxContainer/MarginBox2/ButtonsVbox/SettingsButton" to="." method="_on_settings_button_pressed"] +[connection signal="pressed" from="VBoxContainer/MarginBox2/ButtonsVbox/AboutButton" to="." method="_on_about_button_pressed"] +[connection signal="pressed" from="VBoxContainer/MarginBox2/ButtonsVbox/QuitButton" to="." method="_on_quit_button_pressed"] diff --git a/Scripts/UI/MainMenuManager.gd b/Scripts/UI/MainMenuManager.gd index 5d0e940..037b32e 100644 --- a/Scripts/UI/MainMenuManager.gd +++ b/Scripts/UI/MainMenuManager.gd @@ -4,6 +4,7 @@ extends Node @export var settings_scene : Resource @export var default_focus : Control @export var autostart_animations : Array[NodePath] +@export var music_player : AudioStreamPlayer # Engine Callbackss func _ready(): @@ -18,6 +19,7 @@ func _ready(): default_focus.grab_focus() for animation in autostart_animations: (get_node(animation) as AnimationPlayer).play("Autostart") + music_player.play(0.0) pass func _on_play_button_pressed(): diff --git a/project.godot b/project.godot index 4495c8c..5d508a3 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="HoppyEaster" -run/main_scene="res://Scenes/Main Menu.tscn" +run/main_scene="res://Scenes/Main Menu Music Fix.tscn" config/features=PackedStringArray("4.0", "GL Compatibility") config/icon="res://icon.svg"