Math help - Is this possible?
I've ran into a problem with displaying how many percent of a level my hero has cleared.
Im using this equation:
roundTo(( self.Position.X / scene.Size.Width )*100,0).."%"
As described by @RabidParrot here:
The problem is that Im shifting motion of my hero from positive to negative a couple of times.
Heros motion X is set to 100.
When he hits a certain position, I change my heros X position (forward) and then his X motion to -100.
After hitting the next position I change his X position (forward) and his X motion to 100.
This happens two times during a level.
When my hero dies, I save the position and display the percentage completed.
Is there a way to calculate and display percentage as in the example above even when I go "back"?
Since the percentage is calculated from left to right..if I cleared lets say 50% on first position change, and then change heros motion to -100 that would mean that if I clear 25% more of the level the displayed percentage would not be calculated right.
Did that make any sense?