There are usually more than one way to solve a problem.
Simpler is often better.
Type: Posts; User: Norm
There are usually more than one way to solve a problem.
Simpler is often better.
How else would you change the movement into the next postion if it was past where you want it to stop?
I did not say to continue using the % 32 logic. Perhaps that is not the way to recognize...
Look at the logic where you change the x,y values for a move.
Check if the new position will cross a boundary and if the movement should stop.
If it should stop, set the new location to be on the...
Look at your logic to see if the image's next movement will go past the bounds of the grid and stop its moving at that point. For example if it is at 31 and moves by 2 it will skip over 32.
So...
You need to debug your code to see what is happening.
Add some printlns to show the values of the variables as they are changed and as they are used to move the image.