4.3 Godot Version
problem
I’m making a top-down game, and I want the player to be able to hit a projectile back at the enemy, but when I set the collision layer to the player hitbox, the enemy hurtbox won’t detect it.
This is the code
Layer 11 is the player’s hit box
Layer 4 is the enemy’s hurt box
func _on_hurt_box_area_entered(_area: Area2D) → void:
collisionBox.set_deferred(“disabled”, true)
hurtBox.create_hit_effect()
speed = speed * -1
hitBox.collision_layer = 11
hitBox.collision_mask = 4
collisionBox.set_deferred(“disabled”, false)