Increasing the Speed
This piece of code will increase the speed of the game to make it more difficult for the player. Use an if statement to work out when three tiles have passed and, if the game is not yet at a maxSpeed, use the increment operator to speed up the game. Then use new <canvas> APIs to display the player’s speed and how far they have travelled through the game.
See the Pen GB10 M4 by Walker Books UK (@walkerbooks) on CodePen.