Changed zombie speed from int to floatmod, added hobo
This commit is contained in:
parent
5d8e45469d
commit
ad8ecb875a
9 changed files with 310 additions and 158 deletions
BIN
resources/animations/zombies/basic_zombie.res
Normal file
BIN
resources/animations/zombies/basic_zombie.res
Normal file
Binary file not shown.
209
scenes/entities/Zombies/hobo.tscn
Normal file
209
scenes/entities/Zombies/hobo.tscn
Normal file
|
|
@ -0,0 +1,209 @@
|
||||||
|
[gd_scene load_steps=31 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="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_6qr4h"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cse1504ao4g8e" path="res://assets/sprites/atlases/zombies/hobo.png" id="3_6qr4h"]
|
||||||
|
[ext_resource type="AnimationLibrary" uid="uid://cuh2kyb21hmkm" path="res://resources/animations/zombies/basic_zombie.res" id="4_02fim"]
|
||||||
|
[ext_resource type="Script" uid="uid://c5v2og85t7s6j" path="res://scripts/components/zombies/behaviours/HoboBehaviour.cs" id="4_5selg"]
|
||||||
|
[ext_resource type="Script" uid="uid://fd4im1fmwc5n" path="res://scripts/components/Armor.cs" id="4_w8pya"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_w8pya"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource("2_6qr4h")
|
||||||
|
shader_parameter/blend_color = Color(1, 1, 1, 1)
|
||||||
|
shader_parameter/amount = 0.0
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_w8pya"]
|
||||||
|
atlas = ExtResource("3_6qr4h")
|
||||||
|
region = Rect2(0, 15, 40, 49)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_5selg"]
|
||||||
|
atlas = ExtResource("3_6qr4h")
|
||||||
|
region = Rect2(3, 0, 35, 11)
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_qv5y7"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("CanvasGroup/Sprite:self_modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sq25x"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_qv5y7")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_w8pya"]
|
||||||
|
length = 2.0
|
||||||
|
tracks/0/type = "method"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Mover")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1.93333),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"values": [{
|
||||||
|
"args": [0.0],
|
||||||
|
"method": &"SetSpeedMult"
|
||||||
|
}, {
|
||||||
|
"args": [3.0],
|
||||||
|
"method": &"SetSpeedMult"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("CanvasGroup/Sprite:self_modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1), Color(1, 0, 0, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_5selg"]
|
||||||
|
resource_name = "walk"
|
||||||
|
tracks/0/type = "method"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Mover")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [0.1],
|
||||||
|
"method": &"SetSpeedFlat"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5selg"]
|
||||||
|
_data = {
|
||||||
|
&"can_destroy": SubResource("Animation_w8pya"),
|
||||||
|
&"run": SubResource("Animation_5selg")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_h0rfo"]
|
||||||
|
animation = &"basic_zombie/eat"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_nog33"]
|
||||||
|
animation = &"basic_zombie/idle"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_g2uel"]
|
||||||
|
animation = &"basic_zombie/walk"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_02fim"]
|
||||||
|
animation = &"hobo_zombie/can_destroy"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_c1y3b"]
|
||||||
|
animation = &"hobo_zombie/run"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_vxhht"]
|
||||||
|
advance_mode = 2
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_y2ivb"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"isEating\") == true"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_7d3k4"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"isEating\") == true"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_qg8rq"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"canDestroyed\") == false"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4248q"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"canDestroyed\") == true"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_tu6af"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"isEating\") == true"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_yalvk"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"canDestroyed\") == true and get(\"isEating\") == false"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_7jlle"]
|
||||||
|
switch_mode = 2
|
||||||
|
advance_mode = 2
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_w1b1s"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"canDestroyed\") == false and get(\"isEating\") == false"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_02fim"]
|
||||||
|
advance_mode = 2
|
||||||
|
advance_expression = "get(\"canDestroyed\") == true"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_xg3p6"]
|
||||||
|
states/End/position = Vector2(1183, 100)
|
||||||
|
states/basic_zombie_eat/node = SubResource("AnimationNodeAnimation_h0rfo")
|
||||||
|
states/basic_zombie_eat/position = Vector2(711, 206)
|
||||||
|
states/basic_zombie_idle/node = SubResource("AnimationNodeAnimation_nog33")
|
||||||
|
states/basic_zombie_idle/position = Vector2(368, 100)
|
||||||
|
states/basic_zombie_walk/node = SubResource("AnimationNodeAnimation_g2uel")
|
||||||
|
states/basic_zombie_walk/position = Vector2(711, -21)
|
||||||
|
states/hobo_zombie_can_destroy/node = SubResource("AnimationNodeAnimation_02fim")
|
||||||
|
states/hobo_zombie_can_destroy/position = Vector2(368, 206)
|
||||||
|
states/hobo_zombie_run/node = SubResource("AnimationNodeAnimation_c1y3b")
|
||||||
|
states/hobo_zombie_run/position = Vector2(866, 89)
|
||||||
|
transitions = ["Start", "basic_zombie_idle", SubResource("AnimationNodeStateMachineTransition_vxhht"), "basic_zombie_idle", "basic_zombie_eat", SubResource("AnimationNodeStateMachineTransition_y2ivb"), "basic_zombie_walk", "basic_zombie_eat", SubResource("AnimationNodeStateMachineTransition_7d3k4"), "basic_zombie_idle", "basic_zombie_walk", SubResource("AnimationNodeStateMachineTransition_qg8rq"), "basic_zombie_idle", "hobo_zombie_run", SubResource("AnimationNodeStateMachineTransition_4248q"), "hobo_zombie_run", "basic_zombie_eat", SubResource("AnimationNodeStateMachineTransition_tu6af"), "basic_zombie_eat", "hobo_zombie_run", SubResource("AnimationNodeStateMachineTransition_yalvk"), "hobo_zombie_can_destroy", "basic_zombie_idle", SubResource("AnimationNodeStateMachineTransition_7jlle"), "basic_zombie_eat", "basic_zombie_walk", SubResource("AnimationNodeStateMachineTransition_w1b1s"), "basic_zombie_walk", "hobo_zombie_run", SubResource("AnimationNodeStateMachineTransition_02fim")]
|
||||||
|
graph_offset = Vector2(55, -28)
|
||||||
|
|
||||||
|
[node name="Hobo" node_paths=PackedStringArray("_armor") instance=ExtResource("1_fnu7s")]
|
||||||
|
_armor = NodePath("CanArmor")
|
||||||
|
|
||||||
|
[node name="CanvasGroup" parent="." index="0"]
|
||||||
|
material = SubResource("ShaderMaterial_w8pya")
|
||||||
|
|
||||||
|
[node name="Can" type="Node2D" parent="CanvasGroup" index="1"]
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="CanvasGroup/Can" index="0"]
|
||||||
|
position = Vector2(3, -40)
|
||||||
|
texture = SubResource("AtlasTexture_w8pya")
|
||||||
|
|
||||||
|
[node name="Sprite2D2" type="Sprite2D" parent="CanvasGroup/Can" index="1"]
|
||||||
|
z_index = -1
|
||||||
|
position = Vector2(1, -63)
|
||||||
|
texture = SubResource("AtlasTexture_5selg")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" parent="." index="3"]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_sq25x"),
|
||||||
|
&"basic_zombie": ExtResource("4_02fim"),
|
||||||
|
&"hobo_zombie": SubResource("AnimationLibrary_5selg")
|
||||||
|
}
|
||||||
|
autoplay = "baisc_zombie/walk"
|
||||||
|
speed_scale = 3.0
|
||||||
|
|
||||||
|
[node name="AnimationTree" parent="." index="4"]
|
||||||
|
tree_root = SubResource("AnimationNodeStateMachine_xg3p6")
|
||||||
|
advance_expression_base_node = NodePath("../Behaviour")
|
||||||
|
|
||||||
|
[node name="CanArmor" type="Node" parent="." index="7"]
|
||||||
|
script = ExtResource("4_w8pya")
|
||||||
|
_maxHP = 100
|
||||||
|
metadata/_custom_type_script = "uid://fd4im1fmwc5n"
|
||||||
|
|
||||||
|
[node name="Behaviour" type="Node" parent="." index="8" node_paths=PackedStringArray("_eatBox", "_animationTree")]
|
||||||
|
script = ExtResource("4_5selg")
|
||||||
|
_eatBox = NodePath("../Eatbox")
|
||||||
|
_animationTree = NodePath("../AnimationTree")
|
||||||
|
|
||||||
|
[connection signal="ArmorLost" from="CanArmor" to="CanvasGroup/Can" method="queue_free"]
|
||||||
|
[connection signal="ArmorLost" from="CanArmor" to="Behaviour" method="Trashed"]
|
||||||
|
|
@ -1,132 +1,62 @@
|
||||||
[gd_scene load_steps=28 format=3 uid="uid://co11v3w8hbwgf"]
|
[gd_scene load_steps=27 format=3 uid="uid://co11v3w8hbwgf"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/components/zombies/RuntimeZombieData.cs" id="1_qq3f1"]
|
[ext_resource type="Script" uid="uid://dildme6epx8l4" path="res://scripts/components/zombies/RuntimeZombieData.cs" id="1_qq3f1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bwwbkybryi6k0" path="res://assets/sprites/zombie.tres" id="2_4pdxh"]
|
[ext_resource type="Texture2D" uid="uid://bwwbkybryi6k0" path="res://assets/sprites/zombie.tres" id="2_4pdxh"]
|
||||||
[ext_resource type="Shader" path="res://assets/shaders/CG_color_blender.gdshader" id="2_srwwe"]
|
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_srwwe"]
|
||||||
[ext_resource type="Script" path="res://scripts/components/zombies/EatBox.cs" id="3_2aulo"]
|
[ext_resource type="Script" uid="uid://dqyony6jxt2p0" path="res://scripts/components/zombies/EatBox.cs" id="3_2aulo"]
|
||||||
[ext_resource type="Script" path="res://scripts/components/FlashComponent.cs" id="3_rao3m"]
|
[ext_resource type="Script" uid="uid://c5vfccegyy01t" path="res://scripts/components/FlashComponent.cs" id="3_rao3m"]
|
||||||
[ext_resource type="Script" path="res://scripts/components/zombies/ZombieMover.cs" id="4_u5syx"]
|
[ext_resource type="Script" uid="uid://7hdj2k14lfe4" path="res://scripts/components/zombies/ZombieMover.cs" id="4_u5syx"]
|
||||||
[ext_resource type="Script" path="res://scripts/components/zombies/behaviours/BasicZombieBehaviour.cs" id="5_2pvkr"]
|
[ext_resource type="AnimationLibrary" uid="uid://cuh2kyb21hmkm" path="res://resources/animations/zombies/basic_zombie.res" id="6_ckb7n"]
|
||||||
|
[ext_resource type="Script" uid="uid://c3cfnrmnnuqms" path="res://addons/floatmodifiers/FloatModifiers.cs" id="7_b3p4o"]
|
||||||
[ext_resource type="AudioStream" uid="uid://xoy5ct1t17k5" path="res://assets/audio/sfx/slap.mp3" id="8_di4dd"]
|
[ext_resource type="AudioStream" uid="uid://xoy5ct1t17k5" path="res://assets/audio/sfx/slap.mp3" id="8_di4dd"]
|
||||||
[ext_resource type="Script" path="res://scripts/components/zombies/AudioDamage.cs" id="9_oxd1e"]
|
[ext_resource type="Script" uid="uid://bsg4utgc0u0vo" path="res://scripts/components/zombies/AudioDamage.cs" id="9_oxd1e"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_63ls2"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_63ls2"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
shader = ExtResource("2_srwwe")
|
shader = ExtResource("2_srwwe")
|
||||||
shader_parameter/blend_color = Color(1, 1, 1, 1)
|
shader_parameter/blend_color = Color(1, 1, 1, 1)
|
||||||
shader_parameter/amount = null
|
shader_parameter/amount = 0.0
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hxyad"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hxyad"]
|
||||||
size = Vector2(2, 84)
|
size = Vector2(2, 48)
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_ruqsf"]
|
||||||
|
script = ExtResource("7_b3p4o")
|
||||||
|
flat_value = 10.0
|
||||||
|
percentage_value = 0.0
|
||||||
|
mult_value = 1.0
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_r4ug6"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_r4ug6"]
|
||||||
size = Vector2(16, 48)
|
size = Vector2(16, 48)
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_qv5y7"]
|
[sub_resource type="Animation" id="Animation_qv5y7"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
tracks/0/type = "method"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
tracks/0/path = NodePath("Mover")
|
tracks/0/path = NodePath("AnimationTree:parameters/conditions/no_can")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"values": [{
|
"update": 1,
|
||||||
"args": [0.0],
|
"values": [false]
|
||||||
"method": &"SetSpeed"
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sq25x"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sq25x"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_qv5y7")
|
&"RESET": SubResource("Animation_qv5y7")
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_fwldj"]
|
|
||||||
resource_name = "eat"
|
|
||||||
loop_mode = 1
|
|
||||||
step = 0.1
|
|
||||||
tracks/0/type = "method"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Eatbox")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0.5),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"values": [{
|
|
||||||
"args": [],
|
|
||||||
"method": &"Bite"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
tracks/1/type = "method"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath("Mover")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"values": [{
|
|
||||||
"args": [0.0],
|
|
||||||
"method": &"SetSpeed"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_lrgn8"]
|
|
||||||
resource_name = "idle"
|
|
||||||
loop_mode = 1
|
|
||||||
tracks/0/type = "method"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Mover")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"values": [{
|
|
||||||
"args": [0.0],
|
|
||||||
"method": &"SetSpeed"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_ebhxh"]
|
|
||||||
resource_name = "walk"
|
|
||||||
tracks/0/type = "method"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath("Mover")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"values": [{
|
|
||||||
"args": [0.5],
|
|
||||||
"method": &"SetSpeed"
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5ci4h"]
|
|
||||||
_data = {
|
|
||||||
"eat": SubResource("Animation_fwldj"),
|
|
||||||
"idle": SubResource("Animation_lrgn8"),
|
|
||||||
"walk": SubResource("Animation_ebhxh")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_h0rfo"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_h0rfo"]
|
||||||
animation = &"baisc_zombie/eat"
|
animation = &"basic_zombie/eat"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_nog33"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_nog33"]
|
||||||
animation = &"baisc_zombie/idle"
|
animation = &"basic_zombie/idle"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_g2uel"]
|
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_g2uel"]
|
||||||
animation = &"baisc_zombie/walk"
|
animation = &"basic_zombie/walk"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_vxhht"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_vxhht"]
|
||||||
advance_mode = 2
|
advance_mode = 2
|
||||||
|
|
@ -136,28 +66,35 @@ advance_mode = 2
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_y2ivb"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_y2ivb"]
|
||||||
advance_mode = 2
|
advance_mode = 2
|
||||||
advance_condition = &"eat"
|
advance_expression = "get(\"isEating\") == true"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_7d3k4"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_7d3k4"]
|
||||||
advance_mode = 2
|
advance_mode = 2
|
||||||
advance_condition = &"eat"
|
advance_expression = "get(\"isEating\") == true"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kk4wi"]
|
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kk4wi"]
|
||||||
advance_mode = 2
|
advance_mode = 2
|
||||||
advance_condition = &"end_eat"
|
advance_expression = "get(\"isEating\") == false"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_qep5j"]
|
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_qep5j"]
|
||||||
states/End/position = Vector2(1183, 100)
|
states/End/position = Vector2(1183, 100)
|
||||||
states/baisc_zombie_eat/node = SubResource("AnimationNodeAnimation_h0rfo")
|
states/basic_zombie_eat/node = SubResource("AnimationNodeAnimation_h0rfo")
|
||||||
states/baisc_zombie_eat/position = Vector2(575, 185)
|
states/basic_zombie_eat/position = Vector2(575, 185)
|
||||||
states/baisc_zombie_idle/node = SubResource("AnimationNodeAnimation_nog33")
|
states/basic_zombie_idle/node = SubResource("AnimationNodeAnimation_nog33")
|
||||||
states/baisc_zombie_idle/position = Vector2(368, 100)
|
states/basic_zombie_idle/position = Vector2(366, 100)
|
||||||
states/baisc_zombie_walk/node = SubResource("AnimationNodeAnimation_g2uel")
|
states/basic_zombie_walk/node = SubResource("AnimationNodeAnimation_g2uel")
|
||||||
states/baisc_zombie_walk/position = Vector2(575, 35)
|
states/basic_zombie_walk/position = Vector2(575, 35)
|
||||||
transitions = ["Start", "baisc_zombie_idle", SubResource("AnimationNodeStateMachineTransition_vxhht"), "baisc_zombie_idle", "baisc_zombie_walk", SubResource("AnimationNodeStateMachineTransition_r8rju"), "baisc_zombie_idle", "baisc_zombie_eat", SubResource("AnimationNodeStateMachineTransition_y2ivb"), "baisc_zombie_walk", "baisc_zombie_eat", SubResource("AnimationNodeStateMachineTransition_7d3k4"), "baisc_zombie_eat", "baisc_zombie_walk", SubResource("AnimationNodeStateMachineTransition_kk4wi")]
|
transitions = ["Start", "basic_zombie_idle", SubResource("AnimationNodeStateMachineTransition_vxhht"), "basic_zombie_idle", "basic_zombie_walk", SubResource("AnimationNodeStateMachineTransition_r8rju"), "basic_zombie_idle", "basic_zombie_eat", SubResource("AnimationNodeStateMachineTransition_y2ivb"), "basic_zombie_walk", "basic_zombie_eat", SubResource("AnimationNodeStateMachineTransition_7d3k4"), "basic_zombie_eat", "basic_zombie_walk", SubResource("AnimationNodeStateMachineTransition_kk4wi")]
|
||||||
graph_offset = Vector2(-17, -2)
|
graph_offset = Vector2(13, 26)
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_ckb7n"]
|
||||||
|
script = ExtResource("7_b3p4o")
|
||||||
|
flat_value = 0.1
|
||||||
|
percentage_value = 0.0
|
||||||
|
mult_value = 1.0
|
||||||
|
|
||||||
[node name="Zombie" type="Node2D"]
|
[node name="Zombie" type="Node2D"]
|
||||||
|
y_sort_enabled = true
|
||||||
script = ExtResource("1_qq3f1")
|
script = ExtResource("1_qq3f1")
|
||||||
_maxHP = 100
|
_maxHP = 100
|
||||||
|
|
||||||
|
|
@ -174,15 +111,14 @@ collision_layer = 8
|
||||||
collision_mask = 0
|
collision_mask = 0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||||
position = Vector2(2, -42)
|
position = Vector2(2, -24)
|
||||||
shape = SubResource("RectangleShape2D_hxyad")
|
shape = SubResource("RectangleShape2D_hxyad")
|
||||||
|
|
||||||
[node name="Eatbox" type="Area2D" parent="." node_paths=PackedStringArray("_animationTree")]
|
[node name="Eatbox" type="Area2D" parent="."]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = ExtResource("3_2aulo")
|
script = ExtResource("3_2aulo")
|
||||||
_damage = 10
|
_damage = SubResource("Resource_ruqsf")
|
||||||
_animationTree = NodePath("../AnimationTree")
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Eatbox"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Eatbox"]
|
||||||
position = Vector2(-10, -24)
|
position = Vector2(-10, -24)
|
||||||
|
|
@ -190,22 +126,18 @@ shape = SubResource("RectangleShape2D_r4ug6")
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_sq25x"),
|
&"": SubResource("AnimationLibrary_sq25x"),
|
||||||
"baisc_zombie": SubResource("AnimationLibrary_5ci4h")
|
&"basic_zombie": ExtResource("6_ckb7n")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="AnimationTree" type="AnimationTree" parent="."]
|
[node name="AnimationTree" type="AnimationTree" parent="."]
|
||||||
tree_root = SubResource("AnimationNodeStateMachine_qep5j")
|
tree_root = SubResource("AnimationNodeStateMachine_qep5j")
|
||||||
|
advance_expression_base_node = NodePath("../Eatbox")
|
||||||
anim_player = NodePath("../AnimationPlayer")
|
anim_player = NodePath("../AnimationPlayer")
|
||||||
parameters/conditions/eat = false
|
|
||||||
parameters/conditions/end_eat = false
|
|
||||||
|
|
||||||
[node name="Mover" type="Node" parent="."]
|
[node name="Mover" type="Node" parent="."]
|
||||||
script = ExtResource("4_u5syx")
|
script = ExtResource("4_u5syx")
|
||||||
_speedMultiplier = 0.25
|
_speed = SubResource("Resource_ckb7n")
|
||||||
|
|
||||||
[node name="Behaviour" type="Node" parent="."]
|
|
||||||
script = ExtResource("5_2pvkr")
|
|
||||||
|
|
||||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||||
stream = ExtResource("8_di4dd")
|
stream = ExtResource("8_di4dd")
|
||||||
|
|
|
||||||
|
|
@ -8,26 +8,30 @@ public partial class EatBox : Area2D
|
||||||
{
|
{
|
||||||
// Rewrite this class completely when field system will be introduced.
|
// Rewrite this class completely when field system will be introduced.
|
||||||
|
|
||||||
[Export] private int _damage;
|
[Export] private FloatModifiers _damage;
|
||||||
[Export] private AnimationTree _animationTree;
|
|
||||||
private RuntimePlantData plant;
|
private RuntimePlantData plant;
|
||||||
|
|
||||||
|
public bool isEating = false;
|
||||||
|
|
||||||
public void Bite()
|
public void Bite()
|
||||||
{
|
{
|
||||||
if (GetParent<RuntimeZombieData>().AbleToEat)
|
if (GetParent<RuntimeZombieData>().AbleToEat)
|
||||||
plant?.TakeDamage(_damage,GetParent());
|
{
|
||||||
|
plant?.TakeDamage((int)_damage.GetValue(), GetParent());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnAreaEntered(Area2D area)
|
public void OnAreaEntered(Area2D area)
|
||||||
{
|
{
|
||||||
var parent = area.GetParent();
|
var parent = area.GetParent();
|
||||||
|
GD.Print(parent.Name);
|
||||||
|
|
||||||
if (parent != null && parent is RuntimePlantData plantData)
|
if (parent != null && parent is RuntimePlantData plantData)
|
||||||
{
|
{
|
||||||
plant = plantData;
|
plant = plantData;
|
||||||
_animationTree.Set("parameters/conditions/eat", true);
|
isEating = true;
|
||||||
_animationTree.Set("parameters/conditions/end_eat", false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,8 +42,7 @@ public partial class EatBox : Area2D
|
||||||
if (parent == plant)
|
if (parent == plant)
|
||||||
{
|
{
|
||||||
plant = null;
|
plant = null;
|
||||||
_animationTree.Set("parameters/conditions/eat", false);
|
isEating = false;
|
||||||
_animationTree.Set("parameters/conditions/end_eat", true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,30 +4,40 @@ namespace Newlon.Components.Zombies;
|
||||||
|
|
||||||
public partial class ZombieMover : Node
|
public partial class ZombieMover : Node
|
||||||
{
|
{
|
||||||
[Export(hintString: "suffix:tile/sec")]
|
[Export]
|
||||||
private float _speedMultiplier = 1.0f;
|
private FloatModifiers _speed;
|
||||||
|
|
||||||
private float _speed = 1;
|
|
||||||
|
|
||||||
private Node2D _zombie;
|
private Node2D _zombie;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_zombie = GetParent<Node2D>();
|
_zombie = GetParent<Node2D>();
|
||||||
|
_speed = (FloatModifiers)_speed.Duplicate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
_zombie.Position -= _zombie.Transform.X
|
_zombie.Position -= _zombie.Transform.X
|
||||||
* _speed
|
* (float)delta
|
||||||
* (float)delta
|
* Utility.TileWidth
|
||||||
* Utility.TileWidth
|
* GetParent<RuntimeZombieData>().LocalTimescale
|
||||||
* GetParent<RuntimeZombieData>().LocalTimescale
|
* _speed.GetValue();
|
||||||
* _speedMultiplier;
|
GD.Print(_speed.GetMult());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSpeed(float speed)
|
public void SetSpeedFlat(float speed)
|
||||||
{
|
{
|
||||||
_speed = speed;
|
_speed.SetFlat(speed);
|
||||||
|
}
|
||||||
|
public void SetSpeedPercentage(float speed)
|
||||||
|
{
|
||||||
|
_speed.SetPercentage(speed);
|
||||||
|
}
|
||||||
|
public void SetSpeedMult(float speed)
|
||||||
|
{
|
||||||
|
_speed.SetMult(speed);
|
||||||
|
}
|
||||||
|
public void AddMult(float amount)
|
||||||
|
{
|
||||||
|
_speed.ChangeMult(amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
using Godot;
|
|
||||||
|
|
||||||
namespace Newlon.Components.Zombies.Behaviours;
|
|
||||||
|
|
||||||
public partial class BasicZombieBehaviour : Node
|
|
||||||
{
|
|
||||||
[Export] private AnimationTree _animationTree;
|
|
||||||
public void StartEating()
|
|
||||||
{
|
|
||||||
_animationTree.Set("parameters/conditions/eat",true);
|
|
||||||
_animationTree.Set("parameters/conditions/end_eat", false);
|
|
||||||
GD.Print("StartEating");
|
|
||||||
}
|
|
||||||
public void EndEating()
|
|
||||||
{
|
|
||||||
_animationTree.Set("parameters/conditions/eat", false);
|
|
||||||
_animationTree.Set("parameters/conditions/end_eat", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
uid://cgf61r46dgh4m
|
|
||||||
17
scripts/components/zombies/behaviours/HoboBehaviour.cs
Normal file
17
scripts/components/zombies/behaviours/HoboBehaviour.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Newlon.Components.Zombies.Behaviours;
|
||||||
|
|
||||||
|
public partial class HoboBehaviour : Node
|
||||||
|
{
|
||||||
|
[Export] private EatBox _eatBox;
|
||||||
|
[Export] private AnimationTree _animationTree;
|
||||||
|
public bool isEating => _eatBox.isEating;
|
||||||
|
public bool canDestroyed = false;
|
||||||
|
public void Trashed()
|
||||||
|
{
|
||||||
|
canDestroyed = true;
|
||||||
|
((AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/playback")).Travel("hobo_zombie_can_destroy");
|
||||||
|
_animationTree.Set("parameters/eat_Tree/blend/blend_amount", 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://c5v2og85t7s6j
|
||||||
Loading…
Add table
Add a link
Reference in a new issue