#Killzone will not collide with player! please help!

1 messages · Page 1 of 1 (latest)

jolly gull
#

so im making a 2d platformer to learn the program and i'm stuck. Im trying to put a kill zone at the bottom of the level so when you fall the level restarts. right now i have it to print "dead" just to test if the collision is workings, and it's not. not matter what i've done, they won't collide. the script i have for coins does work though (that last pic) , so i know it can work. the killzone has all the same settings as the coins, mask/layer layout stuff, all that. so i have no idea what is wrong and i've been trying to fix it for 4 days. please help, thank yous T^T

dusty dragon
#

is the correct script attached to the kill zone node and is the body_entered signal connected correctly?

jolly gull
#

how do i check that?

dusty dragon
#

hover over the script icon next to the node name in the scene tree for the script and click the green arrow/box icon next to the _on_body_entered method for the signal

jolly gull
#

it has the green arrow box

dusty dragon
#

clicking that should open a window that shows which signal is connected to the method

jolly gull
#

oh!

#

well it's connected to killzone

dusty dragon
#

is it the correct signal though? if it is and really all settings, especially the "monitoring" property and collision mask, are the same between the kill zone and the coin it should work. if you could post the relevant tscn file(s) and scripts i'll take a look

jolly gull
#

im not sure how to do that

true flicker
#

Hey, so the problem Is that you should specify which body.

Example:
func _on_body_entered(body: Node2D) -> void:
if body == player:
print("dead")

#

Also, try to put the player in a class
Example:
(Player script)
Extends Characterbody2D
class_name player

jolly gull
#

it's stil not working T^T that was a great idea though 🤔

true flicker
#

Are you sure you did that?

dusty dragon
#

Checking whether the correct body entered the kill zone inside a method that does not get called will not help with that method not getting called. The warning can safely be ignored as long as the player is the only body that can enter the kill zone. Something is wrong, but it's not the method itself.

jolly gull
#

but what could be wrong? thanks for trying to help btw