Super NES Programming/Platform Physics

Ground Mode

edit

Ground mode is when the player is standing or walking on the ground. In ground mode, the following routine is performed:

1) Check to see if jumping button is pressed

2) If so, jump to "initiate_jump_mode" routine

3) Check collision with the tiles below

4) If all tiles underneath player are empty, jump to "initiate_fall_mode" routine

Initiate Jump Mode

edit

1) set "y_velocity" to "take_off_velocity"

2) set "jump_mode" flag

Initiate Fall Mode

edit

1) set "y_velocity" to #0

2) set "jump_mode" flag

Jump/Fall Mode

edit

Jump/Fall mode is when the player jumps or falls. In jump/fall mode, the following routine is performed:

1) increment "y_velocity" by #gravital_acceleration

2) add "y_velocity" to "y_coordinate"

3) if "y_velocity">0, then go to "fall_mode" routine

Fall Mode

edit

1) checks for collision between player and tiles

2) If collision is detected, follow "land_on_ground" routine

Land on Ground

edit

1) reset "jump_mode" flag

2) pop the sprite up to the top of the ground tile