032 : Check platform collisions

Balthazar:

Whenever the player collides with a platform, we want to record that the player is on a platform.

Balthazar:

We do this by initializing the _player.platform variable to false and then checking the platform to see if the player has collided with it. If the player has collided with the platform, then we set _player.platform to be true.

Balthazar:

This works because gravity is constantly pulling the character down onto the platform. The only time the player will **not** be colliding with a platform is when the player is in the middle of a jump.

script.js: Record the platform if the player collides with it.
function check_platform_collisions() { _player.platform = false; if (_player.y > _game.platform.y) { _player.platform = true; _player.y = _game.platform.y; _player.velocity_y = 0; } }
Balthazar:

Make sure your player can jump around before continuing.

GOTO 034