Godot version 4.2.2
I’m very new to godot and I’m trying to wrap my head around how signals work with collisions. I have a signal set up to hit a method when an area2D object collides with a body.
func _on_battle_collision_body_entered(body):
print("hit %s" % body)
This method is within the Walk
state. And is used to check when the player collides with an enemy. I want to change to the battle state and begin fighting.
When I first made it I realized it was only colliding with the player so I tried switching around some layering in the collision mask but haven’t found any success.
I’ll post the images of each collision I’m working with and what each layer means for clarity.
1: Environment
2: player
3: battle (specifically for the players battleCollision)
4: enemy
Players main collision
I believe the player is set to its own layer and can only collide with the environment
Then the battleCollision
This is set to the battle layer and then can only interact with the enemy layer
And finally, the enemies collision
It is on the enemy layer and can collide with the battle layer.
What exactly am i missing?? When I run the game I never reach that log from the very first picture. Let me know if you need any other code snippets or screen shots! Thank you!