- Edited
When you press certain buttons in my game (a 2d puzzle platformer), the tilemap (but character and maybe enemies and objects) is flipped horizontal or vertically and that can cause problems. The player always has to be in the nearest free space, being the priorities up and down (depending on the position of the center of the collision shape, it will go to one direction or the other (if in the middle of the tile, then up) ) and left or right if there's no space in the previous directions.