0 votes

i got 250 sprites under a Node...
how do i make it so when the player collides with the sprites/the node
he will die/respawn?

in Engine by (30 points)

1 Answer

0 votes

Area2D has a "body_entered(body)" signal that you could use. You can also use the "name" property to filter for the player/object being collided:

func _on_body_entered(body) -> void:
    if body.name == "player":
        GLOBAL.player_dead()
        GLOBAL.restart_scene()
by (335 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.