#bullet doesn't queue_free()
7 messages · Page 1 of 1 (latest)
It's on layer 3, but it doesn't look for layer 3
(Also, it doesn't make much sense for the enemy to have an area to detect the bullet hitting it - the bullet should be the one detecting the collision and telling the enemy to take damage)
You'll want to set the layer mask to include 3
so I've changed the collision of bullet from being on layer 3 to looking for layer 3. And I changed the basic enemy also from mask to layer. So now the bullet does queue_free, which is good, but the on_body_entered inside the basic_enemy is never called.
Ideally, it shouldn't be called. The enemy really shouldn't be checking if it's hit, it should just have a function that the bullet can call. The bullet would handle calling the function.
Because otherwise the code inside the enemy can start to get very messy as things get more complicated