Making the Game Tick
This code will make the game tick by itself using a timer function, called setTimeout. This will call a tick function every 500 milliseconds. You will begin to code a drawGame function which will draw the snake each time the game ticks. Don’t worry that your snake isn’t moving – it’s not supposed to yet. You will code that in the next game build.
See the Pen GB4 M2 by Walker Books UK (@walkerbooks) on CodePen.