#Enemy player detection hit animation not working

8 messages · Page 1 of 1 (latest)

old abyss
#

I'm making a 2d platformer "mario style" game,and I've tried to make my enemy detect if the player goes into its area2d/collisionshape because then it will enable the attack animation. But when i start the game it just attacks all the time I want it to only attack when the player is in the area. it also doesen't play the walk animation anymore, just the attack.

I tried to follow this tutorial: https://www.youtube.com/watch?v=4WywpSBncFI&t=298s&ab_channel=RafaFiedo

The enemy goes left, right, and can attack. He can also turn around after detecting the hole!

---------------- Ways to Support ----------------
💝 Donate My Game: https://rafafiedo.itch.io/dungeon-rescuer
☕️ Coffee: https://ko-fi.com/rafafiedo

---------------- Useful links ----------------
✎ Script code: https://github.com/rfiedorow...

▶ Play video
#

I'm a noob

#

It's just attacking the air

#

and never stops the attack animation

ashen bloom
#

if you put a print(body.name) in your _on_playerdetector_body_entered(body) function you may see whats causing it

old abyss
#

change the collision layers?