errorattemp to call function 'play' in base"null instance" on a null instance

hi, im new to this forum
i have a error “attemp to call function ‘play’ in base"null instance” on a null instance


pls help

Killzone might be colliding with something other than the player, the ground could be a physics body for example

1 Like

thks
the error gone but the animation didnt play when i touch the killzone

Is your player playing other animations? Often this pattern is used, but it always plays an animation and needs to be stopped. Maybe you could do body.set_process(false) if this is the case.

if direction:
    animated_sprite2d.play("walk")
    velocity.x = direciton * speed
else:
    animated_sprite2d.play("idle")
    velocity.x = 0