This commit is contained in:
Rendo 2025-07-13 04:55:33 +05:00
commit bb7c0f63c4
12 changed files with 482 additions and 28 deletions

View file

@ -0,0 +1,21 @@
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://cl5bsa2unhcl0"]
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_jrx81"]
[ext_resource type="Texture2D" uid="uid://bt76iudw2qgnv" path="res://assets/sprites/atlases/plants/cumbucer.png" id="1_tdg4d"]
[ext_resource type="PackedScene" uid="uid://cjoyh54cpjla7" path="res://scenes/entities/plants/cucumber.tscn" id="2_0mr6r"]
[sub_resource type="AtlasTexture" id="AtlasTexture_3gogt"]
atlas = ExtResource("1_tdg4d")
region = Rect2(2, 1, 41, 65)
[resource]
script = ExtResource("1_jrx81")
name_key = "cucumber"
description_key = "cucumber_desc"
Cost = 75.0
Scene = ExtResource("2_0mr6r")
ReloadTime = 5.0
ReloadProgress = 0.0
Preview = SubResource("AtlasTexture_3gogt")
Layer = 1
metadata/_custom_type_script = "uid://cyenlko1knygw"

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=62 format=3 uid="uid://bgqmwsb6ynm81"] [gd_scene load_steps=64 format=3 uid="uid://bgqmwsb6ynm81"]
[ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_fnu7s"] [ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_fnu7s"]
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_6qr4h"] [ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_6qr4h"]
[ext_resource type="Script" uid="uid://bcc7skl7ts6sh" path="res://scripts/systems/effects/Effect.cs" id="2_vn3j1"]
[ext_resource type="Resource" uid="uid://dsg1vjx76ifgu" path="res://resources/effects/GarlicEffect.tres" id="3_b583s"] [ext_resource type="Resource" uid="uid://dsg1vjx76ifgu" path="res://resources/effects/GarlicEffect.tres" id="3_b583s"]
[ext_resource type="Script" uid="uid://dt5uj25u0g6y3" path="res://scripts/particles/FallParticle.cs" id="3_tu6af"] [ext_resource type="Script" uid="uid://dt5uj25u0g6y3" path="res://scripts/particles/FallParticle.cs" id="3_tu6af"]
[ext_resource type="Script" uid="uid://c5v2og85t7s6j" path="res://scripts/zombies/behaviours/HoboBehaviour.cs" id="4_5selg"] [ext_resource type="Script" uid="uid://c5v2og85t7s6j" path="res://scripts/zombies/behaviours/HoboBehaviour.cs" id="4_5selg"]
@ -652,6 +653,13 @@ _data = {
&"RESET": SubResource("Animation_vn3j1") &"RESET": SubResource("Animation_vn3j1")
} }
[sub_resource type="Resource" id="Resource_n380g"]
resource_local_to_scene = true
script = ExtResource("4_c1y3b")
flat_value = 5.0
percentage_value = 0.0
mult_value = 1.0
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_2q05d"] [sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_2q05d"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_vn3j1"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_vn3j1"]
@ -749,7 +757,7 @@ mult_value = 1.0
[node name="Hobo" node_paths=PackedStringArray("_armor") instance=ExtResource("1_fnu7s")] [node name="Hobo" node_paths=PackedStringArray("_armor") instance=ExtResource("1_fnu7s")]
_armor = NodePath("CanArmor") _armor = NodePath("CanArmor")
MaxHP = 130.0 MaxHP = 130.0
_effectImmunities = [ExtResource("3_b583s")] _effectImmunities = Array[ExtResource("2_vn3j1")]([ExtResource("3_b583s")])
[node name="CanvasGroup" parent="." index="0"] [node name="CanvasGroup" parent="." index="0"]
material = SubResource("ShaderMaterial_w8pya") material = SubResource("ShaderMaterial_w8pya")
@ -761,16 +769,16 @@ scale = Vector2(0.999902, 0.999902)
texture = SubResource("AtlasTexture_txjqc") texture = SubResource("AtlasTexture_txjqc")
[node name="RightUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="1"] [node name="RightUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="1"]
scale = Vector2(0.999832, 0.999832) scale = Vector2(0.99983, 0.99983)
[node name="Right_Upper_Leg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg" index="0"] [node name="Right_Upper_Leg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg" index="0"]
texture = SubResource("AtlasTexture_b583s") texture = SubResource("AtlasTexture_b583s")
[node name="RightLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg" index="1"] [node name="RightLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg" index="1"]
scale = Vector2(0.999831, 0.999831) scale = Vector2(0.999829, 0.999829)
[node name="RightFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg/RightLowerLeg" index="0"] [node name="RightFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg/RightLowerLeg" index="0"]
scale = Vector2(0.999826, 0.999826) scale = Vector2(0.999827, 0.999827)
[node name="Right_Foot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg/RightLowerLeg/RightFoot" index="0"] [node name="Right_Foot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/RightUpperLeg/RightLowerLeg/RightFoot" index="0"]
texture = SubResource("AtlasTexture_uoit3") texture = SubResource("AtlasTexture_uoit3")
@ -779,34 +787,34 @@ texture = SubResource("AtlasTexture_uoit3")
texture = SubResource("AtlasTexture_vn3j1") texture = SubResource("AtlasTexture_vn3j1")
[node name="LeftUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="2"] [node name="LeftUpperLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="2"]
scale = Vector2(0.999826, 0.999826) scale = Vector2(0.999827, 0.999827)
[node name="Left_Upper_Leg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg" index="0"] [node name="Left_Upper_Leg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg" index="0"]
texture = SubResource("AtlasTexture_yb81c") texture = SubResource("AtlasTexture_yb81c")
[node name="LeftLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg" index="1"] [node name="LeftLowerLeg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg" index="1"]
scale = Vector2(0.999827, 0.999827) scale = Vector2(0.999831, 0.999831)
[node name="Left_Lower_Leg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg" index="0"] [node name="Left_Lower_Leg" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg" index="0"]
texture = SubResource("AtlasTexture_nlwsb") texture = SubResource("AtlasTexture_nlwsb")
[node name="LeftFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg" index="1"] [node name="LeftFoot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg" index="1"]
scale = Vector2(0.999816, 0.999816) scale = Vector2(0.999817, 0.999817)
[node name="Left_Foot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg/LeftFoot" index="0"] [node name="Left_Foot" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/LeftUpperLeg/LeftLowerLeg/LeftFoot" index="0"]
texture = SubResource("AtlasTexture_8y6c0") texture = SubResource("AtlasTexture_8y6c0")
[node name="Body" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="3"] [node name="Body" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt" index="3"]
scale = Vector2(0.999832, 0.999832) scale = Vector2(0.999826, 0.999826)
[node name="RightUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="0"] [node name="RightUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="0"]
scale = Vector2(0.99982, 0.99982) scale = Vector2(0.999828, 0.999828)
[node name="Right_Upper_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm" index="0"] [node name="Right_Upper_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm" index="0"]
texture = SubResource("AtlasTexture_nc6p3") texture = SubResource("AtlasTexture_nc6p3")
[node name="RightLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm" index="1"] [node name="RightLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm" index="1"]
scale = Vector2(0.999819, 0.999819) scale = Vector2(0.999818, 0.999818)
[node name="RightHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm/RightLowerArm" index="0"] [node name="RightHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/RightUpperArm/RightLowerArm" index="0"]
scale = Vector2(0.999828, 0.999828) scale = Vector2(0.999828, 0.999828)
@ -821,7 +829,7 @@ texture = SubResource("AtlasTexture_op0h6")
texture = SubResource("AtlasTexture_0s5wm") texture = SubResource("AtlasTexture_0s5wm")
[node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="2"] [node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="2"]
rotation = 0.0101791 rotation = 0.00923548
scale = Vector2(1e-05, 1e-05) scale = Vector2(1e-05, 1e-05)
[node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Tie" index="0"] [node name="Tie" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Tie" index="0"]
@ -863,15 +871,17 @@ scale = Vector2(0.999827, 0.999827)
texture = SubResource("AtlasTexture_pjhfy") texture = SubResource("AtlasTexture_pjhfy")
[node name="Right_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="0"] [node name="Right_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="0"]
position = Vector2(-16, -7.99999) position = Vector2(-16, -8)
scale = Vector2(1, 1)
[node name="Left_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="1"] [node name="Left_Eye" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="1"]
position = Vector2(-4, -9) position = Vector2(-4, -9)
scale = Vector2(1, 1)
[node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="2"] [node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head/HeadParticle/Head" index="2"]
position = Vector2(-3, 3) position = Vector2(-3, 3)
rotation = -0.0165557 rotation = -0.0150209
scale = Vector2(0.999831, 0.999831) scale = Vector2(0.999828, 0.999828)
texture = SubResource("AtlasTexture_7cvmi") texture = SubResource("AtlasTexture_7cvmi")
offset = Vector2(-14, -2) offset = Vector2(-14, -2)
@ -902,7 +912,7 @@ _threshold = 0.333
_observedArmor = NodePath("../../../../../../../../../../CanArmor") _observedArmor = NodePath("../../../../../../../../../../CanArmor")
[node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head" index="1"] [node name="Jaw" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head" index="1"]
scale = Vector2(0.999831, 0.999831) scale = Vector2(0.999828, 0.999828)
[node name="TrashcanLid" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head" index="4"] [node name="TrashcanLid" type="Bone2D" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/Head" index="4"]
position = Vector2(-0.0022974, -17.0131) position = Vector2(-0.0022974, -17.0131)
@ -917,24 +927,24 @@ editor_settings/show_bone_gizmo = false
remote_path = NodePath("../../HeadParticle/Head/TrashcanLid/Trashcan_lid") remote_path = NodePath("../../HeadParticle/Head/TrashcanLid/Trashcan_lid")
[node name="LeftUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="5"] [node name="LeftUpperArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body" index="5"]
scale = Vector2(0.999821, 0.999821) scale = Vector2(0.999826, 0.999826)
[node name="Left_Upper_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm" index="0"] [node name="Left_Upper_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm" index="0"]
texture = SubResource("AtlasTexture_tebih") texture = SubResource("AtlasTexture_tebih")
[node name="Left_Lower_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile" index="0"] [node name="Left_Lower_Arm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile" index="0"]
rotation = 0.00918239 rotation = 0.00833116
scale = Vector2(0.999996, 0.999996) scale = Vector2(0.999997, 0.999997)
texture = SubResource("AtlasTexture_auxav") texture = SubResource("AtlasTexture_auxav")
[node name="Left_Hand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/HandProjectile/Left_Lower_Arm" index="0"] [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) position = Vector2(-0.99983, 12.9978)
rotation = 0.0 rotation = -9.31647e-10
scale = Vector2(0.999652, 0.999652) scale = Vector2(0.999652, 0.999652)
texture = SubResource("AtlasTexture_dntsa") texture = SubResource("AtlasTexture_dntsa")
[node name="LeftLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm" index="2"] [node name="LeftLowerArm" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm" index="2"]
scale = Vector2(0.999826, 0.999826) scale = Vector2(0.999827, 0.999827)
[node name="LeftHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/LeftLowerArm" index="0"] [node name="LeftHand" parent="CanvasGroup/basic_zombie_walk/Zombie/Butt/Body/LeftUpperArm/LeftLowerArm" index="0"]
scale = Vector2(0.999822, 0.999822) scale = Vector2(0.999822, 0.999822)
@ -946,6 +956,9 @@ libraries = {
&"hobo": ExtResource("8_yb81c") &"hobo": ExtResource("8_yb81c")
} }
[node name="Eatbox" parent="." index="2"]
_damage = SubResource("Resource_n380g")
[node name="AnimationTree" parent="." index="3"] [node name="AnimationTree" parent="." index="3"]
tree_root = SubResource("AnimationNodeBlendTree_txjqc") tree_root = SubResource("AnimationNodeBlendTree_txjqc")
advance_expression_base_node = NodePath("../Behaviour") advance_expression_base_node = NodePath("../Behaviour")

View file

@ -0,0 +1,171 @@
[gd_scene load_steps=23 format=3 uid="uid://cjoyh54cpjla7"]
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_65f4u"]
[ext_resource type="Texture2D" uid="uid://bt76iudw2qgnv" path="res://assets/sprites/atlases/plants/cumbucer.png" id="2_ig0op"]
[ext_resource type="Script" uid="uid://dn53jvpjyg63l" path="res://scripts/plants/Eyesight.cs" id="3_d45iq"]
[ext_resource type="Script" uid="uid://ceprqkraw3v6m" path="res://scripts/plants/Shooter.cs" id="4_sckvu"]
[ext_resource type="PackedScene" uid="uid://c1ig40gtdcb60" path="res://scenes/projectiles/cucumber_projectile.tscn" id="5_sckvu"]
[ext_resource type="Script" uid="uid://c4jy0cnbnx33h" path="res://scripts/TimeScalableTimer.cs" id="6_xwpd6"]
[ext_resource type="Script" uid="uid://bdk5iqtw4xbkl" path="res://scripts/plants/behaviours/PeashooterBehaviour.cs" id="7_q31qc"]
[sub_resource type="Animation" id="Animation_n1xkd"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [10]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_gogcg"]
_data = {
&"RESET": SubResource("Animation_n1xkd")
}
[sub_resource type="Animation" id="Animation_ig0op"]
length = 0.666675
loop_mode = 2
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [10, 11, 12, 13, 14]
}
[sub_resource type="Animation" id="Animation_d45iq"]
length = 0.833342
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666667, 0.75),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Shooter")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.5),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"Shoot"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n1xkd"]
_data = {
&"attack": SubResource("Animation_d45iq"),
&"idle": SubResource("Animation_ig0op")
}
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_ig0op"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d45iq"]
animation = &"cucumber/attack"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_n1xkd"]
animation = &"cucumber/idle"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gogcg"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ie74j"]
advance_mode = 2
advance_condition = &"ready"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_sckvu"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_jbggv"]
states/cucumber_attack/node = SubResource("AnimationNodeAnimation_d45iq")
states/cucumber_attack/position = Vector2(628, 100)
states/cucumber_idle/node = SubResource("AnimationNodeAnimation_n1xkd")
states/cucumber_idle/position = Vector2(374, 100)
transitions = ["Start", "cucumber_idle", SubResource("AnimationNodeStateMachineTransition_gogcg"), "cucumber_idle", "cucumber_attack", SubResource("AnimationNodeStateMachineTransition_ie74j"), "cucumber_attack", "cucumber_idle", SubResource("AnimationNodeStateMachineTransition_sckvu")]
graph_offset = Vector2(137, -3)
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_xwpd6"]
graph_offset = Vector2(-370, 72)
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_ig0op")
nodes/TimeScale/position = Vector2(60, 140)
nodes/Tree/node = SubResource("AnimationNodeStateMachine_jbggv")
nodes/Tree/position = Vector2(-260, 140)
node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ig0op"]
radius = 13.0
height = 48.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_n1xkd"]
size = Vector2(26, 600)
[node name="Cucumber" instance=ExtResource("1_65f4u")]
MaxHP = 30.0
[node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_ig0op")
hframes = 10
vframes = 2
frame = 10
[node name="AnimationPlayer" parent="." index="1"]
libraries = {
&"": SubResource("AnimationLibrary_gogcg"),
&"cucumber": SubResource("AnimationLibrary_n1xkd")
}
[node name="AnimationTree" parent="." index="2"]
tree_root = SubResource("AnimationNodeBlendTree_xwpd6")
parameters/TimeScale/scale = 1.0
parameters/Tree/conditions/ready = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" index="0"]
shape = SubResource("CapsuleShape2D_ig0op")
[node name="Eysight" type="Area2D" parent="." index="4"]
collision_layer = 4
collision_mask = 8
script = ExtResource("3_d45iq")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Eysight" index="0"]
shape = SubResource("RectangleShape2D_n1xkd")
[node name="Shooter" type="Marker2D" parent="." index="5" node_paths=PackedStringArray("_timer")]
script = ExtResource("4_sckvu")
_projectile = ExtResource("5_sckvu")
_timer = NodePath("Timer")
[node name="Timer" type="Timer" parent="Shooter" index="0" node_paths=PackedStringArray("entity")]
wait_time = 5.0
one_shot = true
script = ExtResource("6_xwpd6")
entity = NodePath("../..")
[node name="Behaviour" type="Node" parent="." index="6" node_paths=PackedStringArray("_shootTimer", "_sight")]
script = ExtResource("7_q31qc")
_shootTimer = NodePath("../Shooter/Timer")
_sight = NodePath("../Eysight")

View file

@ -0,0 +1,171 @@
[gd_scene load_steps=23 format=3 uid="uid://cjoyh54cpjla7"]
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_65f4u"]
[ext_resource type="Texture2D" uid="uid://bt76iudw2qgnv" path="res://assets/sprites/atlases/plants/cumbucer.png" id="2_ig0op"]
[ext_resource type="Script" uid="uid://dn53jvpjyg63l" path="res://scripts/plants/Eyesight.cs" id="3_d45iq"]
[ext_resource type="Script" uid="uid://ceprqkraw3v6m" path="res://scripts/plants/Shooter.cs" id="4_sckvu"]
[ext_resource type="PackedScene" uid="uid://c1ig40gtdcb60" path="res://scenes/projectiles/cucumber_projectile.tscn" id="5_sckvu"]
[ext_resource type="Script" uid="uid://c4jy0cnbnx33h" path="res://scripts/TimeScalableTimer.cs" id="6_xwpd6"]
[ext_resource type="Script" uid="uid://bdk5iqtw4xbkl" path="res://scripts/plants/behaviours/PeashooterBehaviour.cs" id="7_q31qc"]
[sub_resource type="Animation" id="Animation_n1xkd"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [10]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_gogcg"]
_data = {
&"RESET": SubResource("Animation_n1xkd")
}
[sub_resource type="Animation" id="Animation_ig0op"]
length = 0.666675
loop_mode = 2
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [10, 11, 12, 13, 14]
}
[sub_resource type="Animation" id="Animation_d45iq"]
length = 0.833342
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666667, 0.75),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Shooter")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.5),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"Shoot"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n1xkd"]
_data = {
&"attack": SubResource("Animation_d45iq"),
&"idle": SubResource("Animation_ig0op")
}
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_ig0op"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d45iq"]
animation = &"cucumber/attack"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_n1xkd"]
animation = &"cucumber/idle"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gogcg"]
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ie74j"]
advance_mode = 2
advance_condition = &"ready"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_sckvu"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_jbggv"]
states/cucumber_attack/node = SubResource("AnimationNodeAnimation_d45iq")
states/cucumber_attack/position = Vector2(628, 100)
states/cucumber_idle/node = SubResource("AnimationNodeAnimation_n1xkd")
states/cucumber_idle/position = Vector2(374, 100)
transitions = ["Start", "cucumber_idle", SubResource("AnimationNodeStateMachineTransition_gogcg"), "cucumber_idle", "cucumber_attack", SubResource("AnimationNodeStateMachineTransition_ie74j"), "cucumber_attack", "cucumber_idle", SubResource("AnimationNodeStateMachineTransition_sckvu")]
graph_offset = Vector2(137, -3)
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_xwpd6"]
graph_offset = Vector2(-370, 72)
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_ig0op")
nodes/TimeScale/position = Vector2(60, 140)
nodes/Tree/node = SubResource("AnimationNodeStateMachine_jbggv")
nodes/Tree/position = Vector2(-260, 140)
node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ig0op"]
radius = 13.0
height = 48.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_n1xkd"]
size = Vector2(26, 600)
[node name="Cucumber" instance=ExtResource("1_65f4u")]
MaxHP = 30.0
[node name="Sprite2D" parent="." index="0"]
texture = ExtResource("2_ig0op")
hframes = 10
vframes = 2
frame = 10
[node name="AnimationPlayer" parent="." index="1"]
libraries = {
&"": SubResource("AnimationLibrary_gogcg"),
&"cucumber": SubResource("AnimationLibrary_n1xkd")
}
[node name="AnimationTree" parent="." index="2"]
tree_root = SubResource("AnimationNodeBlendTree_xwpd6")
parameters/TimeScale/scale = 1.0
parameters/Tree/conditions/ready = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" index="0"]
shape = SubResource("CapsuleShape2D_ig0op")
[node name="Eysight" type="Area2D" parent="." index="4"]
collision_layer = 4
collision_mask = 8
script = ExtResource("3_d45iq")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Eysight" index="0"]
shape = SubResource("RectangleShape2D_n1xkd")
[node name="Shooter" type="Marker2D" parent="." index="5" node_paths=PackedStringArray("_timer")]
script = ExtResource("4_sckvu")
_projectile = ExtResource("5_sckvu")
_timer = NodePath("Timer")
[node name="Timer" type="Timer" parent="Shooter" index="0" node_paths=PackedStringArray("entity")]
wait_time = 1.5
one_shot = true
script = ExtResource("6_xwpd6")
entity = NodePath("../..")
[node name="Behaviour" type="Node" parent="." index="6" node_paths=PackedStringArray("_shootTimer", "_sight")]
script = ExtResource("7_q31qc")
_shootTimer = NodePath("../Shooter/Timer")
_sight = NodePath("../Eysight")

View file

@ -196,6 +196,7 @@ blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeAnimation_v7ffp") blend_point_2/node = SubResource("AnimationNodeAnimation_v7ffp")
blend_point_2/pos = 0.0 blend_point_2/pos = 0.0
min_space = 0.0 min_space = 0.0
blend_mode = 1
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ga4vy"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ga4vy"]
animation = &"nerdus/idle_full" animation = &"nerdus/idle_full"
@ -248,7 +249,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
radius = 24.0 radius = 24.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ga4vy"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ga4vy"]
size = Vector2(80, 48) size = Vector2(73, 48)
[node name="Nerdus" instance=ExtResource("1_8ui1h")] [node name="Nerdus" instance=ExtResource("1_8ui1h")]
MaxHP = 200.0 MaxHP = 200.0
@ -283,7 +284,7 @@ returnEffect = ExtResource("4_ga4vy")
bitesToPeas = 1.6 bitesToPeas = 1.6
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" index="0"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2(7, 3) position = Vector2(3.5, 3)
shape = SubResource("RectangleShape2D_ga4vy") shape = SubResource("RectangleShape2D_ga4vy")
[node name="Behaviour" type="Node" parent="." index="5"] [node name="Behaviour" type="Node" parent="." index="5"]
@ -291,3 +292,4 @@ script = ExtResource("5_o1ggp")
parameters = Array[String](["parameters/Tree/Attack/blend_position", "parameters/Tree/Idle/blend_position"]) parameters = Array[String](["parameters/Tree/Attack/blend_position", "parameters/Tree/Idle/blend_position"])
[connection signal="OnHPChanged" from="." to="Hurtbox" method="OnHPChanged"] [connection signal="OnHPChanged" from="." to="Hurtbox" method="OnHPChanged"]
[connection signal="OnHPChanged" from="." to="Behaviour" method="OnHPChanged"]

View file

@ -27,7 +27,7 @@ script/source = "extends Node
@export var where_to_map : Node @export var where_to_map : Node
func _ready() -> void: func _ready() -> void:
while get_tree().paused: while get_tree() != null and get_tree().paused:
await get_tree().process_frame await get_tree().process_frame
for i in range(where_to_map.get_child_count()): for i in range(where_to_map.get_child_count()):
var key = InputEventKey.new() var key = InputEventKey.new()

View file

@ -0,0 +1,24 @@
[gd_scene load_steps=3 format=3 uid="uid://c1ig40gtdcb60"]
[ext_resource type="PackedScene" uid="uid://pf8sq0bk3epn" path="res://scenes/projectiles/cucumber_projectile_part.tscn" id="1_3auks"]
[sub_resource type="GDScript" id="GDScript_3auks"]
resource_name = "cucumber"
script/source = "extends Node2D
func _ready() -> void:
await get_tree().process_frame
get_child(0).reparent(get_parent())
get_child(0).reparent(get_parent())
queue_free()
"
[node name="CucumberProjectileScene" type="Node2D"]
script = SubResource("GDScript_3auks")
[node name="CucumberProjectile" parent="." instance=ExtResource("1_3auks")]
rotation = 1.5708
[node name="CucumberProjectile2" parent="." instance=ExtResource("1_3auks")]
rotation = 4.71239

View file

@ -0,0 +1,24 @@
[gd_scene load_steps=3 format=3 uid="uid://c1ig40gtdcb60"]
[ext_resource type="PackedScene" uid="uid://pf8sq0bk3epn" path="res://scenes/projectiles/cucumber_projectile_part.tscn" id="1_3auks"]
[sub_resource type="GDScript" id="GDScript_3auks"]
resource_name = "cucumber"
script/source = "extends Node2D
func _ready() -> void:
pass
#get_child(0).reparent(get_parent())
#get_child(0).reparent(get_parent())
#queue_free()
"
[node name="CucumberProjectileScene" type="Node2D"]
script = SubResource("GDScript_3auks")
[node name="CucumberProjectile" parent="." instance=ExtResource("1_3auks")]
rotation = 1.5708
[node name="CucumberProjectile2" parent="." instance=ExtResource("1_3auks")]
rotation = 4.71239

View file

@ -0,0 +1,22 @@
[gd_scene load_steps=5 format=3 uid="uid://pf8sq0bk3epn"]
[ext_resource type="PackedScene" uid="uid://b2hrv0aqbui7u" path="res://scenes/projectiles/pea.tscn" id="1_iyfw1"]
[ext_resource type="Texture2D" uid="uid://c68mrfs4wb81x" path="res://assets/sprites/atlases/atlas2.png" id="2_12o6v"]
[sub_resource type="AtlasTexture" id="AtlasTexture_h74iy"]
atlas = ExtResource("2_12o6v")
region = Rect2(24, 88, 7, 13)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_iyfw1"]
radius = 6.0
height = 24.0
[node name="CucumberProjectile" instance=ExtResource("1_iyfw1")]
_damage = 40
[node name="Sprite" parent="." index="0"]
rotation = -1.5708
texture = SubResource("AtlasTexture_h74iy")
[node name="CollisionShape2D" parent="." index="1"]
shape = SubResource("CapsuleShape2D_iyfw1")

View file

@ -25,7 +25,7 @@ public partial class LinearProjectile : Area2D, IProjectile
public override void _PhysicsProcess(double delta) public override void _PhysicsProcess(double delta)
{ {
Translate(Vector2.Right * _speed * (float)delta * Utility.TileWidth); Translate(Transform.X * _speed * (float)delta * Utility.TileWidth);
} }
public void OnAreaEntered(Area2D area) public void OnAreaEntered(Area2D area)
@ -39,7 +39,7 @@ public partial class LinearProjectile : Area2D, IProjectile
if (_impactEffect != null) if (_impactEffect != null)
entity.GiveEffect(_impactEffect); entity.GiveEffect(_impactEffect);
PoolContainer.Instance.SpawnParticles(particles, GlobalPosition); PoolContainer.Instance.SpawnParticles(particles, GlobalTransform);
QueueFree(); QueueFree();
} }

View file

@ -63,4 +63,10 @@ public partial class PoolContainer : Node2D
Instance.Particles.AddChild(emitter); Instance.Particles.AddChild(emitter);
emitter.GlobalPosition = position; emitter.GlobalPosition = position;
} }
public void SpawnParticles(PackedScene particles, Transform2D transform)
{
var emitter = particles.Instantiate<StandardParticles>();
Instance.Particles.AddChild(emitter);
emitter.GlobalTransform = transform;
}
} }

View file

@ -14,9 +14,9 @@ public partial class HpBasedBehaviour : BaseBehaviour
_data = GetParent<RuntimePlantData>(); _data = GetParent<RuntimePlantData>();
} }
public void OnHPChanged(int amount, Node origin) public void OnHPChanged(float amount, Node origin)
{ {
var calc = (float)_data.HP / _data.MaxHP; var calc = _data.HP / _data.MaxHP;
foreach (var par in parameters) foreach (var par in parameters)
{ {
_tree.Set(par, calc); _tree.Set(par, calc);