Godot Version
4.2.1 Stable
Question
Hi All. I am having difficulty destroying the player scene when I have my projectile hit the player. Currently I have it set up where the missile scene will shoot from the top down towards the player and change to the explosion scene if it comes into contact with either the player or the tilemap. And once it comes into contact it will destroy itself, which I want.
I’ve followed video tutorials on how to destroy the player CharacterNody2D node, usually with a Area2D child and CollisionShape2D grandchild. I’ve connected the Area2D via body_entered signal:
func _body_entered(body):
if body.is_in_group("Enemy"):
queue_free()
But the player stands strong.
For reference I have three layers (1: World, 2: Player, 3:Enemy).
The player is just on layer 2, mask 1 and 3.
The missile and missile explosion on layer 3, mask 1 and 2.
I also have a RayCast2D turret scene which shoots the missiles.
Not sure if this is due to some layer/mask issue, Area2D monitoring/monitorable issue, or if its some issue related to the specific codes for the player, missile, or explosion scenes.
Please let me know if you need more detail or the code itself for the scenes.