- Home /
Distance calculation for Endless Platformer.
I am creating an endless platformer game in which the player is stationery and all the platforms move towards it.i am gradually increasing the speed of the game by increasing the timescale. so how should i calculate the distance covered by the player.also is increasing the timescale the right way to increase the speed?
Answer by NoseKills · Feb 09, 2015 at 04:38 PM
If you want absolutely everything to happen faster in your game as you progress (including particle speed and animations) you can use timeScale.
For distance you should use the same formula you use to move platforms towards the player. Distance is, in a way, how far the ground has traveled under the player, afterall.
i am just translating the prefab of platform combination towards left,how to use this for distance calculation?
would be easier to say if i could see any of your code moving the platform.
I guess you do something like transform.Translate(Vector.left * Time.deltaTime * speed)
. Do the same for distance: float distance += speed * Time.deltaTime
or Vector3 distance += Vector3.left * speed * Time.deltaTime
. Do it in your player script or some GameObject that's alive the whole game and check the float value or the Vector3.magnitude in the end.
Your answer
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
Precise distance calculation with high timeScale for NavMeshAgents? 1 Answer
How do I only show objects near the player 1 Answer
Fixed distance between objects? 2 Answers
Picking up rigidbody objects 2 Answers