I have a code that should make the player turns red when it touches the enemy from the side but I keep getting this error "Invalid call. Nonexistent function 'ouch' in base 'kinematicbody2d'
enemy's code:
players code:
It's probably coming in contact with a body that isn't the player. You could check with:
if body.has_method("ouch"): body.ouch(position.x)
fire7side Thanks It works like a charm !
You can also check for custom classes.
if body is Player: body.ouch(position.x)