Nerdus
This commit is contained in:
parent
f37c5fb87c
commit
2156c6a166
16 changed files with 490 additions and 5 deletions
BIN
assets/sprites/atlases/plants/nerdus.png
Normal file
BIN
assets/sprites/atlases/plants/nerdus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
34
assets/sprites/atlases/plants/nerdus.png.import
Normal file
34
assets/sprites/atlases/plants/nerdus.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b06e8xhdy77d1"
|
||||
path="res://.godot/imported/nerdus.png-ec431205ffd49ae84928c7fa5c535086.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/atlases/plants/nerdus.png"
|
||||
dest_files=["res://.godot/imported/nerdus.png-ec431205ffd49ae84928c7fa5c535086.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/sprites/atlases/plants/nerdus_attack.png
Normal file
BIN
assets/sprites/atlases/plants/nerdus_attack.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
34
assets/sprites/atlases/plants/nerdus_attack.png.import
Normal file
34
assets/sprites/atlases/plants/nerdus_attack.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://pkss10u2g0p"
|
||||
path="res://.godot/imported/nerdus_attack.png-b5525c75a5c1206ed7ff9828533d4f8d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/atlases/plants/nerdus_attack.png"
|
||||
dest_files=["res://.godot/imported/nerdus_attack.png-b5525c75a5c1206ed7ff9828533d4f8d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/sprites/atlases/plants/nerdus_idle.png
Normal file
BIN
assets/sprites/atlases/plants/nerdus_idle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
34
assets/sprites/atlases/plants/nerdus_idle.png.import
Normal file
34
assets/sprites/atlases/plants/nerdus_idle.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cx3xjcaqqawr5"
|
||||
path="res://.godot/imported/nerdus_idle.png-460516daa87af0de882346b10c06ae5d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sprites/atlases/plants/nerdus_idle.png"
|
||||
dest_files=["res://.godot/imported/nerdus_idle.png-460516daa87af0de882346b10c06ae5d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
[resource]
|
||||
script = ExtResource("1_rfumy")
|
||||
Duration = 0.25
|
||||
Duration = 1.0
|
||||
Slot = "garlic"
|
||||
|
|
|
|||
8
resources/effects/NerdusEffect.tres
Normal file
8
resources/effects/NerdusEffect.tres
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://dme4nvp28otq6"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bb6lv1djnqjaw" path="res://scripts/systems/effects/GarlicEffect.cs" id="1_bd12u"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_bd12u")
|
||||
Duration = 0.25
|
||||
Slot = "garlic"
|
||||
21
resources/plants/Nerdus.tres
Normal file
21
resources/plants/Nerdus.tres
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://do7m0lfki5ere"]
|
||||
|
||||
[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/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")
|
||||
name_key = "nerdus"
|
||||
description_key = "nerdus_desc"
|
||||
Cost = 100.0
|
||||
Scene = ExtResource("2_0i6qf")
|
||||
ReloadTime = 10.0
|
||||
ReloadProgress = 0.0
|
||||
Preview = SubResource("AtlasTexture_ivp5w")
|
||||
Layer = 1
|
||||
metadata/_custom_type_script = "uid://cyenlko1knygw"
|
||||
|
|
@ -84,6 +84,7 @@ shape = SubResource("RectangleShape2D_thlvs")
|
|||
|
||||
[node name="Behaviour" type="Node" parent="." index="4"]
|
||||
script = ExtResource("4_bv44h")
|
||||
parameters = Array[String](["parameters/Tree/blend_position"])
|
||||
|
||||
[node name="ReturnEffect" type="Node" parent="." index="5"]
|
||||
script = ExtResource("5_oob20")
|
||||
|
|
|
|||
293
scenes/entities/plants/nerdus.tscn
Normal file
293
scenes/entities/plants/nerdus.tscn
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
[gd_scene load_steps=31 format=3 uid="uid://k5aj2slxar7w"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_8ui1h"]
|
||||
[ext_resource type="Texture2D" uid="uid://b06e8xhdy77d1" path="res://assets/sprites/atlases/plants/nerdus.png" id="2_614v4"]
|
||||
[ext_resource type="Script" uid="uid://dcokqes5wwo3k" path="res://scripts/plants/NerdusReturnAttack.cs" id="3_614v4"]
|
||||
[ext_resource type="Resource" uid="uid://dme4nvp28otq6" path="res://resources/effects/NerdusEffect.tres" id="4_ga4vy"]
|
||||
[ext_resource type="Script" uid="uid://btkmd86pn828y" path="res://scripts/plants/behaviours/HpBasedBehaviour.cs" id="5_o1ggp"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ga4vy"]
|
||||
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="AnimationLibrary" id="AnimationLibrary_o1ggp"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_ga4vy")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_yxvnw"]
|
||||
length = 1.16668
|
||||
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, 0.833333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [0, 1, 2, 3, 4, 5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_o12iv"]
|
||||
length = 1.16668
|
||||
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, 0.833333, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [7, 8, 9, 10, 11, 12, 13]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6e60l"]
|
||||
length = 1.16668
|
||||
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, 0.833333, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [14, 15, 16, 17, 18, 19, 20]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_v7ffp"]
|
||||
length = 0.500008
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [21, 22, 23, 24, 25, 26]
|
||||
}
|
||||
tracks/1/type = "method"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Hurtbox")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.416667),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"ReturnAllDamage"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_rb7ob"]
|
||||
length = 0.500008
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [28, 29, 30, 31, 32, 33]
|
||||
}
|
||||
tracks/1/type = "method"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Hurtbox")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.416667),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"ReturnAllDamage"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6a4q1"]
|
||||
length = 0.500008
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [35, 36, 37, 38, 39, 40]
|
||||
}
|
||||
tracks/1/type = "method"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Hurtbox")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.416667),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"ReturnAllDamage"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pddnl"]
|
||||
_data = {
|
||||
&"attack_full": SubResource("Animation_v7ffp"),
|
||||
&"attack_hdamage": SubResource("Animation_6a4q1"),
|
||||
&"attack_ldamage": SubResource("Animation_rb7ob"),
|
||||
&"idle_full": SubResource("Animation_yxvnw"),
|
||||
&"idle_hdamage": SubResource("Animation_6e60l"),
|
||||
&"idle_ldamage": SubResource("Animation_o12iv")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeTimeScale" id="AnimationNodeTimeScale_8ui1h"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_o12iv"]
|
||||
animation = &"nerdus/attack_full"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6e60l"]
|
||||
animation = &"nerdus/attack_ldamage"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_v7ffp"]
|
||||
animation = &"nerdus/attack_hdamage"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_614v4"]
|
||||
blend_point_0/node = SubResource("AnimationNodeAnimation_o12iv")
|
||||
blend_point_0/pos = 1.0
|
||||
blend_point_1/node = SubResource("AnimationNodeAnimation_6e60l")
|
||||
blend_point_1/pos = 0.5
|
||||
blend_point_2/node = SubResource("AnimationNodeAnimation_v7ffp")
|
||||
blend_point_2/pos = 0.0
|
||||
min_space = 0.0
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ga4vy"]
|
||||
animation = &"nerdus/idle_full"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_o1ggp"]
|
||||
animation = &"nerdus/idle_hdamage"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_yxvnw"]
|
||||
animation = &"nerdus/idle_ldamage"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_o12iv"]
|
||||
blend_point_0/node = SubResource("AnimationNodeAnimation_ga4vy")
|
||||
blend_point_0/pos = 1.0
|
||||
blend_point_1/node = SubResource("AnimationNodeAnimation_o1ggp")
|
||||
blend_point_1/pos = 0.0
|
||||
blend_point_2/node = SubResource("AnimationNodeAnimation_yxvnw")
|
||||
blend_point_2/pos = 0.5
|
||||
min_space = 0.0
|
||||
blend_mode = 1
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_6e60l"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_v7ffp"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rb7ob"]
|
||||
advance_mode = 2
|
||||
advance_expression = "get(\"triggered\")
|
||||
"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_rb7ob"]
|
||||
states/Attack/node = SubResource("AnimationNodeBlendSpace1D_614v4")
|
||||
states/Attack/position = Vector2(558, 100)
|
||||
states/Idle/node = SubResource("AnimationNodeBlendSpace1D_o12iv")
|
||||
states/Idle/position = Vector2(337, 100)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_6e60l"), "Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_v7ffp"), "Idle", "Attack", SubResource("AnimationNodeStateMachineTransition_rb7ob")]
|
||||
graph_offset = Vector2(98, -52)
|
||||
|
||||
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_6a4q1"]
|
||||
graph_offset = Vector2(-406, 116)
|
||||
nodes/TimeScale/node = SubResource("AnimationNodeTimeScale_8ui1h")
|
||||
nodes/TimeScale/position = Vector2(100, 140)
|
||||
nodes/Tree/node = SubResource("AnimationNodeStateMachine_rb7ob")
|
||||
nodes/Tree/position = Vector2(-220, 160)
|
||||
node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8ui1h"]
|
||||
radius = 24.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ga4vy"]
|
||||
size = Vector2(80, 48)
|
||||
|
||||
[node name="Nerdus" instance=ExtResource("1_8ui1h")]
|
||||
MaxHP = 200.0
|
||||
|
||||
[node name="Sprite2D" parent="." index="0"]
|
||||
texture = ExtResource("2_614v4")
|
||||
hframes = 7
|
||||
vframes = 6
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="1"]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_o1ggp"),
|
||||
&"nerdus": SubResource("AnimationLibrary_pddnl")
|
||||
}
|
||||
|
||||
[node name="AnimationTree" parent="." index="2"]
|
||||
tree_root = SubResource("AnimationNodeBlendTree_6a4q1")
|
||||
advance_expression_base_node = NodePath("../Hurtbox")
|
||||
parameters/TimeScale/scale = 1.0
|
||||
parameters/Tree/Attack/blend_position = 1.0
|
||||
parameters/Tree/Idle/blend_position = 1.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" index="0"]
|
||||
position = Vector2(0, 3)
|
||||
shape = SubResource("CircleShape2D_8ui1h")
|
||||
|
||||
[node name="Hurtbox" type="Area2D" parent="." index="4"]
|
||||
collision_layer = 0
|
||||
collision_mask = 8
|
||||
script = ExtResource("3_614v4")
|
||||
returnEffect = ExtResource("4_ga4vy")
|
||||
bitesToPeas = 1.6
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" index="0"]
|
||||
position = Vector2(7, 3)
|
||||
shape = SubResource("RectangleShape2D_ga4vy")
|
||||
|
||||
[node name="Behaviour" type="Node" parent="." index="5"]
|
||||
script = ExtResource("5_o1ggp")
|
||||
parameters = Array[String](["parameters/Tree/Attack/blend_position", "parameters/Tree/Idle/blend_position"])
|
||||
|
||||
[connection signal="OnHPChanged" from="." to="Hurtbox" method="OnHPChanged"]
|
||||
|
|
@ -44,6 +44,7 @@ MaxHP = 600.0
|
|||
texture = ExtResource("2_o5tda")
|
||||
hframes = 12
|
||||
vframes = 3
|
||||
frame = 4
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="1"]
|
||||
libraries = {
|
||||
|
|
@ -61,5 +62,6 @@ shape = SubResource("RectangleShape2D_khltr")
|
|||
|
||||
[node name="Behaviour" type="Node" parent="." index="4"]
|
||||
script = ExtResource("4_cjtyy")
|
||||
parameters = Array[String](["parameters/Tree/blend_position"])
|
||||
|
||||
[connection signal="OnHPChanged" from="." to="Behaviour" method="OnHPChanged"]
|
||||
|
|
|
|||
48
scripts/plants/NerdusReturnAttack.cs
Normal file
48
scripts/plants/NerdusReturnAttack.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using Godot;
|
||||
using Newlon.Systems.Effects;
|
||||
using System.Collections.Generic;
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class NerdusReturnAttack : Area2D
|
||||
{
|
||||
private float returnAmount;
|
||||
[Export] private Effect returnEffect;
|
||||
[Export] private float bitesToPeas = 1;
|
||||
public bool triggered = false;
|
||||
private List<Entity> entities = new();
|
||||
public override void _Ready()
|
||||
{
|
||||
AreaEntered += OnAreaEntered;
|
||||
AreaExited += OnAreaExited;
|
||||
}
|
||||
private void OnAreaEntered(Area2D area)
|
||||
{
|
||||
if (area.GetParent() is Entity entity)
|
||||
{
|
||||
entities.Add(entity);
|
||||
}
|
||||
}
|
||||
private void OnAreaExited(Area2D area)
|
||||
{
|
||||
if (area.GetParent() is Entity entity && entities.Contains(entity))
|
||||
{
|
||||
entities.Remove(entity);
|
||||
}
|
||||
}
|
||||
private void OnHPChanged(float delta, Node source)
|
||||
{
|
||||
if (delta >= 0) return;
|
||||
returnAmount -= delta;
|
||||
triggered = true;
|
||||
}
|
||||
public void ReturnAllDamage()
|
||||
{
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
entity.TakeDamage(returnAmount * bitesToPeas, GetParent<Entity>());
|
||||
entity.GiveEffect(returnEffect);
|
||||
}
|
||||
returnAmount = 0;
|
||||
triggered = false;
|
||||
}
|
||||
}
|
||||
1
scripts/plants/NerdusReturnAttack.cs.uid
Normal file
1
scripts/plants/NerdusReturnAttack.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dcokqes5wwo3k
|
||||
|
|
@ -1,18 +1,25 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Newlon.Components.Plants.Behaviours;
|
||||
|
||||
public partial class HpBasedBehaviour : BaseBehaviour
|
||||
{
|
||||
private RuntimePlantData _data;
|
||||
[Export] private Array<string> parameters;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_data = GetParent<RuntimePlantData>();
|
||||
}
|
||||
|
||||
public void OnHPChanged(int amount,Node origin)
|
||||
public void OnHPChanged(int amount, Node origin)
|
||||
{
|
||||
_tree.Set("parameters/Tree/blend_position",(float)_data.HP/_data.MaxHP);
|
||||
var calc = (float)_data.HP / _data.MaxHP;
|
||||
foreach (var par in parameters)
|
||||
{
|
||||
_tree.Set(par, calc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace Newlon.Systems.Effects;
|
|||
|
||||
public partial class GarlicEffect : Effect
|
||||
{
|
||||
[Export] private float tilesWalked = 0.2f;
|
||||
RandomNumberGenerator RandomNumberGenerator;
|
||||
|
||||
public override void Enter(Node target)
|
||||
|
|
@ -43,9 +44,10 @@ public partial class GarlicEffect : Effect
|
|||
mult = -1;
|
||||
}
|
||||
}
|
||||
zombieData.AbleToEat = false;
|
||||
var tween = zombieData.CreateTween();
|
||||
tween.TweenProperty(zombieData,"position:y",zombieData.GlobalPosition.Y + Utility.TileHeight * mult, 1.0);
|
||||
tween.Parallel().TweenProperty(zombieData, "position:x", zombieData.GlobalPosition.X - Utility.TileWidth / 10.0, 1.0);
|
||||
tween.TweenProperty(zombieData,"position:y",zombieData.GlobalPosition.Y + Utility.TileHeight * mult, Duration);
|
||||
tween.Parallel().TweenProperty(zombieData, "position:x", zombieData.GlobalPosition.X - Utility.TileHeight * tilesWalked, Duration);
|
||||
tween.TweenCallback(Callable.From(() => {zombieData.AbleToEat = true;}));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue