How to calculate a distance in an endless runner
BaDDApple
Member Posts: 49
Hello,
I'm working on a little endless running.To keep it simply I'm currently adding a point per second to calculate the score. I would like to add distance traveled so when they hit 100, 1000 yards, etc I can display a sign of the distance traveled and use it for challenges. It doesn't have to be exact is their a quick calculation for time = distance I could create to generate? Thanks in advance.
Comments
Create a integer attribute called Distance
Every 1 second change Distance to Distance+1
When Distance = 100 Spawn distance sign
Need Help? Email Me | Templates | Full Game Source Code
Just decide how many yards you want to add per second.
Then you can do something like
Every 0.3 seconds add 1 to distanceTimer
Then just display 'yards' at the end of the score display.
For the sign, do a rule, which spawns a sigh every time the distanceTimer is divisible by 100, and print the score on it.
Small example attached.
Wow, forgot to stay thank you.