diff --git a/assets/audio/sfx/pause.mp3 b/assets/audio/gui/pause.mp3 similarity index 100% rename from assets/audio/sfx/pause.mp3 rename to assets/audio/gui/pause.mp3 diff --git a/assets/audio/gui/pause.mp3.import b/assets/audio/gui/pause.mp3.import new file mode 100644 index 0000000..139093d --- /dev/null +++ b/assets/audio/gui/pause.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://ckja8ym50y0d4" +path="res://.godot/imported/pause.mp3-10f7613d15cb333d7efaf86fb9f4755c.mp3str" + +[deps] + +source_file="res://assets/audio/gui/pause.mp3" +dest_files=["res://.godot/imported/pause.mp3-10f7613d15cb333d7efaf86fb9f4755c.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/audio/sfx/pause.mp3.import b/assets/audio/sfx/pause.mp3.import deleted file mode 100644 index 3c76b64..0000000 --- a/assets/audio/sfx/pause.mp3.import +++ /dev/null @@ -1,19 +0,0 @@ -[remap] - -importer="mp3" -type="AudioStreamMP3" -uid="uid://ckja8ym50y0d4" -path="res://.godot/imported/pause.mp3-e9d4dab5bf1cbf6ecf379df2f1abb654.mp3str" - -[deps] - -source_file="res://assets/audio/sfx/pause.mp3" -dest_files=["res://.godot/imported/pause.mp3-e9d4dab5bf1cbf6ecf379df2f1abb654.mp3str"] - -[params] - -loop=false -loop_offset=0 -bpm=0 -beat_count=0 -bar_beats=4 diff --git a/project.godot b/project.godot index 1ec38b8..c6d4000 100644 --- a/project.godot +++ b/project.godot @@ -87,6 +87,21 @@ cheat_zombie_spawn={ "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":4194332,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +short_pause={ +"deadzone": 0.2, +"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":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +short_ff={ +"deadzone": 0.2, +"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":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +short_shovel={ +"deadzone": 0.2, +"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) +] +} [internationalization] diff --git a/scenes/entities/Zombies/zombie.tscn b/scenes/entities/Zombies/zombie.tscn index c1bcdcb..5244ddd 100644 --- a/scenes/entities/Zombies/zombie.tscn +++ b/scenes/entities/Zombies/zombie.tscn @@ -825,7 +825,7 @@ metadata/_edit_lock_ = true [node name="RightUpperLeg" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt"] use_parent_material = true position = Vector2(-6, 3) -scale = Vector2(0.999832, 0.999832) +scale = Vector2(0.999834, 0.999834) rest = Transform2D(1, 0, 0, 1, -6, 3) editor_settings/show_bone_gizmo = false @@ -837,13 +837,13 @@ metadata/_edit_lock_ = true [node name="RightLowerLeg" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg"] position = Vector2(-2, 12) -scale = Vector2(0.999833, 0.999833) +scale = Vector2(0.999832, 0.999832) rest = Transform2D(1, 0, 0, 1, -2, 12) editor_settings/show_bone_gizmo = false [node name="RightFoot" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg/RightLowerLeg"] position = Vector2(-2, 14) -scale = Vector2(0.999837, 0.999837) +scale = Vector2(0.999836, 0.999836) rest = Transform2D(1, 0, 0, 1, -2, 14) auto_calculate_length_and_angle = false length = 12.0 @@ -866,7 +866,7 @@ metadata/_edit_lock_ = true [node name="LeftUpperLeg" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt"] use_parent_material = true position = Vector2(6, 4) -scale = Vector2(0.999833, 0.999833) +scale = Vector2(0.99983, 0.99983) rest = Transform2D(1, 0, 0, 1, 6, 4) editor_settings/show_bone_gizmo = false @@ -878,7 +878,7 @@ metadata/_edit_lock_ = true [node name="LeftLowerLeg" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg"] position = Vector2(-1, 13) -scale = Vector2(0.999837, 0.999837) +scale = Vector2(0.999833, 0.999833) rest = Transform2D(1, 0, 0, 1, -1, 13) editor_settings/show_bone_gizmo = false @@ -890,7 +890,7 @@ metadata/_edit_lock_ = true [node name="LeftFoot" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg"] position = Vector2(6, 10) -scale = Vector2(0.999832, 0.999832) +scale = Vector2(0.999828, 0.999828) rest = Transform2D(1, 0, 0, 1, 6, 10) auto_calculate_length_and_angle = false length = 12.0 @@ -906,7 +906,7 @@ metadata/_edit_lock_ = true [node name="Body" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt"] use_parent_material = true position = Vector2(1, -2) -scale = Vector2(0.99983, 0.99983) +scale = Vector2(0.999825, 0.999825) rest = Transform2D(1, 0, 0, 1, 1, -2) editor_settings/show_bone_gizmo = false @@ -932,7 +932,7 @@ editor_settings/show_bone_gizmo = false [node name="RightHand" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm/RightLowerArm"] position = Vector2(-1, 13) -scale = Vector2(0.999829, 0.999829) +scale = Vector2(0.999827, 0.999827) rest = Transform2D(1, 0, 0, 1, -1, 13) auto_calculate_length_and_angle = false length = 8.0 @@ -961,8 +961,8 @@ metadata/_edit_lock_ = true [node name="Tie" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body"] visible = false position = Vector2(-9, -21) -rotation = -0.125046 -skew = -0.000392795 +rotation = 0.0770195 +skew = -0.00039506 rest = Transform2D(1, 0, 0, 1, -9, -21) auto_calculate_length_and_angle = false length = 24.0 @@ -977,7 +977,7 @@ metadata/_edit_lock_ = true [node name="Head" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body"] position = Vector2(-10, -25) -scale = Vector2(0.999826, 0.999826) +scale = Vector2(0.999822, 0.999822) rest = Transform2D(1, 0, 0, 1, -10, -25) editor_settings/show_bone_gizmo = false @@ -1006,16 +1006,16 @@ offset = Vector2(-2, -2) metadata/_edit_lock_ = true [node name="Left_Eye" type="Sprite2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head"] -position = Vector2(-4, -9.00001) +position = Vector2(-4, -9) texture = SubResource("AtlasTexture_kto0i") centered = false offset = Vector2(-2, -2) metadata/_edit_lock_ = true [node name="Jaw" type="Sprite2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head"] -position = Vector2(-2.74696, 2.38929) -rotation = -0.0682854 -scale = Vector2(0.999829, 0.999829) +position = Vector2(-3.00095, 2.9984) +rotation = 0.00747448 +scale = Vector2(0.999828, 0.999828) texture = SubResource("AtlasTexture_x5uj2") centered = false offset = Vector2(-12, -2) @@ -1032,7 +1032,7 @@ _observedEntity = NodePath("../../../../../../../..") [node name="Jaw" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head"] position = Vector2(-3, 3) -scale = Vector2(0.999829, 0.999829) +scale = Vector2(0.999828, 0.999828) rest = Transform2D(1, 0, 0, 1, -3, 3) auto_calculate_length_and_angle = false length = 11.0 @@ -1066,7 +1066,7 @@ remote_path = NodePath("../../HeadParticle/Head/Left_Eye") [node name="LeftUpperArm" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body"] position = Vector2(-1, -20) -scale = Vector2(0.999827, 0.999827) +scale = Vector2(0.999829, 0.999829) rest = Transform2D(1, 0, 0, 1, -1, -20) editor_settings/show_bone_gizmo = false @@ -1088,7 +1088,7 @@ minTorque = -45.0 maxTorque = 45.0 [node name="Left_Lower_Arm" type="Sprite2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile"] -rotation = -0.0815818 +rotation = 0.0724153 scale = Vector2(0.999998, 0.999998) texture = SubResource("AtlasTexture_auqeq") centered = false @@ -1097,9 +1097,9 @@ metadata/_edit_lock_ = true [node name="Left_Hand" type="Sprite2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile/Left_Lower_Arm"] show_behind_parent = true -position = Vector2(-0.999829, 12.9978) -rotation = -0.138919 -scale = Vector2(0.999663, 0.999663) +position = Vector2(-0.99983, 12.9978) +rotation = -0.0319596 +scale = Vector2(0.999659, 0.999659) texture = SubResource("AtlasTexture_vlvtp") centered = false offset = Vector2(-4, -1) @@ -1121,7 +1121,7 @@ editor_settings/show_bone_gizmo = false [node name="LeftHand" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/LeftLowerArm"] position = Vector2(-1, 13) -scale = Vector2(0.999833, 0.999833) +scale = Vector2(0.999828, 0.999828) rest = Transform2D(1, 0, 0, 1, -1, 13) auto_calculate_length_and_angle = false length = 6.0 @@ -1171,7 +1171,7 @@ entity = NodePath("..") [node name="Mover" type="Node" parent="."] script = ExtResource("4_u5syx") _speed = SubResource("Resource_ckb7n") -_speedControlMult = 1.08005 +_speedControlMult = 0.248477 [node name="ChompPlayer" type="Node" parent="."] script = ExtResource("10_ruqsf") diff --git a/scenes/gui/runtime_gui.tscn b/scenes/gui/runtime_gui.tscn index 0dc969f..7ea9bbf 100644 --- a/scenes/gui/runtime_gui.tscn +++ b/scenes/gui/runtime_gui.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://cfnmspei3k4p7"] +[gd_scene load_steps=21 format=3 uid="uid://cfnmspei3k4p7"] [ext_resource type="PackedScene" uid="uid://ky35veswaytr" path="res://scenes/gui/sun_counter.tscn" id="1_le3od"] [ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/themes/GameStyle.tres" id="1_xf6ra"] @@ -10,7 +10,6 @@ [ext_resource type="PackedScene" uid="uid://b4lx8adw6rbqs" path="res://scenes/particles/dirt_explosion.tscn" id="6_5jtun"] [ext_resource type="Script" uid="uid://c36bj8u7jghc7" path="res://scripts/audio/ChannelPlayer.cs" id="7_5kkbf"] [ext_resource type="AudioStream" uid="uid://dfbg6dxg4actb" path="res://assets/audio/sfx/shovel.mp3" id="8_xq48m"] -[ext_resource type="AudioStream" uid="uid://ckja8ym50y0d4" path="res://assets/audio/sfx/pause.mp3" id="11_cti1a"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ps2iw"] texture = ExtResource("2_eg3hk") @@ -20,6 +19,27 @@ texture_margin_right = 4.0 texture_margin_bottom = 4.0 axis_stretch_horizontal = 1 +[sub_resource type="InputEventAction" id="InputEventAction_xq48m"] +action = &"short_shovel" +pressed = true + +[sub_resource type="Shortcut" id="Shortcut_cti1a"] +events = [SubResource("InputEventAction_xq48m")] + +[sub_resource type="InputEventAction" id="InputEventAction_5kkbf"] +action = &"short_ff" +pressed = true + +[sub_resource type="Shortcut" id="Shortcut_xq48m"] +events = [SubResource("InputEventAction_5kkbf")] + +[sub_resource type="InputEventAction" id="InputEventAction_cti1a"] +action = &"short_pause" +pressed = true + +[sub_resource type="Shortcut" id="Shortcut_s07y0"] +events = [SubResource("InputEventAction_cti1a")] + [sub_resource type="Animation" id="Animation_c8fnk"] length = 0.001 tracks/0/type = "bezier" @@ -116,6 +136,7 @@ size_flags_horizontal = 3 layout_mode = 2 size_flags_horizontal = 1 size_flags_vertical = 4 +shortcut = SubResource("Shortcut_cti1a") particles = ExtResource("6_5jtun") [node name="ChannelPlayer" type="Node" parent="MarginContainer/Control/Hotbar/ShovelButton"] @@ -126,6 +147,7 @@ metadata/_custom_type_script = "uid://c36bj8u7jghc7" [node name="FastForwardButton" parent="MarginContainer/Control/Hotbar" node_paths=PackedStringArray("flashAnimator") instance=ExtResource("4_66uy4")] layout_mode = 2 +shortcut = SubResource("Shortcut_xq48m") flashAnimator = NodePath("../../../../FastForwardEffect/AnimationPlayer") [node name="ChannelPlayer" type="Node" parent="MarginContainer/Control/Hotbar/FastForwardButton"] @@ -136,12 +158,7 @@ metadata/_custom_type_script = "uid://c36bj8u7jghc7" [node name="PauseButton" parent="MarginContainer/Control/Hotbar" instance=ExtResource("5_jyq78")] process_mode = 3 layout_mode = 2 - -[node name="ChannelPlayer" type="Node" parent="MarginContainer/Control/Hotbar/PauseButton"] -script = ExtResource("7_5kkbf") -audioStream = ExtResource("11_cti1a") -channel = "pause" -metadata/_custom_type_script = "uid://c36bj8u7jghc7" +shortcut = SubResource("Shortcut_s07y0") [node name="FastForwardEffect" type="ColorRect" parent="."] z_index = 1 @@ -161,4 +178,3 @@ libraries = { } [connection signal="pressed" from="MarginContainer/Control/Hotbar/ShovelButton" to="MarginContainer/Control/Hotbar/ShovelButton/ChannelPlayer" method="Play"] -[connection signal="pressed" from="MarginContainer/Control/Hotbar/PauseButton" to="MarginContainer/Control/Hotbar/PauseButton/ChannelPlayer" method="Play"] diff --git a/scripts/gui/PauseMenu.cs b/scripts/gui/PauseMenu.cs index 1233132..4c132f9 100644 --- a/scripts/gui/PauseMenu.cs +++ b/scripts/gui/PauseMenu.cs @@ -5,6 +5,8 @@ public partial class PauseMenu : Control { private static PauseMenu Instance; private bool previousPaused; + private bool currently_paused = false; + private AudioStream pauseSound = ResourceLoader.Load("uid://ckja8ym50y0d4"); public override void _Ready() { Instance = this; @@ -14,20 +16,29 @@ public partial class PauseMenu : Control { GetParent().Visible = false; GetTree().Paused = previousPaused; + currently_paused = false; } public void Restart() { GetTree().Paused = false; GetTree().ReloadCurrentScene(); + currently_paused = false; } public void Exit() { GetTree().ChangeSceneToFile("uid://bfstrli64u23y"); + currently_paused = false; } public static void Pause() { + if (Instance.currently_paused) + { + return; + } Instance.GetParent().Visible = true; Instance.previousPaused = Instance.GetTree().Paused; Instance.GetTree().Paused = true; + Instance.currently_paused = true; + AudioSequencer.Play("pause",Instance.pauseSound); } } diff --git a/scripts/gui/ShovelButton.cs b/scripts/gui/ShovelButton.cs index b08008a..de04638 100644 --- a/scripts/gui/ShovelButton.cs +++ b/scripts/gui/ShovelButton.cs @@ -24,18 +24,22 @@ public partial class ShovelButton : TextureButton { var checkedPosition = (PoolContainer.Instance.Plants.GetGlobalMousePosition() / Utility.Tile).Ceil() * Utility.Tile - new Vector2(20, 14); - for (int i = Utility.LayersCount-1; i >= 0; i--) + for (int i = Utility.LayersCount - 1; i >= 0; i--) { if (PoolContainer.Instance.EntityField[i].TryGetValue(checkedPosition, out var entity) && entity is RuntimePlantData plantData) { plantData.Kill(); - PoolContainer.Instance.SpawnParticles(particles, plantData.GlobalPosition + Vector2.Down * Utility.TileHeight/2.0f); + PoolContainer.Instance.SpawnParticles(particles, plantData.GlobalPosition + Vector2.Down * Utility.TileHeight / 2.0f); break; } } ButtonPressed = false; } + if (@event.IsActionPressed("cancel_plant") && ButtonPressed) + { + ButtonPressed = false; + } } }