Sun, Shovel, Fastforward, GUI Improvements

This commit is contained in:
Фёдор Веселов 2024-09-16 09:57:11 +05:00
commit 63935d5978
28 changed files with 546 additions and 45 deletions

View file

@ -1,10 +1,12 @@
[gd_scene load_steps=6 format=3 uid="uid://crxsvv7drckpw"]
[gd_scene load_steps=8 format=3 uid="uid://crxsvv7drckpw"]
[ext_resource type="Script" path="res://scripts/components/level/RuntimeLevelData.cs" id="1_i3bf5"]
[ext_resource type="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/summertime_saga.png" id="2_vmxhy"]
[ext_resource type="PackedScene" uid="uid://cg8713v6c5w15" path="res://scenes/pools.tscn" id="3_jv7x4"]
[ext_resource type="PackedScene" uid="uid://devn21c7luf45" path="res://scenes/level components/field_controller.tscn" id="5_lwpg6"]
[ext_resource type="PackedScene" uid="uid://cfnmspei3k4p7" path="res://scenes/gui/runtime_gui.tscn" id="6_0baou"]
[ext_resource type="PackedScene" uid="uid://bpekho7leatr5" path="res://scenes/sun.tscn" id="6_ay12k"]
[ext_resource type="Script" path="res://scripts/components/level/SunSpawner.cs" id="6_lkguy"]
[node name="debug_lvl" type="Node2D"]
@ -19,7 +21,6 @@ metadata/_edit_lock_ = true
[node name="RuntimeLevelData" type="Node" parent="."]
script = ExtResource("1_i3bf5")
SunCount = 5000
[node name="Pools" parent="." instance=ExtResource("3_jv7x4")]
@ -27,9 +28,20 @@ SunCount = 5000
layer = 10
[node name="RuntimeGUI" parent="GuiLayer" instance=ExtResource("6_0baou")]
metadata/_edit_lock_ = true
[node name="Overlay" type="CanvasLayer" parent="."]
layer = 5
layer = 6
follow_viewport_enabled = true
[node name="FieldController" parent="Overlay" instance=ExtResource("5_lwpg6")]
[node name="SunSpawner" type="Node" parent="."]
script = ExtResource("6_lkguy")
SunScene = ExtResource("6_ay12k")
[node name="Timer" type="Timer" parent="SunSpawner"]
wait_time = 5.0
autostart = true
[connection signal="timeout" from="SunSpawner/Timer" to="SunSpawner" method="Spawn"]

View file

@ -62,6 +62,7 @@ resource_local_to_scene = true
b = Vector2(5.865, 0)
[node name="Peashooter" type="Node2D"]
y_sort_enabled = true
script = ExtResource("1_f4h5i")
[node name="Sprite" type="Sprite2D" parent="."]

View file

@ -1,6 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://cgm7td1hgs0rr"]
[gd_scene load_steps=5 format=3 uid="uid://cgm7td1hgs0rr"]
[ext_resource type="Texture2D" uid="uid://bjsar1x67xk1t" path="res://assets/sprites/gui/FastForward1.tres" id="1_ta3h7"]
[ext_resource type="Script" path="res://scripts/components/gui/FastForwardButton.cs" id="2_wle4k"]
[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"]
anchors_preset = -1
@ -10,3 +13,9 @@ size_flags_vertical = 4
mouse_default_cursor_shape = 2
texture_normal = ExtResource("1_ta3h7")
stretch_mode = 0
script = ExtResource("2_wle4k")
firstSpeed = ExtResource("1_ta3h7")
secondSpeed = ExtResource("3_fj838")
thirdSpeed = ExtResource("4_2wmv1")
[connection signal="pressed" from="." to="." method="OnPressed"]

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=9 format=3 uid="uid://c8qru1yhnbbkl"]
[gd_scene load_steps=10 format=3 uid="uid://c8qru1yhnbbkl"]
[ext_resource type="Texture2D" uid="uid://cabpf23ndlvx0" path="res://assets/sprites/gui/Selection.tres" id="2_5mpv8"]
[ext_resource type="Texture2D" uid="uid://cxlr34yh0bqch" path="res://assets/sprites/gui/DisabledEmptyCard.png" id="2_odd6g"]
[ext_resource type="Script" path="res://scripts/components/gui/PlantSlot.cs" id="3_eer7n"]
[ext_resource type="Shader" path="res://assets/shaders/gui_masking.gdshader" id="4_bryew"]
[ext_resource type="Texture2D" uid="uid://dxyf557m4mq1p" path="res://assets/sprites/gui/EmptyPlantCard.png" id="5_2k0xq"]
@ -22,6 +23,7 @@ anchor_bottom = 0.28
offset_right = -0.200005
mouse_default_cursor_shape = 2
texture_normal = ExtResource("5_2k0xq")
texture_disabled = ExtResource("2_odd6g")
texture_focused = ExtResource("2_5mpv8")
stretch_mode = 0
script = ExtResource("3_eer7n")

View file

@ -25,6 +25,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_xf6ra")
[node name="Hotbar" type="HBoxContainer" parent="."]
@ -34,7 +35,7 @@ anchor_right = 1.0
anchor_bottom = 0.14
offset_bottom = -29.0
grow_horizontal = 2
metadata/_edit_use_anchors_ = true
mouse_filter = 2
[node name="SunCounter" parent="Hotbar" instance=ExtResource("1_le3od")]
layout_mode = 2
@ -45,6 +46,7 @@ theme_override_styles/panel = SubResource("StyleBoxTexture_ps2iw")
[node name="Seedpackets" type="HBoxContainer" parent="Hotbar/PanelContainer"]
layout_mode = 2
mouse_filter = 2
theme_override_constants/separation = 0
[node name="FirstSlot" parent="Hotbar/PanelContainer/Seedpackets" instance=ExtResource("2_cjtsw")]
@ -79,6 +81,8 @@ layout_mode = 2
[node name="ShovelButton" parent="Hotbar" instance=ExtResource("3_bheea")]
layout_mode = 2
size_flags_horizontal = 1
size_flags_vertical = 4
[node name="FastForwardButton" parent="Hotbar" instance=ExtResource("4_66uy4")]
layout_mode = 2

View file

@ -1,6 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://t0vpmycj6c8j"]
[gd_scene load_steps=4 format=3 uid="uid://t0vpmycj6c8j"]
[ext_resource type="Texture2D" uid="uid://cw73vihkrfenc" path="res://assets/sprites/gui/Shovel.tres" id="1_46afk"]
[ext_resource type="Texture2D" uid="uid://fd6drk2su0df" path="res://assets/sprites/gui/EmptyShovel.tres" id="2_pw2pj"]
[ext_resource type="Script" path="res://scripts/components/gui/ShovelButton.cs" id="3_u6gir"]
[node name="ShovelButton" type="TextureButton"]
anchors_preset = -1
@ -11,5 +13,18 @@ offset_bottom = -6.8
size_flags_horizontal = 4
size_flags_vertical = 0
mouse_default_cursor_shape = 2
toggle_mode = true
texture_normal = ExtResource("1_46afk")
texture_pressed = ExtResource("2_pw2pj")
stretch_mode = 0
script = ExtResource("3_u6gir")
[node name="RayCast2D" type="RayCast2D" parent="."]
enabled = false
target_position = Vector2(0, 0)
collision_mask = 2
hit_from_inside = true
collide_with_areas = true
collide_with_bodies = false
[connection signal="focus_exited" from="." to="." method="OnFocusExited"]

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://ky35veswaytr"]
[gd_scene load_steps=6 format=3 uid="uid://ky35veswaytr"]
[ext_resource type="Texture2D" uid="uid://bhp3vuvwf7lak" path="res://assets/sprites/gui/suncounter.tres" id="1_e5x4k"]
[ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/GameStyle.tres" id="1_vhhcn"]
[ext_resource type="Texture2D" uid="uid://c47rflkf2wap0" path="res://assets/sprites/sun.tres" id="2_gugre"]
[ext_resource type="Script" path="res://scripts/components/gui/SunCounter.cs" id="3_qhmb8"]
@ -15,6 +16,7 @@ anchor_bottom = 0.067
offset_right = -0.200001
offset_bottom = 0.199999
size_flags_vertical = 0
theme = ExtResource("1_vhhcn")
texture = ExtResource("1_e5x4k")
[node name="Sun" type="TextureRect" parent="."]
@ -37,11 +39,11 @@ anchors_preset = -1
anchor_left = 0.122
anchor_top = 0.222
anchor_right = 0.878
anchor_bottom = 0.778
anchor_bottom = 0.815
offset_left = 0.0219994
offset_top = 0.00599957
offset_right = -0.0219994
offset_bottom = -0.00600243
offset_bottom = -0.00500107
label_settings = SubResource("LabelSettings_lxkq5")
horizontal_alignment = 1
vertical_alignment = 1

174
scenes/sun.tscn Normal file
View file

@ -0,0 +1,174 @@
[gd_scene load_steps=13 format=3 uid="uid://bpekho7leatr5"]
[ext_resource type="Shader" path="res://assets/shaders/shared_outline.gdshader" id="1_jcu1f"]
[ext_resource type="Script" path="res://scripts/Sun.cs" id="2_m8xcj"]
[ext_resource type="Texture2D" uid="uid://bkmphus5wjadi" path="res://assets/sprites/atlases/sun_atlas.png" id="2_phn3y"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u0o5k"]
shader = ExtResource("1_jcu1f")
shader_parameter/line_colour = Color(1, 0.568627, 0.4, 1)
shader_parameter/line_thickness = 3
[sub_resource type="ShaderMaterial" id="ShaderMaterial_n4y82"]
shader = ExtResource("1_jcu1f")
shader_parameter/line_colour = Color(1, 0.568627, 0.4, 1)
shader_parameter/line_thickness = 3
[sub_resource type="Animation" id="Animation_jfrge"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CanvasGroup/DownerStar:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CanvasGroup/UpperStar:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_rvj0j"]
resource_name = "main"
length = 10.0
loop_mode = 1
step = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CanvasGroup/DownerStar:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 5, 10),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [0.0, 6.28319, 12.5664]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CanvasGroup/UpperStar:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 10),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, -6.28319]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_juv2v"]
_data = {
"RESET": SubResource("Animation_jfrge"),
"main": SubResource("Animation_rvj0j")
}
[sub_resource type="Animation" id="Animation_t53pt"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CanvasGroup:modulate:a")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_xyill"]
resource_name = "main"
loop_mode = 1
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CanvasGroup:modulate:a")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0, 0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0, 0.5, 0.986673)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_p7c0n"]
_data = {
"RESET": SubResource("Animation_t53pt"),
"main": SubResource("Animation_xyill")
}
[sub_resource type="CircleShape2D" id="CircleShape2D_7hl7x"]
radius = 19.0
[node name="Sun" type="Area2D" node_paths=PackedStringArray("_deathTimer", "_rotation", "_fade")]
material = SubResource("ShaderMaterial_u0o5k")
script = ExtResource("2_m8xcj")
_deathTimer = NodePath("DeathTimer")
_rotation = NodePath("RotationAnimation")
_fade = NodePath("FadeAnimation")
[node name="CanvasGroup" type="CanvasGroup" parent="."]
material = SubResource("ShaderMaterial_n4y82")
[node name="DownerStar" type="Sprite2D" parent="CanvasGroup"]
show_behind_parent = true
texture = ExtResource("2_phn3y")
vframes = 3
[node name="UpperStar" type="Sprite2D" parent="CanvasGroup"]
show_behind_parent = true
texture = ExtResource("2_phn3y")
vframes = 3
frame = 1
[node name="Circle" type="Sprite2D" parent="CanvasGroup"]
show_behind_parent = true
texture = ExtResource("2_phn3y")
vframes = 3
frame = 2
[node name="RotationAnimation" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_juv2v")
}
autoplay = "main"
[node name="FadeAnimation" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_p7c0n")
}
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_7hl7x")
[node name="DeathTimer" type="Timer" parent="."]
wait_time = 30.0
one_shot = true
autostart = true
[node name="CursorControl" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_left = -19.0
offset_top = -19.0
offset_right = 19.0
offset_bottom = 19.0
mouse_filter = 1
mouse_default_cursor_shape = 2
[connection signal="timeout" from="DeathTimer" to="." method="queue_free"]