Files
GMTK25/ennemy/armored_ennemy.gd
Minimata 6e017197f6
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 5s
Create tag and build when new code gets to main / Export (push) Successful in 2m5s
feat: integrated some assets and made a hitbox and damage reaction system
2025-08-01 17:17:00 +02:00

28 lines
628 B
GDScript

extends CharacterBody2D
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var time_to_finish_hit: Timer = $TimeToFinishHit
@onready var hitbox: Area2D = $Hitbox
func _ready() -> void:
hitbox.monitoring = false
func play_anim_run():
animated_sprite.play("run")
func play_anim_idle():
animated_sprite.play("idle")
func hit():
animated_sprite.play("hit")
time_to_finish_hit.start()
hitbox.monitoring = true
func _on_trigger_hit_body_entered(body: Node2D) -> void:
if body.name == "Player":
hit()
func _on_time_to_finish_hit_timeout() -> void:
play_anim_idle()
hitbox.monitoring = false