Godot Version
4.2.1
Question
I’m creating an enemy for a game and having a bit of trouble. The enemy has a weapon and attacks when the player enters the “start attack area” but if the player enters “start area attack shape” in the last frames when enemy isn’t damaging the player, the skeleton won’t attack again and will keep walking forward
So the solution I think will work best is a queue system for the attacks so that when the player enters in the last frames the attack gets queued and starts automatically when the first attack ends.
skeleton attack script:
func _on_start_attack_area_body_entered(body):
print("yes")
if body.is_in_group("Player_body"):
is_attacking = true
animation_tree["parameters/conditions/is_attacking"] = true
while animation_tree["parameters/conditions/Dead"] != true:
await animation_tree.animation_finished
animation_tree["parameters/conditions/is_attacking"] = false
#insert queue system here?
# if body.is_in_group("Player_body") and is_attacking == true:
#add attack action to queue so that it happens when the first attack is finished
func _on_start_attack_area_body_exited(_body):
is_attacking = false
Any and all help is appreciated