Rounding issue when moving object by pixels; either too low or too high.
I have an active object that is set to the width of the frame, then positioned to the left of the frame. As the player progresses, this object is moved to the right pixel-by-pixel, to act as a progress meter. When progress equals 100%, the meter should then fill the entire width of the screen.
The issue is that the 'progress' is a different variable each time, though the screen and object width are constant (1366px in this instance). Let's say 'progress' is '180' steps. If I simply dividng 1366/180, I get 7.58.
Now, as each step of progress is completed, I move the object by either 7 or 8 pixels. If I go with 7, the object doesn't fill the entire screen when completion is 100% (step 180, in this example). If I go with 8 pixel movement per step, then the object fills the screen too soon.
How do you guys handle an issue such as this?