Game Development Reference
When the bounce and friction forces are calculated, they can be applied to the lh]uan object:
Remember that kt and ku are the amount by which the player overlaps the platform when the colli-
sion occurs. The player is separated from the platform by that amount.
Detecting the top of the platform
There's one other detail I need to point out. The Lh]uan[Lh]pbkni class needs to know when the
lh]uan is on the ground so that it can be permitted to jump. It contains a private Boolean variable
called [eoKjCnkqj` that's accessed by a getter and setter called eoKjCnkqj`. When the lh]uan is on
the bottom of the stage, [eoKjCnkqj` is set to pnqa, and the player can jump.
The lh]uan needs to be able to jump not only when it's on the bottom of the stage but also when it's
on top of a platform. Fortunately, the collision code is able to tell you which side of the platform the
lh]uan is colliding with. All you need to do is set eoKjCnkqj` to pnqa when the code detects a hit with
the top side of a platform: