Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: heavygunner on October 27, 2018, 09:55:00 AM

Title: (Solved) Level Progress with Distance
Post by: heavygunner 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
Title: Re: Level Progress with Distance
Post by: djaydino 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
Title: Re: Level Progress with Distance
Post by: heavygunner 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. :)