Here you go: The problem that you had was that the square was able to move into the hitbox but then since it was in there it cant move instead of have it check if it's in the hitbox have it move and then if it's in the hitbox move the opposite way