SPG:Special Abilities

From Sonic Retro

Sonic Physics Guide


  • The research applies to all four of the Sega Mega Drive games and Sonic CD.
  • For moves specific to characters like dropdash, peelout, flying, and gliding, these are detailed in Characters.

Spindash (Sonic 2, 3, & K)

spinrev: the amount a spindash has been charged

When you first begin the Spindash, spinrev is set to 0. With every press of the button, spinrev is increased by 2, up to a maximum of 8. Furthermore, during the entire time the Spindash is charging, spinrev is being affected by the following calculation:

spinrev -= ((p div 0.125) / 256)   // "div" is division ignoring any remainder

This is exactly like the air drag calculation.

What this means is that the higher spinrev is, the faster it bleeds away toward zero.

When you release the Down button, the character launches forward at a speed of 8, plus floor(spinrev) - i.e. spinrev minus its fractional part (everything after the decimal point) - divided by 2.

Ground Speed = 8 + (floor(spinrev) / 2)   // this would be negative if the character were facing left, of course

Because the higher spinrev is, the faster it depletes, it is nearly impossible to get maximum thrust from a Spindash without the aid of a Turbo controller or frame-by-frame play. However, if you were able to, the highest speed achievable through the Spindash is 12.

Note: Water has no effect on the release speed.

Spindash (Sonic CD)

The Sonic CD style Spindash is much simpler. Many Sonic players may find it inferior to the Sonic 2 style, though, so you may not want to use it in your engine. Or, if you do, you might include a choice in the control options which one to use.

Once the button is pressed, Sonic will begin charging the Spindash. After 45 steps have passed, he is ready to go. When the Down button is released, Sonic launches at a speed of 12. If the Down button is released early, nothing happens.

Shield Abilities (Sonic 3 & K)

Flame Shield

When Sonic does the Flame Shield special move, his X speed is set to 8 in the direction he is facing, and his Y speed is set to 0, regardless of their previous values.

Bubble Shield

// constants
down_force: 8
bounce_force: 7.5

When Sonic does the Bubble Shield bounce, his X Speed is set to 0, and his Y speed to down_force.

When he rebounds from the ground, bounce_force is subtracted from X Speed and Y Speed, using cos() and sin() to get the right values.

 X Speed -= bounce_force * sin(Ground Angle)
 Y Speed -= bounce_force * cos(Ground Angle)


  • On steep slopes, the bubble shield is unlikely to bounce at the right angle. That's because this bounce happens AFTER Sonic lands and has calculated his new Ground Speeds and new X Speed and Y Speed from landing on the ground. On steep slopes, this landing Y Speed is likely to be high (downwards), effectively cancelling out a lot of the bounce Y Speed.

Electric Shield

When Sonic does the Electric Shield jump, his X Speed is unaffected, but his Y Speed is set to -5.5 regardless of its previous value.

Note: All of the Shield abilities can only be performed once in the air. Sonic must connect with the ground before he can perform them again.

Ring Magnetisation

When Sonic has an Electric shield, nearby rings will become mobile and begin moving towards him in a unique way.

If a ring falls within a radius of approximately 64px around Sonic's position, they will become Magnetised and begin to move. When Magnetised, the rings have an X and Y speed and do not collide with anything (except for Sonic). In order to move correctly, we have to calculate how fast to move the ring, and in what direction to accelerate. The ring accelerates at 2 different rates depending on its relative position and speed, 0.1875 when already moving towards Sonic (in order to not pass him too quickly), and 0.75 when not (in order to quickly catch back up with him).

First, it does a check to see where Sonic is in relativity horizontally.

If Sonic is to the left of the ring:

 If the ring's X Speed is less than 0, add -0.1875 to the ring's X Speed.
 Otherwise, add -0.75 to the ring's X Speed.

If Sonic is to the right of the ring:

 If the ring's X Speed is greater than 0, add 0.1875 to the ring's X Speed.
 Otherwise, add 0.75 to the ring's X Speed.

Then, the attracted ring checks Sonic's relativity vertically.

If Sonic is above the ring:

 If the ring's Y Speed is less than 0, add -0.1875 to the ring's Y Speed.
 Otherwise, add -0.75 to the ring's Y Speed.

If Sonic is below the ring:

 If the ring's Y Speed is greater than 0, add 0.1875 to the ring's Y Speed.
 Otherwise, add 0.75 to the ring's Y Speed.

The ring's X and Y Speeds are added to the ring's X and Y Positions, moving the ring.

Here's some example code for the ring while magnetised

if (magnetised)
	//relative positions
	sx = sign(Sonic's X Position - X Position)
	sy = sign(Sonic's Y Position - Y Position)
	//check relative movement
	tx = (sign(Ring's X Speed) == sx)
	ty = (sign(Ring's Y Speed) == sy)
	//add to speed
	X Speed += (ringacceleration[tx] * sx)
	Y Speed += (ringacceleration[ty] * sy)
	//"ringacceleration" would be an array, where: [0] = 0.75 [1] = 0.1875
	X Position += X Speed
	Y Position += Y Speed