From 31ba17212399b53d322b8301059b9453886d1a77 Mon Sep 17 00:00:00 2001 From: Rendo Date: Mon, 28 Jul 2025 05:45:31 +0500 Subject: [PATCH] Aqua state --- project.godot | 2 +- scenes/entities/Zombies/cone_zombie.tscn | 56 +++++++++---------- scripts/entities/plants/DragAction.cs | 9 ++- .../plants/behaviours/SnipachBehaviour.cs | 13 ++++- scripts/gui/ShovelButton.cs | 2 +- scripts/level/PlantField.cs | 2 +- 6 files changed, 48 insertions(+), 36 deletions(-) diff --git a/project.godot b/project.godot index ff3a6fe..47f48bf 100644 --- a/project.godot +++ b/project.godot @@ -126,7 +126,7 @@ cheat_add_sun={ "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":4194333,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } -cancel_plant={ +cancel_action={ "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":2,"position":Vector2(82, 2),"global_position":Vector2(91, 41),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) , 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) diff --git a/scenes/entities/Zombies/cone_zombie.tscn b/scenes/entities/Zombies/cone_zombie.tscn index 19edda0..894b678 100644 --- a/scenes/entities/Zombies/cone_zombie.tscn +++ b/scenes/entities/Zombies/cone_zombie.tscn @@ -14,14 +14,6 @@ [ext_resource type="AudioStream" uid="uid://w0qfwds4o3ti" path="res://assets/audio/sfx/hit_generic.tres" id="7_67t4t"] [ext_resource type="Script" uid="uid://30pbgasu64aw" path="res://scripts/entities/FlashShaderController.cs" id="13_7fceb"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_b8kja"] -resource_local_to_scene = true -shader = ExtResource("2_s2p07") -shader_parameter/FLASH_COLOR = Color(1, 0.709804, 0.439216, 0.5) -shader_parameter/HIGHLIGHT_COLOR = Color(1, 0.709804, 0.439216, 0.5) -shader_parameter/blend = 0.0 -shader_parameter/selected = false - [sub_resource type="CircleShape2D" id="CircleShape2D_67t4t"] [sub_resource type="Resource" id="Resource_011r0"] @@ -38,12 +30,17 @@ flat_value = 0.2 percentage_value = 0.0 mult_value = 1.0 +[sub_resource type="ShaderMaterial" id="ShaderMaterial_b8kja"] +resource_local_to_scene = true +shader = ExtResource("2_s2p07") +shader_parameter/FLASH_COLOR = Color(1, 0.709804, 0.439216, 0.5) +shader_parameter/HIGHLIGHT_COLOR = Color(1, 0.709804, 0.439216, 0.5) +shader_parameter/blend = 0.0 +shader_parameter/selected = false + [node name="ConeZombie" node_paths=PackedStringArray("_armor") instance=ExtResource("1_3dq4c")] _armor = NodePath("Armor") -[node name="CanvasGroup" parent="." index="0"] -material = SubResource("ShaderMaterial_b8kja") - [node name="RightUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="1"] scale = Vector2(0.999835, 0.999835) @@ -63,33 +60,33 @@ scale = Vector2(0.999833, 0.999833) scale = Vector2(0.999829, 0.999829) [node name="Body" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="3"] -scale = Vector2(0.999829, 0.999829) +scale = Vector2(0.99983, 0.99983) [node name="RightUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="0"] -scale = Vector2(0.999827, 0.999827) +scale = Vector2(0.999829, 0.999829) [node name="RightLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm" index="1"] -scale = Vector2(0.999828, 0.999828) +scale = Vector2(0.999826, 0.999826) [node name="RightHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm/RightLowerArm" index="0"] -scale = Vector2(0.999827, 0.999827) - -[node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="2"] -rotation = -0.043512 -skew = -0.000153303 - -[node name="Head" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="3"] scale = Vector2(0.999828, 0.999828) +[node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="2"] +rotation = 0.0945796 +skew = -0.000153542 + +[node name="Head" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="3"] +scale = Vector2(0.999829, 0.999829) + [node name="Right_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="0"] -position = Vector2(-16, -8.00001) +position = Vector2(-16, -8) [node name="Left_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="1"] position = Vector2(-4, -9) [node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="2"] -position = Vector2(-2.94596, 2.86958) -rotation = -0.0303934 +position = Vector2(-3.00116, 2.99804) +rotation = 0.00917867 scale = Vector2(0.999829, 0.999829) [node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head" index="1"] @@ -123,19 +120,19 @@ position = Vector2(1, -6) shape = SubResource("CircleShape2D_67t4t") [node name="LeftUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="4"] -scale = Vector2(0.999832, 0.999832) +scale = Vector2(0.999833, 0.999833) [node name="Left_Lower_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile" index="0"] -rotation = -0.0461189 -scale = Vector2(1, 1) +rotation = 0.0889256 +scale = Vector2(0.999999, 0.999999) [node name="Left_Hand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile/Left_Lower_Arm" index="0"] position = Vector2(-0.99983, 12.9978) -rotation = -0.0380157 +rotation = -0.0392463 scale = Vector2(0.999658, 0.999658) [node name="LeftLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm" index="2"] -scale = Vector2(0.999832, 0.999832) +scale = Vector2(0.999829, 0.999829) [node name="LeftHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/LeftLowerArm" index="0"] scale = Vector2(0.999828, 0.999828) @@ -145,6 +142,7 @@ _damage = SubResource("Resource_011r0") [node name="Mover" parent="." index="4"] _speed = SubResource("Resource_b6mal") +_speedControlMult = 0.371759 [node name="HitPlayer" parent="." index="5"] playlist = Array[AudioStream]([ExtResource("7_0amn8"), ExtResource("7_67t4t")]) diff --git a/scripts/entities/plants/DragAction.cs b/scripts/entities/plants/DragAction.cs index f21d194..d18f271 100644 --- a/scripts/entities/plants/DragAction.cs +++ b/scripts/entities/plants/DragAction.cs @@ -5,7 +5,7 @@ namespace Newlon.Components.Plants; public partial class DragAction : Node { [Signal] public delegate void DragBeginEventHandler(); - [Signal] public delegate void DragEndEventHandler(); + [Signal] public delegate void DragEndEventHandler(bool aborted); private bool dragging = false; private bool toggle = false; private bool can_end = false; @@ -38,9 +38,14 @@ public partial class DragAction : Node if (dragging && can_end && (toggle == false && @event.IsActionReleased("primary_action") || (toggle == true && @event.IsActionPressed("primary_action")))) { dragging = false; - EmitSignal(SignalName.DragEnd); + EmitSignal(SignalName.DragEnd,false); GetViewport().SetInputAsHandled(); } + if (dragging && @event.IsActionPressed("cancel_action")) + { + dragging = false; + EmitSignal(SignalName.DragEnd,true); + } } public void OnToggleTimeout() { diff --git a/scripts/entities/plants/behaviours/SnipachBehaviour.cs b/scripts/entities/plants/behaviours/SnipachBehaviour.cs index fffd2c1..a3fe28e 100644 --- a/scripts/entities/plants/behaviours/SnipachBehaviour.cs +++ b/scripts/entities/plants/behaviours/SnipachBehaviour.cs @@ -16,12 +16,13 @@ public partial class SnipachBehaviour : BaseBehaviour attackBox.Visible = dragging; } - public void OnDragEnd() + public void OnDragEnd(bool aborted) { if (dragging == false) return; - attackBox.Attack(); dragging = false; attackBox.Visible = dragging; + if (aborted) return; + attackBox.Attack(); timer.Start(); } @@ -31,6 +32,14 @@ public partial class SnipachBehaviour : BaseBehaviour { attackBox.GlobalPosition = (Cursor.GetCursorPosition() / FieldParams.Tile).Ceil() * FieldParams.Tile - new Vector2(20, 14); } + if (timer.TimeLeft > 0) + { + GetParent().Modulate = Colors.DeepSkyBlue; + } + else + { + GetParent().Modulate = Colors.White; + } } } diff --git a/scripts/gui/ShovelButton.cs b/scripts/gui/ShovelButton.cs index 605d274..c1ba12e 100644 --- a/scripts/gui/ShovelButton.cs +++ b/scripts/gui/ShovelButton.cs @@ -55,7 +55,7 @@ public partial class ShovelButton : TextureButton hoveredEntity = null; ButtonPressed = false; } - if (@event.IsActionPressed("cancel_plant") && ButtonPressed) + if (@event.IsActionPressed("cancel_action") && ButtonPressed) { hoveredEntity?.GetNode("FlashController").Deselect(); hoveredEntity = null; diff --git a/scripts/level/PlantField.cs b/scripts/level/PlantField.cs index 57a2e0d..d54a11b 100644 --- a/scripts/level/PlantField.cs +++ b/scripts/level/PlantField.cs @@ -83,7 +83,7 @@ public partial class PlantField : Node2D public override void _UnhandledInput(InputEvent @event) { - if (@event.IsActionPressed("cancel_plant") && _slot != null) + if (@event.IsActionPressed("cancel_action") && _slot != null) { ResetPlant(); }