#How to specify if body == Player's collision box?

1 messages · Page 1 of 1 (latest)

void zephyr
#

Trying to be brief, but my enemy slime is currently only "colliding" or printing -5HP when I don't specify any extra information other than detecting collision within itself.

To keep things in check, I want to make an if statement that checks if its the player that has entered the body. I'm unsure how to properly reference my Player Character, or if I should reference just the collision box. Any ideas?

orchid pond
#

You could give the player the group "player" and then check for that. If you have a reference to the player from elsewhere in the script you could compare that.

earnest mango
#

That tag is called group in godot

#

if body.is_in_group("player"):