I have been trying to make a simple shooter game in the past few days. However, whenever a bullet (an Area2D will an on_body_entered() signal/function) collides with an ammo crate (a staticBody2D) it completely ignores the crate, and the body entered function does not trigger. I have already checked the collision masks and layers.
This is the on body entered function of the bullet (which does not get triggered when colliding with the ammo crate):
func _on_body_entered(body):
if "hit" in body:
body.hit()
queue_free()
This is the code in the ammo crate:
extends CrateContainer
func hit():
print("This crate has been shot.")
The ammo crate has a parent class called CrateContainer, with a sprite2D node and a CollisionShape node (both of which have no textures or shapes)