2024-10-05 10:39:19 +00:00
|
|
|
extends Node2D
|
|
|
|
|
2024-10-05 15:57:40 +00:00
|
|
|
signal enemy_attacked
|
2024-10-06 17:38:16 +00:00
|
|
|
@export var color:Color
|
2024-10-05 10:39:19 +00:00
|
|
|
func button_pressed():
|
2024-10-06 17:38:16 +00:00
|
|
|
$AnimatedSprite2D.play("defeated_3")
|
2024-10-05 10:39:19 +00:00
|
|
|
|
|
|
|
func _on_first_timer_timeout() -> void:
|
|
|
|
scale = Vector2(1.2,1.2)
|
|
|
|
|
2024-10-06 17:38:16 +00:00
|
|
|
func _process(delta: float) -> void:
|
|
|
|
$AnimatedSprite2D.modulate=color
|
2024-10-05 10:39:19 +00:00
|
|
|
func _on_second_timer_timeout() -> void:
|
|
|
|
scale = Vector2(1.4,1.4)
|
2024-10-05 15:57:40 +00:00
|
|
|
|
|
|
|
func _ready() -> void:
|
2024-10-06 17:38:16 +00:00
|
|
|
$AnimatedSprite2D.play("attack")
|
2024-10-05 15:57:40 +00:00
|
|
|
|
2024-10-06 17:38:16 +00:00
|
|
|
func flip_animation():
|
|
|
|
scale.y = -scale.y
|
2024-10-05 15:57:40 +00:00
|
|
|
|
|
|
|
func _on_animated_sprite_2d_animation_finished() -> void:
|
2024-10-06 17:38:16 +00:00
|
|
|
if($AnimatedSprite2D.animation == "attack"):
|
|
|
|
enemy_attacked.emit()
|
2024-10-05 15:57:40 +00:00
|
|
|
queue_free()
|