Code skill Generating More Tiles

You will use procedural generation in this piece of code to create new tiles. You will need to use Math.floor and Math.random to create a random height for each new tile. By using the new operator with the floor function, you can add new tiles to the screen. Using a loop with the function clearOldTiles will stop too many tiles clogging up the browser’s memory.

See the Pen GB3 M4 by Walker Books UK (@walkerbooks) on CodePen.