playMaker

Author Topic: (Solved) Level Progress with Distance  (Read 983 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
(Solved) Level Progress with Distance
« on: October 27, 2018, 09:55:00 AM »
Hi !

My game is simple platform runner. I have 20 tiles. Game will be finished once player reached End of tile #20.

Now I wanna display Level progress in UI. It should be 100% once player reached end point. How to link player move distance to progress.

Note : Time can't be used coz I have a simple powerup system. If player pickup that, it will speed the player for few secs.  I use Translate action for player movement.

Thanks
« Last Edit: October 27, 2018, 03:17:15 PM by heavygunner »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Level Progress with Distance
« Reply #1 on: October 27, 2018, 02:36:06 PM »
Hi.
is the player going in a single direction?

if so you can get the start position , end position and current position to calculate the percentage.

This is the formula :

((current position - start position) / (end position - start position) ) x 100

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Re: Level Progress with Distance
« Reply #2 on: October 27, 2018, 03:17:48 PM »
Hi.
is the player going in a single direction?

if so you can get the start position , end position and current position to calculate the percentage.

This is the formula :

((current position - start position) / (end position - start position) ) x 100
Yes, Single direction.
Thank you. :)