How to keep an offset of 1 pixel from the wall object?

I have a level in where the player moves from one end of the screen to the next when you hit either the left or right key. What I did was set the object to move with a “permanent” force of 100 pps. The problem is exactly that when I’m touching collision wall object, the player object isn’t moving straight across. It only does so when the object 1 pixel off from each end.My player object is 30px wide and high and my wall objects are 32px apart to allow a 1px space in between all 4 sides of the player object. I was wondering how do I offset my player from the collision object by one pixel. I’ve tried doing “position of object” by subtracting 1 from the x and y positions of the player object from the wall object but I still get the slow down.

Have you tried editing the hitbox on your player sprite?

Also, do you have some screenshots of the project?


So in the gif, see how in the beginning it moves back and forth easily, that’s the goal. when i move up, since the pixel offset isn’t there anymore when it touches the wall it move incrementally. I posted my code as well