Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dang_ |
I am really confused why the player character is not dying. In the enemy code I have already added:
func _on_Fire__body_entered(body):
if body.get_name() == “Player”:
body.queue_free()
and it does not die which is odd. I am not sure if this is because the character is unable to respawn or not. If so, is there a simple code for respawning??
the function for the player to die should be in the player script.
ArthurER | 2020-10-05 12:55
Are you sure the line body.queue\_free()
is executed? Try putting a print statement or a breakpoint, see if it’s actually entering the if block.
Bernard Cloutier | 2020-10-05 14:40
In the enemy code I have already added:
Which child node did you add and what type.
If you print the scene tree with print_tree_pretty()
in the root node and paste it here, the problem will be better understood.
extends Node
func _ready():
print_tree_pretty()
razah | 2020-10-06 16:13
Could you share what your player scene looks like? I have a suspicion that the “body” isn’t at the root of your player scene. If that’s the case, then freeing it would not free the other nodes in your player scene.
Bernard Cloutier | 2020-10-06 19:07