Last modified on 22 March 2012, at 21:38

Super NES Programming/Platform Physics

Ground ModeEdit

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 ModeEdit

1) set "y_velocity" to "take_off_velocity"

2) set "jump_mode" flag

Initiate Fall ModeEdit

1) set "y_velocity" to #0

2) set "jump_mode" flag

Jump/Fall ModeEdit

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 ModeEdit

1) checks for collision between player and tiles

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

Land on GroundEdit

1) reset "jump_mode" flag

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