Bullet collision not working

Godot 4
I’m just getting started on a beat-em-up I’m making, but I’m running into a problem with bullet collision. I have my enemy who’s “firing” animation triggers a function that instantiates a “musicbullet”. The bullet is instantiated and shoots at the player correctly, but my “_on_body_entered()” function isn’t working properly. I have the player, the damage receiver, and the bullet all on collision level 5, but the nothing happens when they collide.



Is the damage reciever a body type or an Area2D, is the bullet a body type or an Area2D? How did you define the body entered function?


Make sure to paste code instead of screenshots

2 Likes

They’re both Area2D nodes. The body entered function I got from going to “Node” in the top right and connecting the default “body_entered” function to the bullet node itself. It looks like this:

func _on_body_entered(body: Node2D) -> void:
	print("Hit")
	body.queue_free()

Well if they are both areas, you need to use the area_entered signal not the body_entered signal

3 Likes

Well that would do it :joy:. Always the dumbest mistakes, thanks for help!

1 Like