I am making a Sokban game with ice physics, however I am getting stuck on this edge case whenever i push an crate while it is on ice, it moves to the correct spot but my character only moves one space.
the player and the crate uses the same script because i wanted to use modular components.
after some debugging I found that it is detecting a collision with the crate as if it is on the middle ice tile.
pic 1 - normal before moving
pic 2 - normal after moving
pic 3 - edge case before moving
pic 4 - edge case after moving
pic 5 - when player is detecting the crate after it has moved
pic 6 - debug menu at pic 5
other pics will be the code for the movement.
bonus question: if you have any tips to improve my code in other ways, I would be thankful for the knowledge.