Actions

SPG:Springs and Things

From Sonic Retro

Springboards

Red springboards propel Sonic at a speed of 16, and yellow springboards at a speed of 10. If the springboard faces up or down, the value is either negative or positive, respectively, and Y speed is set to it. If the springboard faces left or right, the value is either negative or positive, respectively, and X speed is set to it. Vertical springboards don't affect X speed and likewise horizontal springboards don't affect Y speed.

Diagonal Springboards

There are no diagonal springboards in Sonic the Hedgehog (16-bit). But there are in Sonic 2 (16-bit), 3, K, and CD. Sonic 2, 3, and K work the same way, but Sonic CD is different.

In Sonic 2, 3, and K, a diagonal spring sets both X speed and Y speed to the springboard's value, with the appropriate sign. So a red springboard facing up and to the right sets Y speed to -16 and X speed to 16. The trouble with this method is that Sonic is technically bounced faster diagonally than horizontally or vertically. This is because they didn't bother to calculate the sine functions.

In Sonic CD, they do however. Conveniently, the absolute sine and cosine of a 45 degree angle are the same, so you only need one value. It comes out to 11.3125 for Red springs and 7.0703125 for Yellow ones.

Horizontal Control Lock

When Sonic bounces away from a horizontal springboard (red or yellow), he cannot brake or otherwise affect his X speed for 16 steps. The engine achieves this by setting the same horizontal control lock as when sliding back down steep inclines (in S3&K, bytes $32-33 in the player object's status table). Why lock the horizontal controls? The player is likely to be pressing in the direction of the springboard as they run into it, and this would cause Sonic to bounce away in his braking animation. Temporarily ignoring input is a quick and elegant solution.

Animation

For the "up" springboard, when Sonic loses all his upward velocity, he changes into his walking animation. This animation waits 8 steps before advancing a frame.

For all of the diagonal springboards, Sonic doesnt change to the walking animation in the air at all. Instead, he remains in the corkscrew (3D spinning) animation, this animation waits 5.5 steps before advancing a frame.

Balloons

The balloons in Carnival Night Zone set Y speed to -7 when Sonic collides with them, no matter what his angle of collision. X speed is not affected.

Bumpers

The bumpers in Spring Yard Zone set Sonic's X speed to 7*cosine(p), and Y speed to 7*-sine(p), where p is the angle measured from the bumper's centre to Sonic's. This is regardless of Sonic's velocity when he hits the bumper.

Cannons

The cannons in Carnival Night Zone set Sonic's X speed to 16*cosine(p), and Y speed to 16*-sine(p), where p is the angle of the cannon.

Spring Caps

The red spring caps that cover the tubes in Chemical Plant Zone work like springboards, but are slightly stronger than a Yellow springboard. They set Sonic's Y speed to -10.5 upon collision.

Spinners

The black spinners that impel you forward in Chemical Plant Zone set X speed to 16. They don't seem to slow you down if you're already moving faster than that, though.

Ski Lifts

The ski lifts in Hill Top Zone move with an X speed of 2, and a Y speed of 1.

Mushrooms

The mushrooms in Mushroom Hill Zone work just like springboards, only each successive bounce is higher than the last, up to three bounces. The first bounce sets Y speed to -6.5, the second, -7.5, and the third, -8.5.

Breaking Walls

In Sonic 1, 2, 3, & K, the character's absolute X speed must exceed 4.5 in order to break through destructible walls when rolling (except for Knuckles, who busts walls on contact, and doesn't need to be rolled up). X speed is unaffected by the collision, as well.

However, when Knuckles breaks walls in Sonic 3 & Knuckles, though his X speed is unaffected, he doesn't move during the frame in which he hits the wall. The same thing is true when Sonic spindashes through a wall in Sonic 3 & Knuckles.

In Sonic CD, the X speed threshold is removed. Sonic can break through destructible walls by simply jumping near them, or rolling into them at any speed.

Breakable Blocks and Rocks

When Sonic jumps on top of breakable objects, such as the rocks in Hill Top Zone, blocks in Marble Zone, or the tube caps in Chemical Plant Zone, he bounces away with a Y speed of -3. X speed is unaffected.