Adding Random Fruit
This piece of code makes the game more exciting by using the game.tick function to add fruit every ten ticks. You will need to add a new addRandomFruit function to the game object, using Math.floor and Math.random to randomly generate an X and Y location for each new fruit object. You will need to use an if statement to make sure that fruit is only added to empty locations.
See the Pen GB11 M2 by Walker Books UK (@walkerbooks) on CodePen.