#bullet doesn't queue_free()

7 messages · Page 1 of 1 (latest)

dark sluice
#

Your bullet's Area has its collision layers set wrong

#

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)

dark sluice
hearty hound
# dark sluice 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.

dark sluice
#

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