0 votes

Signal from Area2D is meant to only enable queue_clear when it's in contact with body, but the player instantly dies on spawn.

Was following this YT tutorial by GD quest (time stamp 1:43:36). I have the exact syntax and followed the steps (to my knowledge) perfectly. Anyone able to take a crack at what's up?

#Player script
func _on_EnemyDetector_body_entered(body):
    queue_free()
the rest is just node stuff which I can provide pictures of if required.
Godot version Regular windows, code in GD script
in Engine by (41 points)
retagged by

Check enemy body collision shape. Does it have correct size?

Yeah, the size is fine. Plus I have it spawned far enough away from the player. I've been experimenting with it all day, and i changed queue_free to jump, and intrestingly it seems to always activated the function when the game starts

1 Answer

0 votes

Judging from your comments, there's some other body (not the player) touching the Area2D. Seeing that there's only one other body (the enemy) in the linked video, I'd assume there's either a problem with the settings of your collision layers and/or collision masks in the "Enemy" or "StompDetector" node, or you added some other collision object not shown in the video.

by (1,692 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.