Godot Version
Godot 4.x
Question
Currently I want to make a command that goes behind the object. But I want when the character is in the object’s hitbox, it won’t be able to go back. But there seems to be a problem with Area2D when it does not receive the player’s body but the tilemap’s body??
Here is my code
# Hitbox
func _on_body_entered(body):
if body.is_in_group("tilemap"): print("Hello")
if body.is_in_group("player"):
print("ok")
player.can_change_floor = false
func _on_body_exited(body):
if body.is_in_group("player"):
player.can_change_floor = true
Here is the accompanying video, look at cmd when it doesn’t log “Ok” which will log when the player enters