Code skill Adding Collision Detection

This piece of code will add collision detection to the platforms, so that when the player misses a jump and crashes into the edge of a platform the game stops. To do this, you will need to use an if statement and add a stop function. You will also need to fix a bug that allows the player to pass through the platforms by working out when the right-hand side of the player has collided with a platform.

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