how can I calculate distance in % ???
Simple Gamer Arts
Member, PRO Posts: 305
Is there an easy way to calculate how far I got in my runner but in % ?
So, in other words, I'd like to display the % of the total distance I accomplished in the level.... so to say, "user got 33% of the way" for example).
(my runner is from left to right)
My intuition tells me to make an invisible platform the length of the level and to record the amount of pixels from start to finish (death) somehow and then turn it into a % somehow... I just don't know how to do it.
Thank you
Comments
(self.positionX / scene width) * 100 , or you can replace the scene width to the final goal's position. You can also round the number to display as an integer if you want.
Display text round((self.position.X / scene.width)*100)
@Icebox YOU DA MAN, thanks Icebox, that worked beautifully.