diff --git a/assets/sprites/atlases/atlas1.png b/assets/sprites/atlases/atlas1.png index 7e1c4d0..a33fa59 100644 Binary files a/assets/sprites/atlases/atlas1.png and b/assets/sprites/atlases/atlas1.png differ diff --git a/assets/sprites/gui/ButtonBackground.tres b/assets/sprites/gui/ButtonBackground.tres new file mode 100644 index 0000000..894b3d3 --- /dev/null +++ b/assets/sprites/gui/ButtonBackground.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://d0yhee0scl7mc"] + +[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_i6oyj"] + +[resource] +atlas = ExtResource("1_i6oyj") +region = Rect2(0, 300, 36, 36) diff --git a/assets/sprites/gui/EmptyShovel.tres b/assets/sprites/gui/EmptyShovel.tres index 3171281..99dbd9e 100644 --- a/assets/sprites/gui/EmptyShovel.tres +++ b/assets/sprites/gui/EmptyShovel.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_i8m7w") -region = Rect2(355, 68, 51, 47) +region = Rect2(341, 67, 51, 47) diff --git a/assets/sprites/gui/FastForward1.tres b/assets/sprites/gui/FastForward1.tres index 31ca5a8..97b2140 100644 --- a/assets/sprites/gui/FastForward1.tres +++ b/assets/sprites/gui/FastForward1.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_r6k0p") -region = Rect2(36, 264, 36, 36) +region = Rect2(45, 272, 18, 20) diff --git a/assets/sprites/gui/FastForward2.tres b/assets/sprites/gui/FastForward2.tres index 281bf4e..90fb247 100644 --- a/assets/sprites/gui/FastForward2.tres +++ b/assets/sprites/gui/FastForward2.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_cq0f1") -region = Rect2(72, 264, 36, 36) +region = Rect2(81, 272, 18, 20) diff --git a/assets/sprites/gui/FastForward3.tres b/assets/sprites/gui/FastForward3.tres index 3e62d8f..b8b9065 100644 --- a/assets/sprites/gui/FastForward3.tres +++ b/assets/sprites/gui/FastForward3.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_xsjda") -region = Rect2(108, 264, 36, 36) +region = Rect2(117, 272, 18, 20) diff --git a/assets/sprites/gui/Pause.tres b/assets/sprites/gui/Pause.tres index 261a76a..fa448d9 100644 --- a/assets/sprites/gui/Pause.tres +++ b/assets/sprites/gui/Pause.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_qlv5m") -region = Rect2(0, 264, 36, 36) +region = Rect2(9, 272, 18, 20) diff --git a/assets/sprites/gui/SelectionGeneric.tres b/assets/sprites/gui/SelectionGeneric.tres new file mode 100644 index 0000000..e208465 --- /dev/null +++ b/assets/sprites/gui/SelectionGeneric.tres @@ -0,0 +1,7 @@ +[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dxmg20mrnpt8r"] + +[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_sqfv1"] + +[resource] +atlas = ExtResource("1_sqfv1") +region = Rect2(156, 365, 25, 25) diff --git a/resources/GameStyle.tres b/resources/GameStyle.tres index eadda3f..1530c27 100644 --- a/resources/GameStyle.tres +++ b/resources/GameStyle.tres @@ -1,6 +1,34 @@ -[gd_resource type="Theme" load_steps=2 format=3 uid="uid://b8l285cjcgeyi"] +[gd_resource type="Theme" load_steps=6 format=3 uid="uid://b8l285cjcgeyi"] [ext_resource type="FontFile" uid="uid://nbrt5q3t8tud" path="res://assets/fonts/pico12.ttf" id="1_103to"] +[ext_resource type="Texture2D" uid="uid://d0yhee0scl7mc" path="res://assets/sprites/gui/ButtonBackground.tres" id="1_y0kbp"] +[ext_resource type="Texture2D" uid="uid://dxmg20mrnpt8r" path="res://assets/sprites/gui/SelectionGeneric.tres" id="2_h0nd2"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_na4u2"] +texture = ExtResource("1_y0kbp") +texture_margin_left = 12.0 +texture_margin_top = 12.0 +texture_margin_right = 12.0 +texture_margin_bottom = 12.0 + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_mv7jy"] +texture = ExtResource("2_h0nd2") +texture_margin_left = 12.0 +texture_margin_top = 12.0 +texture_margin_right = 12.0 +texture_margin_bottom = 12.0 +axis_stretch_horizontal = 1 +axis_stretch_vertical = 1 +draw_center = false [resource] default_font = ExtResource("1_103to") +Button/colors/font_color = Color(0, 0, 0, 1) +Button/colors/font_focus_color = Color(0, 0, 0, 1) +Button/colors/font_outline_color = Color(1, 1, 1, 1) +Button/colors/font_pressed_color = Color(1, 1, 1, 1) +Button/styles/disabled = SubResource("StyleBoxTexture_na4u2") +Button/styles/focus = SubResource("StyleBoxTexture_mv7jy") +Button/styles/hover = SubResource("StyleBoxTexture_na4u2") +Button/styles/normal = SubResource("StyleBoxTexture_na4u2") +Button/styles/pressed = SubResource("StyleBoxTexture_na4u2") diff --git a/scenes/gui/fast_forward_button.tscn b/scenes/gui/fast_forward_button.tscn index fdc01d7..1ea4282 100644 --- a/scenes/gui/fast_forward_button.tscn +++ b/scenes/gui/fast_forward_button.tscn @@ -5,17 +5,18 @@ [ext_resource type="Texture2D" uid="uid://dfr5ofieigu5j" path="res://assets/sprites/gui/FastForward2.tres" id="3_fj838"] [ext_resource type="Texture2D" uid="uid://qgmsoocd4p1o" path="res://assets/sprites/gui/FastForward3.tres" id="4_2wmv1"] -[node name="FastForwardButton" type="TextureButton"] +[node name="FastForwardButton" type="Button"] anchors_preset = -1 -anchor_right = 0.06 -anchor_bottom = 0.09 +anchor_right = 0.043 +anchor_bottom = 0.07 +offset_right = 0.199999 size_flags_vertical = 4 mouse_default_cursor_shape = 2 -texture_normal = ExtResource("1_ta3h7") -stretch_mode = 0 +icon = ExtResource("1_ta3h7") script = ExtResource("2_wle4k") firstSpeed = ExtResource("1_ta3h7") secondSpeed = ExtResource("3_fj838") thirdSpeed = ExtResource("4_2wmv1") +metadata/_edit_use_anchors_ = true [connection signal="pressed" from="." to="." method="OnPressed"] diff --git a/scenes/gui/pause_button.tscn b/scenes/gui/pause_button.tscn index 2d92202..199af83 100644 --- a/scenes/gui/pause_button.tscn +++ b/scenes/gui/pause_button.tscn @@ -2,12 +2,11 @@ [ext_resource type="Texture2D" uid="uid://dm0hjd67a6mva" path="res://assets/sprites/gui/Pause.tres" id="1_7k3tg"] -[node name="PauseButton" type="TextureButton"] +[node name="PauseButton" type="Button"] anchors_preset = -1 -anchor_right = 0.067 -anchor_bottom = 0.1 -offset_right = -0.200001 +anchor_right = 0.043 +anchor_bottom = 0.07 +offset_right = 0.199999 size_flags_vertical = 4 mouse_default_cursor_shape = 2 -texture_normal = ExtResource("1_7k3tg") -stretch_mode = 0 +icon = ExtResource("1_7k3tg") diff --git a/scenes/gui/runtime_gui.tscn b/scenes/gui/runtime_gui.tscn index 9a4f185..9b7a344 100644 --- a/scenes/gui/runtime_gui.tscn +++ b/scenes/gui/runtime_gui.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://cfnmspei3k4p7"] +[gd_scene load_steps=14 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/GameStyle.tres" id="1_xf6ra"] @@ -18,6 +18,42 @@ texture_margin_right = 4.0 texture_margin_bottom = 4.0 axis_stretch_horizontal = 1 +[sub_resource type="Animation" id="Animation_ffxdv"] +resource_name = "flash" +length = 0.3 +step = 0.1 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:color:a") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(0.25, -0.25, 0, 0, 0.00399721, 0, -0.2, 0.0038315, 0.25, 0), +"times": PackedFloat32Array(0, 0.3) +} + +[sub_resource type="Animation" id="Animation_c8fnk"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:color:a") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_myv2j"] +_data = { +"RESET": SubResource("Animation_c8fnk"), +"flash": SubResource("Animation_ffxdv") +} + [node name="RuntimeGUI" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -84,8 +120,26 @@ layout_mode = 2 size_flags_horizontal = 1 size_flags_vertical = 4 -[node name="FastForwardButton" parent="Hotbar" instance=ExtResource("4_66uy4")] +[node name="FastForwardButton" parent="Hotbar" node_paths=PackedStringArray("flashAnimator") instance=ExtResource("4_66uy4")] layout_mode = 2 +flashAnimator = NodePath("../../FastForwardEffect/AnimationPlayer") [node name="PauseButton" parent="Hotbar" instance=ExtResource("5_jyq78")] layout_mode = 2 + +[node name="FastForwardEffect" type="ColorRect" parent="."] +z_index = 1 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +color = Color(0.000150553, 0.938204, 0.707471, 0) +metadata/_edit_lock_ = true + +[node name="AnimationPlayer" type="AnimationPlayer" parent="FastForwardEffect"] +libraries = { +"": SubResource("AnimationLibrary_myv2j") +} diff --git a/scripts/components/gui/FastForwardButton.cs b/scripts/components/gui/FastForwardButton.cs index 206edbe..f686256 100644 --- a/scripts/components/gui/FastForwardButton.cs +++ b/scripts/components/gui/FastForwardButton.cs @@ -1,12 +1,14 @@ using Godot; using System; -public partial class FastForwardButton : TextureButton +public partial class FastForwardButton : Button { [Export] private Texture2D firstSpeed; [Export] private Texture2D secondSpeed; [Export] private Texture2D thirdSpeed; + [Export] private AnimationPlayer flashAnimator; + private int speed = 1; public void OnPressed() @@ -16,16 +18,18 @@ public partial class FastForwardButton : TextureButton switch (speed) { case 1: - TextureNormal = firstSpeed; + Icon = firstSpeed; break; case 2: - TextureNormal = secondSpeed; + Icon = secondSpeed; break; case 3: - TextureNormal = thirdSpeed; + Icon = thirdSpeed; break; } + flashAnimator.Play("flash"); + Engine.TimeScale = speed; } } diff --git a/scripts/components/gui/ShovelButton.cs b/scripts/components/gui/ShovelButton.cs index 5402248..6d1de2a 100644 --- a/scripts/components/gui/ShovelButton.cs +++ b/scripts/components/gui/ShovelButton.cs @@ -37,7 +37,7 @@ public partial class ShovelButton : TextureButton { if (LevelController.Instance.Pools.EntityField[i].TryGetValue(checkedPosition, out var entity) && entity is RuntimePlantData plantData) { - plantData.Kill(); + plantData.Kill(); break; } }