fx: readded merged function
This commit is contained in:
@@ -30,12 +30,12 @@ animations = [{
|
|||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_5hxmy"]
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4flbx"]
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4flbx"]
|
||||||
radius = 5.999982
|
radius = 5.999982
|
||||||
height = 27.990019
|
height = 27.990019
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_5hxmy"]
|
||||||
|
|
||||||
[node name="player" type="CharacterBody2D" unique_id=2032508208]
|
[node name="player" type="CharacterBody2D" unique_id=2032508208]
|
||||||
collision_mask = 14
|
collision_mask = 14
|
||||||
script = ExtResource("1_0ix7k")
|
script = ExtResource("1_0ix7k")
|
||||||
@@ -45,6 +45,10 @@ visibility_layer = 2
|
|||||||
sprite_frames = SubResource("SpriteFrames_onrkg")
|
sprite_frames = SubResource("SpriteFrames_onrkg")
|
||||||
animation = &"attacking"
|
animation = &"attacking"
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=2137063701 groups=["player"]]
|
||||||
|
rotation = -1.5732701
|
||||||
|
shape = SubResource("CapsuleShape2D_4flbx")
|
||||||
|
|
||||||
[node name="AttackArea" type="Area2D" parent="." unique_id=187975387]
|
[node name="AttackArea" type="Area2D" parent="." unique_id=187975387]
|
||||||
position = Vector2(0, 56)
|
position = Vector2(0, 56)
|
||||||
rotation = -1.5732701
|
rotation = -1.5732701
|
||||||
@@ -55,10 +59,6 @@ position = Vector2(55.977566, 9.138502)
|
|||||||
shape = SubResource("CircleShape2D_5hxmy")
|
shape = SubResource("CircleShape2D_5hxmy")
|
||||||
debug_color = Color(0.80813414, 0.3957308, 0.3356335, 0.41960785)
|
debug_color = Color(0.80813414, 0.3957308, 0.3356335, 0.41960785)
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=2137063701 groups=["player"]]
|
|
||||||
rotation = -1.5732701
|
|
||||||
shape = SubResource("CapsuleShape2D_4flbx")
|
|
||||||
|
|
||||||
[node name="AttackTimer" type="Timer" parent="." unique_id=2057433652]
|
[node name="AttackTimer" type="Timer" parent="." unique_id=2057433652]
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ func move(motion: Vector3, mod: float) -> void:
|
|||||||
# Apply boundary to new position
|
# Apply boundary to new position
|
||||||
position = GameManager.get_boundaried_position(position)
|
position = GameManager.get_boundaried_position(position)
|
||||||
|
|
||||||
|
func handle_damage(dmg: int, src: Node) -> void:
|
||||||
|
if owner:
|
||||||
|
owner.handle_damage(dmg, src)
|
||||||
|
|
||||||
func duplicate_init() -> void:
|
func duplicate_init() -> void:
|
||||||
var sight = $Sight
|
var sight = $Sight
|
||||||
remove_child(sight)
|
remove_child(sight)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var can_attack: bool = true
|
|||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
health = maxHealth
|
health = maxHealth
|
||||||
sprite.play("Healthy")
|
sprite.play("Healthy") # TODO: add play_sprite function which calls both sprite and wrapper
|
||||||
wrapper.play_sprite("Healthy")
|
wrapper.play_sprite("Healthy")
|
||||||
if starting_pos:
|
if starting_pos:
|
||||||
collision.set_position(starting_pos)
|
collision.set_position(starting_pos)
|
||||||
@@ -42,9 +42,6 @@ func attack(target: Node) -> void:
|
|||||||
if target.has_method("handle_damage"):
|
if target.has_method("handle_damage"):
|
||||||
target.handle_damage(damage, self.collision)
|
target.handle_damage(damage, self.collision)
|
||||||
hit_hittable = true
|
hit_hittable = true
|
||||||
elif target.is_in_group("resources"):
|
|
||||||
# TODO: resource handling logic
|
|
||||||
pass
|
|
||||||
if hit_hittable:
|
if hit_hittable:
|
||||||
attack_cooldown_timer.start()
|
attack_cooldown_timer.start()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user