In Sonic Advance 2 the ground acceleration rises with the ring count. At the start of each frame Player_HandleBoostThreshold picks a bracket from the rings and Player_ApplyBoostPhysics sets the acceleration from playerBoostPhysicsTable: 8 subpixels (1/256 px/frame) a frame with 10 rings or fewer, 12 with 11 to 49, 14 with 50 to 99, 16 with 100 to 149, and 18 with 150 or more. The deceleration, taken when the d-pad is held against the motion, is 64 in every bracket, and the speed-up item doubles both. With neither Left nor Right held, or while unk2A counts down (a 30-frame timer set when the player slips off a steep slope, in the atlas's reading), Player_HandleGroundMovement takes a fixed 8 a frame off the speed toward 0. Sonic 1's rates are $C (12) to accelerate, the same $C for the friction, and $80 (128) against the motion. | src/game/shared/stage/player.c L4899–4902src/game/shared/stage/player.c L9107–9120src/game/shared/stage/player.c L552–553src/game/shared/stage/player.c L9926–9927src/game/shared/stage/player.c L4907–4910src/game/shared/stage/player.c L4429–4437src/game/shared/stage/player.c L6652–6658src/game/shared/stage/player.c L8965–8975src/game/shared/stage/player.c L8984–8994src/game/shared/stage/player.c L9063–9074src/game/shared/stage/player.c L118–127 | Code |
Outside boost mode Player_ApplyBoostPhysics sets topSpeed, the speed holding forward builds to in Player_HandleGroundMovement, to 6 px/frame (Q(6.0)), Sonic 1's son_maxspeed ($600). A faster speed, from a slope, is cut only at maxSpeed, by sub_8023260, which the ground state (Player_Idle) calls after adding the slope term: 9 px/frame, or 15 while MOVESTATE_SPIN_ATTACK is set, as a spin dash sets it. | src/game/shared/stage/player.c L9912–9924src/game/shared/stage/player.c L8974–8979src/game/shared/stage/player.c L6658–6669src/game/shared/stage/player.c L3383–3388src/game/shared/stage/player.c L7190 | Code |
Boost mode starts from a run held at the top speed. Holding forward on the ground at 6 px/frame or faster, Player_HandleGroundMovement leaves the speed as it is and adds the frame's acceleration to boostSpeed, in the branch where Sonic 2's Sonic_MoveRight keeps a speed above the top and Sonic 1's cuts it back to the top. At the start of each frame Player_HandleBoostState turns boost mode on once boostSpeed reaches the ring bracket's entry in playerBoostThresholdTable: Q(8) (2048) with 10 rings or fewer, 2040 with 11 to 49, 1680 with 50 to 99, 1440 with 100 to 149, and 1080 with 150 or more. In the air or below the top speed it sets boostSpeed back to 0. With each bracket's acceleration that is 256, 170, 120, 90, and 60 frames of holding forward at the top speed, and half as many with the speed-up item (computed). | src/game/shared/stage/player.c L8972–8982src/game/shared/stage/player.c L9009–9019src/game/shared/stage/player.c L556src/game/shared/stage/player.c L4899–4902src/game/shared/stage/player.c L9122–9150src/game/shared/stage/player.c L552–553src/game/shared/stage/player.c L4429–4437 | Code |
In boost mode Player_ApplyBoostPhysics raises topSpeed, the speed holding forward builds to, from 6 to 12 px/frame, twice Sonic 1's single top speed (son_maxspeed, $600; computed), and maxSpeed, the ground cap, to 15; the acceleration still follows the ring count. Player_HandleBoostState looks for the end of boost mode only on the ground, where a ground speed below 4.5 px/frame ends it. Among the other ends are a hit (Player_InitHurt), the start of Tails's or Cream's flight, a multiplayer finish, the special stage transition, and InitializePlayer. | src/game/shared/stage/player.c L9912–9927src/game/shared/stage/player.c L9122–9133src/game/shared/stage/player.c L7856–7859src/game/sa2/stage/player_callbacks.c L893–905src/game/sa2/stage/player_callbacks.c L632–644src/game/shared/stage/player.c L8193–8230src/game/shared/stage/player.c L10050–10057src/game/shared/stage/player.c L976–1063 | Code |
Player_InitJump, which doesn't test the character, adds PLAYER_JUMP_HEIGHT, 4.875 px/frame (2.625 in water), to the speed along the ground's normal (rotation - 64). Sonic 1's Sonic_Jump adds son_jumpspeed, $680 (6.5 px/frame), along the normal the same way, so Sonic Advance 2's take-off is three quarters of it (computed). | include/game/shared/parameters/characters.h L23–24src/game/shared/stage/player.c L6939–7004 | Code |
Each frame of a jump, button held or not, Player_Jumping adds PLAYER_GRAVITY, 42/256 px/frame² (12/256 in water), to the vertical speed through PLAYERFN_UPDATE_AIR_FALL_SPEED, except on a frame where Sonic's forward thrust or a mid-air move starts (Player_Sonic_TryForwardThrust, Player_TryMidAirAction): Player_Jumping returns before the gravity then. That is three quarters of the gravity Sonic 1's airborne-rolling mode, Sonic_MdJump2, adds through ObjectFall, $38 (56/256) a frame (computed). | include/game/shared/parameters/characters.h L18–19src/game/shared/stage/player.c L200–207src/game/shared/stage/player.c L7017–7021src/game/shared/stage/player.c L7039–7042 | Code |
In a jump (MOVESTATE_100, which Player_InitJump sets), on any frame the jump button isn't held, Player_Jumping cuts a rise faster than 3 px/frame to exactly −3 (PLAYER_MAX_NOT_HELD_JUMP_FORCE; −1.5 in water). Outside the Collect Rings multiplayer mode it first tries Sonic's forward thrust and the mid-air moves (Player_Sonic_TryForwardThrust, Player_TryMidAirAction), and a frame on which one starts skips the cap. Sonic 1's Sonic_JumpHeight cuts to 4 px/frame (-$400), so this cap too is three quarters of Sonic 1's (computed). | include/game/shared/parameters/characters.h L28–29src/game/shared/stage/player.c L6965src/game/shared/stage/player.c L7006–7027 | Code |
While the spin dash charges, each jump press adds Q(2.0) (512) to qSpindashAccel and then raises it to at least Q(8.0) (2048) with MAX, so one press is a full charge, the starting press included: Player_TryInitSpindash runs Player_InitSpindash and then Player_Spindash in the same frame. Each frame Down stays held first takes 1/32 off the charge. Releasing Down sets the ground speed from sSpinDashSpeeds at the charge's whole part, capped at 8: 6 px/frame plus 3/8 a step, up to 9, so a release on the frame after a press always gives 9 px/frame (computed). In Sonic 2 the starting press sets spindash_counter to 0, and each later press adds $200 up to a cap of $800, so a full charge takes five presses in all (computed); its release speeds run from 8 to 12 px/frame. | src/game/shared/stage/player.c L9898–9904src/game/shared/stage/player.c L7186–7203src/game/shared/stage/player.c L7212–7225src/game/shared/stage/player.c L7230–7249src/game/shared/stage/player.c L558–567 | Code |