Peashooters
This commit is contained in:
parent
161f87da75
commit
68cfe89f1d
47 changed files with 1571 additions and 279 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://bf7vjtufjc8kt"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d4btl7vqi4v0q" path="res://assets/sprites/plants/aloe.tres" id="1_t4137"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_vw2kg"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bw1w8jp0yeypy" path="res://scenes/entities/plants/aloe.tscn" id="2_6a4ia"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_vw2kg")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "aloe"
|
|
||||||
DescriptionKey = "aloe_desc"
|
|
||||||
Cost = 75.0
|
|
||||||
Scene = ExtResource("2_6a4ia")
|
|
||||||
ReloadTime = 15.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_t4137")
|
|
||||||
Order = 6
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://ciewunnfalrbb"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/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")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "cucumber"
|
|
||||||
DescriptionKey = "cucumber_desc"
|
|
||||||
Cost = 75.0
|
|
||||||
Scene = ExtResource("2_0mr6r")
|
|
||||||
ReloadTime = 5.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = SubResource("AtlasTexture_3gogt")
|
|
||||||
Order = 8
|
|
||||||
metadata/_custom_type_script = "uid://cyenlko1knygw"
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://btkkaow4tyw55"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://m8e84blnx7yu" path="res://assets/sprites/plants/garlic.tres" id="1_datic"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_e15gf"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://qq0cw8xtcoj3" path="res://scenes/entities/plants/garlic.tscn" id="2_81n0p"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_e15gf")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "garlic"
|
|
||||||
DescriptionKey = "garlic_desc"
|
|
||||||
Cost = 50.0
|
|
||||||
Scene = ExtResource("2_81n0p")
|
|
||||||
ReloadTime = 7.5
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_datic")
|
|
||||||
Order = 7
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://8edvnmwu4tyn"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b06e8xhdy77d1" path="res://assets/sprites/atlases/plants/nerdus.png" id="1_of51r"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://k5aj2slxar7w" path="res://scenes/entities/plants/nerdus.tscn" id="2_0i6qf"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="3_30qd0"]
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ivp5w"]
|
|
||||||
atlas = ExtResource("1_of51r")
|
|
||||||
region = Rect2(477, 9, 60, 59)
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("3_30qd0")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "nerdus"
|
|
||||||
DescriptionKey = "nerdus_desc"
|
|
||||||
Cost = 125.0
|
|
||||||
Scene = ExtResource("2_0i6qf")
|
|
||||||
ReloadTime = 10.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = SubResource("AtlasTexture_ivp5w")
|
|
||||||
Order = 10
|
|
||||||
metadata/_custom_type_script = "uid://cyenlko1knygw"
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://c8rr1dc7mjr3d"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_amvh8"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ot1n4nval86w" path="res://assets/sprites/plants/peashooter.tres" id="1_rnq6r"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dy41q1kxray5t" path="res://scenes/entities/plants/peashooter.tscn" id="1_rqf2x"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_amvh8")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "peashooter"
|
|
||||||
DescriptionKey = "peashooter_desc"
|
|
||||||
Cost = 75.0
|
|
||||||
Scene = ExtResource("1_rqf2x")
|
|
||||||
ReloadTime = 5.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_rnq6r")
|
|
||||||
Order = 0
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://bu25xgjd68gv8"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_33j6b"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bhmnt3x5aj1l8" path="res://assets/sprites/plants/potatomine.tres" id="1_xk2pg"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://b5x35v3w2u8dx" path="res://scenes/entities/plants/potato_mine.tscn" id="2_ig2ti"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_33j6b")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "potatomine"
|
|
||||||
DescriptionKey = "potatomine_desc"
|
|
||||||
Cost = 25.0
|
|
||||||
Scene = ExtResource("2_ig2ti")
|
|
||||||
ReloadTime = 25.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_xk2pg")
|
|
||||||
Order = 3
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=10 format=3 uid="uid://b4r1687hg0rf5"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_6km43"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dhf2opi0brx23" path="res://assets/sprites/gui/almanach/premium_field.tres" id="1_ormja"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bb4ya5qx224ca" path="res://scenes/entities/plants/repeater.tscn" id="2_6km43"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://31jc2e7dijas" path="res://assets/sprites/gui/PremiumPlantCard.tres" id="2_8djti"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="3_e606l"]
|
|
||||||
[ext_resource type="Script" uid="uid://3m7xks3xq3hl" path="res://scripts/gui/seedpackets/CustomSeedpacketFrame.cs" id="3_qnhmj"]
|
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_2f3e1"]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_87lkl"]
|
|
||||||
script = ExtResource("3_qnhmj")
|
|
||||||
frame = ExtResource("2_8djti")
|
|
||||||
font = SubResource("LabelSettings_2f3e1")
|
|
||||||
almanachField = ExtResource("1_ormja")
|
|
||||||
metadata/_custom_type_script = "uid://3m7xks3xq3hl"
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qnsfo"]
|
|
||||||
atlas = ExtResource("1_6km43")
|
|
||||||
region = Rect2(604, 241, 45, 51)
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("3_e606l")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "repeater"
|
|
||||||
DescriptionKey = "repeater_desc"
|
|
||||||
Cost = 175.0
|
|
||||||
Scene = ExtResource("2_6km43")
|
|
||||||
ReloadTime = 5.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = SubResource("AtlasTexture_qnsfo")
|
|
||||||
CustomFrame = SubResource("Resource_87lkl")
|
|
||||||
Order = 12
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://drb8nk0i3oyyl"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_1eecn"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bmk41n57j7hgx" path="res://scenes/entities/plants/snipach.tscn" id="1_h5ln5"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_u5a4p"]
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dgfdr"]
|
|
||||||
atlas = ExtResource("1_1eecn")
|
|
||||||
region = Rect2(525, 241, 79, 72)
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_u5a4p")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "snipach"
|
|
||||||
DescriptionKey = "snipach_desc"
|
|
||||||
Cost = 400.0
|
|
||||||
Scene = ExtResource("1_h5ln5")
|
|
||||||
ReloadTime = 7.5
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = SubResource("AtlasTexture_dgfdr")
|
|
||||||
Order = 11
|
|
||||||
metadata/_custom_type_script = "uid://cyenlko1knygw"
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://duflq3eexs6m"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_0cpi0"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cu7h8bot6jlug" path="res://assets/sprites/plants/snowpea.tres" id="1_7fyy2"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://b7innrovtmf5u" path="res://scenes/entities/plants/snowpea.tscn" id="2_k47h0"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_0cpi0")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "snowpea"
|
|
||||||
DescriptionKey = "snowpea_desc"
|
|
||||||
Cost = 175.0
|
|
||||||
Scene = ExtResource("2_k47h0")
|
|
||||||
ReloadTime = 5.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_7fyy2")
|
|
||||||
Order = 5
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://cas11tg6chiu4"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_0bymo"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://baqfahxkcvfe1" path="res://assets/sprites/plants/Spikeweed.tres" id="1_2ol2i"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bdhod5c6o53ha" path="res://scenes/entities/plants/spikeweed.tscn" id="2_iv8de"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_0bymo")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "spikeweed"
|
|
||||||
DescriptionKey = "spikeweed_desc"
|
|
||||||
Cost = 100.0
|
|
||||||
Scene = ExtResource("2_iv8de")
|
|
||||||
ReloadTime = 5.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_2ol2i")
|
|
||||||
Order = 4
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://drm42f48urvc4"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://iw75j816gbc" path="res://assets/sprites/plants/sunflower.tres" id="1_8rd5i"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bg7lomiorxo2c" path="res://scenes/entities/plants/sunflower.tscn" id="2_gcyr5"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="3_vt4jc"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("3_vt4jc")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "sunflower"
|
|
||||||
DescriptionKey = "sunflower_desc"
|
|
||||||
Cost = 50.0
|
|
||||||
Scene = ExtResource("2_gcyr5")
|
|
||||||
ReloadTime = 5.0
|
|
||||||
ReloadProgress = 1.0
|
|
||||||
Preview = ExtResource("1_8rd5i")
|
|
||||||
Order = 1
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://bnhwg57euiyf5"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://8se1nscal0em" path="res://assets/sprites/plants/threepeater.tres" id="1_hinp6"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://eegv1qihfv2q" path="res://scenes/entities/plants/threepeater.tscn" id="2_uqpu0"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="3_3lugi"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("3_3lugi")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "threepeater"
|
|
||||||
DescriptionKey = "threepeater_desc"
|
|
||||||
Cost = 275.0
|
|
||||||
Scene = ExtResource("2_uqpu0")
|
|
||||||
ReloadTime = 5.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_hinp6")
|
|
||||||
Order = 9
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
[gd_resource type="Resource" script_class="PlantResource" load_steps=4 format=3 uid="uid://c2e2yj7rgoswi"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://g2oppl54efja" path="res://assets/sprites/plants/Wallnut.tres" id="1_2akap"]
|
|
||||||
[ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/entities/PlantResource.cs" id="1_27l0t"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bq7imkpr2yqyr" path="res://scenes/entities/plants/wallnut.tscn" id="2_rkn3h"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
script = ExtResource("1_27l0t")
|
|
||||||
Layer = 1
|
|
||||||
DontRegister = false
|
|
||||||
NameKey = "wallnut"
|
|
||||||
DescriptionKey = "wallnut_desc"
|
|
||||||
Cost = 50.0
|
|
||||||
Scene = ExtResource("2_rkn3h")
|
|
||||||
ReloadTime = 20.0
|
|
||||||
ReloadProgress = 0.0
|
|
||||||
Preview = ExtResource("1_2akap")
|
|
||||||
Order = 2
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://bwwbkybryi6k0"]
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://bwwbkybryi6k0"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_f3kba"]
|
[ext_resource type="Texture2D" uid="uid://c68mrfs4wb81x" path="res://assets/sprites/atlases/atlas2.png" id="1_g1iew"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
atlas = ExtResource("1_f3kba")
|
atlas = ExtResource("1_g1iew")
|
||||||
region = Rect2(129, 104, 45, 88)
|
region = Rect2(129, 104, 45, 88)
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,15 @@ cursor_right={
|
||||||
|
|
||||||
locale/translations=PackedStringArray("res://translations/plants.en.translation", "res://translations/plants.ru.translation", "res://translations/zombies.en.translation", "res://translations/zombies.ru.translation", "res://translations/gui.en.translation", "res://translations/gui.ru.translation", "res://translations/rewards.en.translation", "res://translations/rewards.ru.translation")
|
locale/translations=PackedStringArray("res://translations/plants.en.translation", "res://translations/plants.ru.translation", "res://translations/zombies.en.translation", "res://translations/zombies.ru.translation", "res://translations/gui.en.translation", "res://translations/gui.ru.translation", "res://translations/rewards.en.translation", "res://translations/rewards.ru.translation")
|
||||||
|
|
||||||
|
[layer_names]
|
||||||
|
|
||||||
|
2d_physics/layer_1="Structures"
|
||||||
|
2d_physics/layer_2="Plants"
|
||||||
|
2d_physics/layer_3="Zombies"
|
||||||
|
2d_physics/layer_4="Projectiles"
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
textures/canvas_textures/default_texture_filter=0
|
textures/canvas_textures/default_texture_filter=0
|
||||||
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
renderer/rendering_method.mobile="gl_compatibility"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_resource type="Resource" script_class="SeedpacketResource" load_steps=3 format=3 uid="uid://bf8u3nwwn5e1d"]
|
[gd_resource type="Resource" script_class="SeedpacketResource" load_steps=4 format=3 uid="uid://bf8u3nwwn5e1d"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ot1n4nval86w" path="res://assets/sprites/plants/peashooter.tres" id="1_o0b0s"]
|
[ext_resource type="Texture2D" uid="uid://ot1n4nval86w" path="res://assets/sprites/plants/peashooter.tres" id="1_o0b0s"]
|
||||||
[ext_resource type="Script" uid="uid://dtjdfji87kybn" path="res://scripts/resources/entity_resource.gd" id="2_jwk2v"]
|
[ext_resource type="Script" uid="uid://dtjdfji87kybn" path="res://scripts/resources/entity_resource.gd" id="2_jwk2v"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bxs34adppsh5e" path="res://scenes/plants/peashooter.tscn" id="2_n78qv"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("2_jwk2v")
|
script = ExtResource("2_jwk2v")
|
||||||
|
|
@ -9,5 +10,6 @@ preview = ExtResource("1_o0b0s")
|
||||||
cost = 75.0
|
cost = 75.0
|
||||||
recharge_time = 5.0
|
recharge_time = 5.0
|
||||||
initial_recharge_percent = 1.0
|
initial_recharge_percent = 1.0
|
||||||
|
scene = ExtResource("2_n78qv")
|
||||||
order = 0
|
order = 0
|
||||||
metadata/_custom_type_script = "uid://dtjdfji87kybn"
|
metadata/_custom_type_script = "uid://dtjdfji87kybn"
|
||||||
|
|
|
||||||
15
resources/zombies/basic.tres
Normal file
15
resources/zombies/basic.tres
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_resource type="Resource" script_class="SeedpacketResource" load_steps=4 format=3 uid="uid://cbooo6i1rifb7"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dunlsp8tx7a4w" path="res://assets/sprites/zombies/Зондби.png" id="1_c2mq3"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtjdfji87kybn" path="res://scripts/resources/entity_resource.gd" id="1_k277m"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dunih4xhnupy5" path="res://scenes/zombies/basic.tscn" id="2_l6de4"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_k277m")
|
||||||
|
preview = ExtResource("1_c2mq3")
|
||||||
|
cost = 1.0
|
||||||
|
recharge_time = 5.0
|
||||||
|
initial_recharge_percent = 1.0
|
||||||
|
scene = ExtResource("2_l6de4")
|
||||||
|
order = 0
|
||||||
|
metadata/_custom_type_script = "uid://dtjdfji87kybn"
|
||||||
|
|
@ -25,13 +25,16 @@ position = Vector2(305, 76)
|
||||||
script = ExtResource("1_4dbyi")
|
script = ExtResource("1_4dbyi")
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="SeedpacketPlacer" type="CanvasGroup" parent="Game" node_paths=PackedStringArray("entity_container")]
|
[node name="SeedpacketPlacer" type="Node2D" parent="Game" node_paths=PackedStringArray("entity_container")]
|
||||||
script = ExtResource("4_5r585")
|
script = ExtResource("4_5r585")
|
||||||
entity_container = NodePath("../../LayeredEntityContainer")
|
entity_container = NodePath("../../LayeredEntityContainer")
|
||||||
|
|
||||||
[node name="Plants" type="Node2D" parent="Game"]
|
[node name="Plants" type="Node2D" parent="Game"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
[node name="Projectiles" type="Node2D" parent="Game"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="Background" type="CanvasLayer" parent="Game"]
|
[node name="Background" type="CanvasLayer" parent="Game"]
|
||||||
layer = -10
|
layer = -10
|
||||||
follow_viewport_enabled = true
|
follow_viewport_enabled = true
|
||||||
|
|
|
||||||
186
scenes/plants/peashooter.tscn
Normal file
186
scenes/plants/peashooter.tscn
Normal file
|
|
@ -0,0 +1,186 @@
|
||||||
|
[gd_scene load_steps=23 format=3 uid="uid://bxs34adppsh5e"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cksryh4w5dbbx" path="res://assets/sprites/atlases/plants/peashooter.png" id="2_4l0yo"]
|
||||||
|
[ext_resource type="Script" uid="uid://bwdvaov8sse4k" path="res://scripts/entities/entity.gd" id="2_pk084"]
|
||||||
|
[ext_resource type="Script" uid="uid://be5rfbbl5xgeh" path="res://scripts/components/generic_collider.gd" id="3_2lnl7"]
|
||||||
|
[ext_resource type="Script" uid="uid://cbmavbe4xd0j2" path="res://scripts/speed_controlled/speed_controlled_animation_tree.gd" id="3_gkdjr"]
|
||||||
|
[ext_resource type="Script" uid="uid://cbudgx741oxtc" path="res://scripts/components/generic_hurtbox.gd" id="5_gkdjr"]
|
||||||
|
[ext_resource type="Script" uid="uid://cjulv0bt6deps" path="res://scripts/components/field_segment_shape.gd" id="6_tf8ra"]
|
||||||
|
[ext_resource type="Script" uid="uid://b0ka8lb5kl1fd" path="res://scripts/components/controllers/plants/peashooter_controller.gd" id="8_0ridr"]
|
||||||
|
[ext_resource type="Script" uid="uid://d17rkta3k73jx" path="res://scripts/components/plant_death_handler.gd" id="8_6jrfv"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_tf8ra"]
|
||||||
|
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": [0]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_gkdjr"]
|
||||||
|
resource_name = "idle"
|
||||||
|
length = 0.833342
|
||||||
|
loop_mode = 1
|
||||||
|
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]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_4l0yo"]
|
||||||
|
resource_name = "shoot"
|
||||||
|
length = 0.666675
|
||||||
|
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),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [10, 11, 12, 13, 14, 15, 16, 17]
|
||||||
|
}
|
||||||
|
tracks/1/type = "method"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Controller")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0.333333),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [],
|
||||||
|
"method": &"shoot"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0ridr"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_tf8ra"),
|
||||||
|
&"idle": SubResource("Animation_gkdjr"),
|
||||||
|
&"shoot": SubResource("Animation_4l0yo")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0ridr"]
|
||||||
|
animation = &"idle"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6jrfv"]
|
||||||
|
animation = &"shoot"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0l7qe"]
|
||||||
|
advance_mode = 2
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_3wvhk"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "is_shooting()"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hlvcn"]
|
||||||
|
switch_mode = 2
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "is_shooting() == false"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_1h4ri"]
|
||||||
|
states/idle/node = SubResource("AnimationNodeAnimation_0ridr")
|
||||||
|
states/idle/position = Vector2(415, 106)
|
||||||
|
states/shoot/node = SubResource("AnimationNodeAnimation_6jrfv")
|
||||||
|
states/shoot/position = Vector2(649, 107)
|
||||||
|
transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_0l7qe"), "idle", "shoot", SubResource("AnimationNodeStateMachineTransition_3wvhk"), "shoot", "idle", SubResource("AnimationNodeStateMachineTransition_hlvcn")]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_0l7qe"]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_3wvhk"]
|
||||||
|
graph_offset = Vector2(-541.787, 73.4125)
|
||||||
|
nodes/main/node = SubResource("AnimationNodeStateMachine_1h4ri")
|
||||||
|
nodes/main/position = Vector2(-140, 160)
|
||||||
|
nodes/speed/node = SubResource("AnimationNodeTimeScale_0l7qe")
|
||||||
|
nodes/speed/position = Vector2(140, 140)
|
||||||
|
node_connections = [&"output", 0, &"speed", &"speed", 0, &"main"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_6jrfv"]
|
||||||
|
size = Vector2(26, 40)
|
||||||
|
|
||||||
|
[sub_resource type="SegmentShape2D" id="SegmentShape2D_gkdjr"]
|
||||||
|
b = Vector2(0, 0)
|
||||||
|
|
||||||
|
[node name="Peashooter" type="Node2D" groups=["Plants"]]
|
||||||
|
script = ExtResource("2_pk084")
|
||||||
|
max_hp = 30.0
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_4l0yo")
|
||||||
|
hframes = 10
|
||||||
|
vframes = 2
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_0ridr")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||||
|
tree_root = SubResource("AnimationNodeBlendTree_3wvhk")
|
||||||
|
advance_expression_base_node = NodePath("../Controller")
|
||||||
|
anim_player = NodePath("../AnimationPlayer")
|
||||||
|
parameters/speed/scale = 1.0
|
||||||
|
script = ExtResource("3_gkdjr")
|
||||||
|
|
||||||
|
[node name="GenericCollider" type="Area2D" parent="."]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 0
|
||||||
|
monitoring = false
|
||||||
|
script = ExtResource("3_2lnl7")
|
||||||
|
metadata/_custom_type_script = "uid://be5rfbbl5xgeh"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="GenericCollider"]
|
||||||
|
position = Vector2(0, 6)
|
||||||
|
shape = SubResource("RectangleShape2D_6jrfv")
|
||||||
|
|
||||||
|
[node name="GenericHurtbox" type="Area2D" parent="."]
|
||||||
|
position = Vector2(17, -4)
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 4
|
||||||
|
monitorable = false
|
||||||
|
script = ExtResource("5_gkdjr")
|
||||||
|
lookup_layers = 1
|
||||||
|
metadata/_custom_type_script = "uid://cbudgx741oxtc"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="GenericHurtbox"]
|
||||||
|
shape = SubResource("SegmentShape2D_gkdjr")
|
||||||
|
script = ExtResource("6_tf8ra")
|
||||||
|
|
||||||
|
[node name="Controller" type="Node" parent="." node_paths=PackedStringArray("projectile_transform")]
|
||||||
|
script = ExtResource("8_0ridr")
|
||||||
|
projectile_transform = NodePath("../ShootMarker")
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="Controller"]
|
||||||
|
wait_time = 1.5
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="ShootMarker" type="Marker2D" parent="."]
|
||||||
|
position = Vector2(17, -4)
|
||||||
|
|
||||||
|
[node name="DeathHandler" type="Node" parent="."]
|
||||||
|
script = ExtResource("8_6jrfv")
|
||||||
|
|
||||||
|
[connection signal="killed" from="." to="DeathHandler" method="_on_killed"]
|
||||||
|
[connection signal="collision_end" from="GenericHurtbox" to="Controller" method="_on_generic_hurtbox_collision_end"]
|
||||||
|
[connection signal="collision_start" from="GenericHurtbox" to="Controller" method="_on_generic_hurtbox_collision_start"]
|
||||||
|
[connection signal="timeout" from="Controller/Timer" to="Controller" method="_on_timer_timeout"]
|
||||||
20
scenes/projectiles/pea.tscn
Normal file
20
scenes/projectiles/pea.tscn
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://ciqhjwh4sfe3u"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://fgdhvaq4dek2" path="res://scripts/projectiles/linear_projectile.gd" id="1_qt432"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dq0mul65hevtt" path="res://assets/sprites/plants/pea.tres" id="2_inkwd"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_osqrk"]
|
||||||
|
radius = 6.0
|
||||||
|
|
||||||
|
[node name="Pea" type="Area2D"]
|
||||||
|
collision_layer = 8
|
||||||
|
collision_mask = 4
|
||||||
|
script = ExtResource("1_qt432")
|
||||||
|
speed = 300.0
|
||||||
|
damage = 10.0
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("2_inkwd")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_osqrk")
|
||||||
1113
scenes/zombies/basic.tscn
Normal file
1113
scenes/zombies/basic.tscn
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,33 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
const projectile := preload("uid://ciqhjwh4sfe3u")
|
||||||
|
|
||||||
|
@export var projectile_transform : Marker2D
|
||||||
|
|
||||||
|
var detected : bool = false
|
||||||
|
var can_shoot : bool = true
|
||||||
|
|
||||||
|
@onready var timer := $Timer
|
||||||
|
@onready var entity : Entity = get_parent()
|
||||||
|
|
||||||
|
func is_shooting():
|
||||||
|
return detected and can_shoot and entity.disabled == false
|
||||||
|
|
||||||
|
func _on_generic_hurtbox_collision_start() -> void:
|
||||||
|
detected = true
|
||||||
|
|
||||||
|
func _on_generic_hurtbox_collision_end() -> void:
|
||||||
|
detected = false
|
||||||
|
|
||||||
|
func shoot():
|
||||||
|
if can_shoot == false:
|
||||||
|
return
|
||||||
|
can_shoot = false
|
||||||
|
timer.start()
|
||||||
|
var proj = projectile.instantiate()
|
||||||
|
get_tree().current_scene.get_node("%Projectiles").add_child(proj)
|
||||||
|
proj.global_transform = projectile_transform.global_transform
|
||||||
|
proj.source = entity
|
||||||
|
|
||||||
|
func _on_timer_timeout() -> void:
|
||||||
|
can_shoot = true
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b0ka8lb5kl1fd
|
||||||
29
scripts/components/controllers/zombies/basic_controller.gd
Normal file
29
scripts/components/controllers/zombies/basic_controller.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var eating:
|
||||||
|
get:
|
||||||
|
return is_eating()
|
||||||
|
var walking:
|
||||||
|
get:
|
||||||
|
return is_walking()
|
||||||
|
|
||||||
|
@export var hurtbox : GenericHurtbox
|
||||||
|
@export var damage : float
|
||||||
|
@onready var disablable := get_parent()
|
||||||
|
|
||||||
|
var killed := false
|
||||||
|
|
||||||
|
func _on_entity_killed(_context: RefCounted) -> void:
|
||||||
|
if killed: return
|
||||||
|
$"../AnimationTree"["parameters/main/playback"].travel("death")
|
||||||
|
killed = true
|
||||||
|
|
||||||
|
func is_eating() -> bool:
|
||||||
|
return hurtbox.is_colliding() and disablable.disabled == false
|
||||||
|
|
||||||
|
func is_walking() -> bool:
|
||||||
|
return disablable.disabled == false
|
||||||
|
|
||||||
|
func bite() -> void:
|
||||||
|
if hurtbox.is_colliding() == false: return
|
||||||
|
hurtbox.get_colliding_entity().deal_damage(damage,get_parent())
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bg88vb74hinkj
|
||||||
4
scripts/components/field_segment_shape.gd
Normal file
4
scripts/components/field_segment_shape.gd
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
extends CollisionShape2D
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
shape.b = Vector2(FieldParams.field_rect.end.x-global_position.x+FieldParams.TILE.x,0)
|
||||||
1
scripts/components/field_segment_shape.gd.uid
Normal file
1
scripts/components/field_segment_shape.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cjulv0bt6deps
|
||||||
15
scripts/components/generic_collider.gd
Normal file
15
scripts/components/generic_collider.gd
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
## Base class for generic colliders.
|
||||||
|
|
||||||
|
class_name GenericCollider
|
||||||
|
|
||||||
|
## Contact layer. Used to check
|
||||||
|
enum Layers
|
||||||
|
{
|
||||||
|
NORMAL = 1,
|
||||||
|
LOW = 2,
|
||||||
|
HIGH = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
@export var layer : Layers = Layers.NORMAL
|
||||||
1
scripts/components/generic_collider.gd.uid
Normal file
1
scripts/components/generic_collider.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://be5rfbbl5xgeh
|
||||||
45
scripts/components/generic_hurtbox.gd
Normal file
45
scripts/components/generic_hurtbox.gd
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
class_name GenericHurtbox
|
||||||
|
|
||||||
|
@export_flags("NORMAL:1","LOW:2","HIGH:4") var lookup_layers : int = 0
|
||||||
|
var entities : Array[Entity] = []
|
||||||
|
|
||||||
|
signal entity_added(entity : Entity)
|
||||||
|
signal entity_removed(entity : Entity)
|
||||||
|
signal collision_start
|
||||||
|
signal collision_end
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
area_entered.connect(on_area_entered)
|
||||||
|
area_exited.connect(on_area_exited)
|
||||||
|
|
||||||
|
func on_area_entered(area: Area2D):
|
||||||
|
if area is GenericCollider:
|
||||||
|
if lookup_layers & area.layer != 0:
|
||||||
|
add_entity(area.get_parent())
|
||||||
|
|
||||||
|
func on_area_exited(area: Area2D):
|
||||||
|
if area is GenericCollider:
|
||||||
|
if lookup_layers & area.layer != 0:
|
||||||
|
remove_entity(area.get_parent())
|
||||||
|
|
||||||
|
func add_entity(entity : Entity):
|
||||||
|
entities.append(entity)
|
||||||
|
entity_added.emit(entity)
|
||||||
|
if entities.size() == 1:
|
||||||
|
collision_start.emit()
|
||||||
|
|
||||||
|
func remove_entity(entity : Entity):
|
||||||
|
entities.erase(entity)
|
||||||
|
entity_removed.emit(entity)
|
||||||
|
if entities.size() == 0:
|
||||||
|
collision_end.emit()
|
||||||
|
|
||||||
|
func get_colliding_entity() -> Entity:
|
||||||
|
if entities.size() == 0:
|
||||||
|
return null
|
||||||
|
return entities[0]
|
||||||
|
|
||||||
|
func is_colliding() -> bool:
|
||||||
|
return entities.size() > 0
|
||||||
1
scripts/components/generic_hurtbox.gd.uid
Normal file
1
scripts/components/generic_hurtbox.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cbudgx741oxtc
|
||||||
10
scripts/components/mover.gd
Normal file
10
scripts/components/mover.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export_range(0,2,0.001,"or_greater","hide_slider","suffix:tiles/second") var speed : float = 0.2
|
||||||
|
# Used by animation players to control zombie's movement
|
||||||
|
@export var speed_control : float = 0.0
|
||||||
|
|
||||||
|
@onready var parent : Node2D = get_parent()
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
parent.global_position += -parent.global_transform.x * speed_control * speed * delta * FieldParams.TILE.x
|
||||||
1
scripts/components/mover.gd.uid
Normal file
1
scripts/components/mover.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bdacurei5fp02
|
||||||
5
scripts/components/plant_death_handler.gd
Normal file
5
scripts/components/plant_death_handler.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
|
func _on_killed(context: RefCounted) -> void:
|
||||||
|
get_parent().deconstruct()
|
||||||
1
scripts/components/plant_death_handler.gd.uid
Normal file
1
scripts/components/plant_death_handler.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://d17rkta3k73jx
|
||||||
5
scripts/components/zombie_death_handler.gd
Normal file
5
scripts/components/zombie_death_handler.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _on_animation_tree_animation_finished(anim_name: StringName) -> void:
|
||||||
|
if anim_name.split("/")[1] == "death":
|
||||||
|
get_parent().deconstruct()
|
||||||
1
scripts/components/zombie_death_handler.gd.uid
Normal file
1
scripts/components/zombie_death_handler.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dfnyam1pvkb73
|
||||||
|
|
@ -8,8 +8,9 @@ class_name Entity
|
||||||
## Optional spawn layer for grid interactions
|
## Optional spawn layer for grid interactions
|
||||||
@export var layer : StringName = ""
|
@export var layer : StringName = ""
|
||||||
## Current amount of health points of an entity. Cannot be below 0 or [code]max_hp[/code]
|
## Current amount of health points of an entity. Cannot be below 0 or [code]max_hp[/code]
|
||||||
var hp : float = max_hp
|
@onready var hp : float = max_hp
|
||||||
|
##
|
||||||
|
var disabled : bool = false
|
||||||
|
|
||||||
signal damaged
|
signal damaged
|
||||||
## Emitted when damage is taken
|
## Emitted when damage is taken
|
||||||
|
|
@ -20,6 +21,21 @@ signal healed(context : HealedContext)
|
||||||
signal hp_changed(context : HPChangedContext)
|
signal hp_changed(context : HPChangedContext)
|
||||||
## Emitted when kill is requested
|
## Emitted when kill is requested
|
||||||
signal killed(context : KilledContext)
|
signal killed(context : KilledContext)
|
||||||
|
##
|
||||||
|
signal toggled(disabled : bool)
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
func disable():
|
||||||
|
if disabled: return
|
||||||
|
disabled = true
|
||||||
|
toggled.emit(disabled)
|
||||||
|
|
||||||
|
##
|
||||||
|
func enable():
|
||||||
|
if disabled == false: return
|
||||||
|
disabled = false
|
||||||
|
toggled.emit(disabled)
|
||||||
|
|
||||||
## Properly deal damage to entity
|
## Properly deal damage to entity
|
||||||
func deal_damage(amount : float, source : Entity):
|
func deal_damage(amount : float, source : Entity):
|
||||||
|
|
@ -42,7 +58,6 @@ func deal_damage(amount : float, source : Entity):
|
||||||
hp = 0
|
hp = 0
|
||||||
kill(source)
|
kill(source)
|
||||||
|
|
||||||
|
|
||||||
## Properly heal entity
|
## Properly heal entity
|
||||||
func heal(amount : float, source : Entity):
|
func heal(amount : float, source : Entity):
|
||||||
var context = HealedContext.new()
|
var context = HealedContext.new()
|
||||||
|
|
@ -61,7 +76,6 @@ func heal(amount : float, source : Entity):
|
||||||
if hp > max_hp:
|
if hp > max_hp:
|
||||||
hp = max_hp
|
hp = max_hp
|
||||||
|
|
||||||
|
|
||||||
## Invoked when an entity is killed by damage.
|
## Invoked when an entity is killed by damage.
|
||||||
func kill(source : Entity):
|
func kill(source : Entity):
|
||||||
var context = KilledContext.new()
|
var context = KilledContext.new()
|
||||||
|
|
@ -72,9 +86,6 @@ func kill(source : Entity):
|
||||||
LevelEventBus.entity_killed.emit(context)
|
LevelEventBus.entity_killed.emit(context)
|
||||||
if not layer.is_empty():
|
if not layer.is_empty():
|
||||||
LevelEventBus.layer_entity_killed.emit(context)
|
LevelEventBus.layer_entity_killed.emit(context)
|
||||||
|
|
||||||
deconstruct()
|
|
||||||
|
|
||||||
|
|
||||||
## Method used to properly deconstruct entity
|
## Method used to properly deconstruct entity
|
||||||
func deconstruct():
|
func deconstruct():
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
extends CanvasGroup
|
extends Node2D
|
||||||
|
|
||||||
@export var entity_container : LayeredEntityContainer
|
@export var entity_container : LayeredEntityContainer
|
||||||
var can_plant : bool = false
|
var can_plant : bool = false
|
||||||
|
|
@ -24,13 +24,16 @@ func _input(event: InputEvent) -> void:
|
||||||
|
|
||||||
if held_packet != null and can_plant and event.is_action_pressed("primary_action"):
|
if held_packet != null and can_plant and event.is_action_pressed("primary_action"):
|
||||||
for child in get_children():
|
for child in get_children():
|
||||||
|
child.enable()
|
||||||
child.reparent(get_tree().current_scene.get_node("%Plants"))
|
child.reparent(get_tree().current_scene.get_node("%Plants"))
|
||||||
LevelEventBus.packet_placed.emit(held_packet)
|
LevelEventBus.packet_placed.emit(held_packet)
|
||||||
held_packet = null
|
held_packet = null
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
func on_seedpacket_selected(packet : SeedpacketResource) -> void:
|
func on_seedpacket_selected(packet : SeedpacketResource) -> void:
|
||||||
add_child(packet.scene.instantiate())
|
var instantiated = packet.scene.instantiate()
|
||||||
|
add_child(instantiated)
|
||||||
|
instantiated.disable()
|
||||||
held_packet = packet
|
held_packet = packet
|
||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
|
|
|
||||||
18
scripts/projectiles/linear_projectile.gd
Normal file
18
scripts/projectiles/linear_projectile.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
var source : Entity
|
||||||
|
|
||||||
|
@export var speed : float
|
||||||
|
@export var damage : float
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
area_entered.connect(on_area_entered)
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
global_position += global_transform.x * speed * delta
|
||||||
|
|
||||||
|
func on_area_entered(area : Area2D):
|
||||||
|
if area.get_parent() != null:
|
||||||
|
area.get_parent().deal_damage(damage, source)
|
||||||
|
queue_free()
|
||||||
1
scripts/projectiles/linear_projectile.gd.uid
Normal file
1
scripts/projectiles/linear_projectile.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://fgdhvaq4dek2
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
extends AnimationTree
|
||||||
|
|
||||||
|
|
||||||
|
func on_speed_changed(speed : float):
|
||||||
|
set("parameters/speed/scale",speed)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cbmavbe4xd0j2
|
||||||
16
scripts/speed_controlled/speed_controlled_timer.gd
Normal file
16
scripts/speed_controlled/speed_controlled_timer.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
extends Timer
|
||||||
|
|
||||||
|
|
||||||
|
var old_speed : float
|
||||||
|
|
||||||
|
func on_speed_changed(speed : float):
|
||||||
|
var ratio = speed / old_speed
|
||||||
|
var old_wait_time = wait_time
|
||||||
|
var old_time_left = time_left
|
||||||
|
|
||||||
|
if old_time_left > 0:
|
||||||
|
start(old_time_left * ratio)
|
||||||
|
|
||||||
|
wait_time = old_wait_time * ratio
|
||||||
|
|
||||||
|
old_speed = speed
|
||||||
1
scripts/speed_controlled/speed_controlled_timer.gd.uid
Normal file
1
scripts/speed_controlled/speed_controlled_timer.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bk1twclmpvalk
|
||||||
Loading…
Add table
Add a link
Reference in a new issue