SPG:Ring Loss
From Sonic Retro
Sonic Physics Guide 


Collision 

Physics 

Gameplay 
Presentation 
Special 
Notes:
 The research applies to all four of the Sega Mega Drive games and Sonic CD.
Ring Limit
When Sonic gets hit, the number of rings he is carrying scatter away, unless he is carrying more than 32, in which case any rings over 32 are ignored. Sonic is therefore no safer carrying 100 rings than 32.
Ring Distribution
The rings that scatter away from Sonic are distributed in a specific pattern of 2 concentric circles, each containing a maximum of 16 rings. The rings in the first circle move outward faster than the rings in the second. Here is a formula for creating the rings, which can be converted into the programming language of your choice:
let ring_counter = 0 let ring_angle = 101.25° (184) ($B8) // assuming 0=right, 90=up, 180=left, 270=down let flip = false let speed = 4 // perform loop while the ring counter is less than number of lost rings while ring_counter < number of rings (max 32) { // create the ring create a bouncing ring object at the Player's X and Y Position ring's X Speed = cosine(ring_angle) * speed ring's Y Speed = sine(ring_angle) * speed // ever ring created will moving be at the same angle as the other in the current pair, but flipped the other side of the circle if flip == true { ring's X Speed = ring's X Speed * 1 // reverse ring's x speed ring_angle += 22.5° (240) ($F0) // we increment angle on every other ring which makes 2 even rings either side } // toggle flip flip = !flip // if flip is false, flip becomes true and vice versa // increment counter ring_counter += 1 // if we are halfway, start second "circle" of rings with lower speed if ring_counter == 16 { speed = 2 ring_angle = 101.25° (184) ($B8) // reset the angle } }
So, the first 16 rings move at a velocity of 4 pixels per step, and the second 16 move at half that rate, or 2 pixels per step.
Regathering Rings
64 steps must have passed since Sonic was hit before he can regather any rings, scattered or otherwise.
Invulnerability
Sonic remains invulnerable for a short time after being hit. This invulnerability lasts while Sonic is flying back from the blow, and then 120 steps more after he recovers movement. During those 120 steps, he flashes on and off, spending 4 steps on and 4 steps off.
While in this state, Sonic can not collect level rings until less than 90 invulnerability steps remain.
Ring Depth
All rings, scattered or fixed, have a higher depth than Sonic, i.e. behind him. But they have a lower depth, i.e. in front of him, when they turn into sparkles.