I have some difficulties to make an object move on the edge of the screen, it works but not perfectly.
I'm detecting the mouse position and, depends on it position, the object will be on the top, bottom, left or right edge of the screen.
When you move to the right and the object is on the right of the screen there is a small gap between the objet and the edge of the screen and i don't want it. : <
I try to use scrollx+windowwidth/2 for set the Y of the object to the right edge but when i'm not on fullscreen it doesn't work.
Any idea ?
An exemple of my code :