2d Platformer with timed score, how to prevent player from staying in 1 place the whole time
So I am creating a 2D platformer that has the player jumping from platform to platform, and their goal is to last as long as possible. Now, a huge way the player can cheat is by staying stationary for like a whole hour. To prevent the player from doing that, how would I be able to set a timer for how long they would be able to stand stationary on a certain platform for and if they stay there over the time limit, they die?
Answer by Pandaa2610 · Mar 08, 2018 at 02:47 PM
Two ways:
You could write a script that will always move the player forward/to the right (autorunner)
In the Update function increase a timer. If the timer is bigger than your timelimit: Destroy your player.
The problem with 2. is that you could just move left and right really fast to prevent dying but staying on the same spot, so I guess way 1. will be the better choice for your game. That means you just have to use Transform.Translate in the Update function in the player script.