An overview of physics in Sonic games. Parts 7 and 8: springs and gizmos, super speeds
- Transfer

Continuation of the series of articles on physics in games about Sonic. This post discusses the repulsion of characters from various game objects and their superpowers.
Links to other parts of the series:
Part 1: solid tiles
Part 2: running
Parts 3 and 4: jumping and spinning
Parts 5 and 6: losing rings and being under water
Part 7: springs and gizmos
- 1 Spring pads
- 2 balloons
- 3 Bumpers
- 4 guns
- 5 Covers with springs
- 6 turntables
- 7 Lifts in the sky
- 8 Mushrooms
- 9 Destruction of the walls
- 10 Destructible blocks and stones
Spring pads The
red spring pads give Sonic a speed of 16, and the yellow ones give a speed of 10. Depending on the direction of the pad (up or down), the value is negative or positive, and accordingly the speed along the Y axis is given this value. If the spring pad is directed left or right, the speed value is negative or positive, respectively, the speed along the X axis is equal to this value. Vertical pads do not affect X speed, just as horizontal pads do not affect Y speed.

Diagonal spring pads
Sonic the Hedgehog (16-bit) does not have diagonal spring pads. However, they are in Sonic 2 (16-bit), 3, Knuckles and CD. In Sonic 2, 3 and Knuckles they work the same, but in Sonic CD the principle is different.
in Sonic 2, 3 and Knuckles, the diagonal spring sets the speeds X and Y to the value of the spring pad with the corresponding sign. Therefore, an up-right spring gives a speed of Y equal to -16 and a speed of X equal to 16. The problem with this method is that technically Sonic pushes off diagonally faster than horizontally or vertically. This is because the developers did not take into account cosines and sines.
In Sonic CD, they are fixed. It is convenient that the absolute values of the sine and cosine of the angle of 45 degrees are the same, so only one value is required. The speed becomes 11.3125 for red springs and 7.0703125 for yellow.
Horizontal control lock
When Sonic bounces from a horizontal spring (red or yellow), he cannot slow down or otherwise influence his speed X for 16 cycles. The engine achieves this by setting the same horizontal control lock as when rolling down steep slopes (in S3 and Knuckles, bytes $ 32-33 are a table of player object states). Why block horizontal control? In a collision with a spring, the player most likely pushes the cross in the direction of the spring, and this can lead to Sonic pushing away in the braking animation. Temporarily ignoring input is a quick and elegant solution.
Animation
In the case of a spring pad pointing up, when Sonic loses all the speed pointing up, he goes into the walking animation. The frames of this animation change every 8 cycles.
In the case of any of the diagonal spring pads, Sonic does not go over animation of walking in the air at all. It saves the animation of the “corkscrew” (three-dimensional rotation), the frames of which change every 5.5 cycles.
Balloons
When Sonic collides with balloons at the Carnival Night Zone levels, its speed Y is set to -7, regardless of the angle of collision. Speed X does not change.

Bumpers The
bumpers in the Spring Yard Zone give Sonic a speed of X equal to 7 * cos (p) and a speed of Y 7 * -sin (p), where p is the angle between the centers of the bumper and Sonic. The speed is set regardless of the speed of Sonic before a collision with the bumper.

Guns
Guns in the Carnival Night Zone give Sonic a horizontal speed of 16 * cos (p), and a vertical speed of 16 * -sin (p), where p is the angle of the gun.

Covers with springs The
red caps with springs that close the pipes in the Chemical Plant Zone work like spring pads, but slightly stronger than the yellow pads. In a collision, they give Sonic a Y speed of -10.5.

Turntables The
black turntables that propel the hedgehog forward in the Chemical Plant Zone set the speed of X to 16. However, they do not slow it down if it is already moving faster.
Elevators in the sky
Elevators in the sky at the Hill Top Zone levels move at a speed of X equal to 2 and a speed of Y equal to 1.

Mushrooms
Mushrooms in the Mushroom Hill Zone work like spring pads, however each subsequent bounce becomes higher than the previous one (up to three bounces). The first rebound gives the speed Y -6.5, the second -7.5, and the third -8.5.

Destruction of walls
In Sonic 1, 2, 3 and Knuckles, to break through the walls to be destroyed during rotation, the absolute speed X of the character must exceed 4.5 (except for the Knuckles character, who crumbles walls in a collision, and does not need to rotate). Collisions with such walls do not affect the speed of X.
However, when Knuckles destroys the walls in Sonic 3 and Knuckles, despite the fact that his speed X does not change, he does not move in the frame in which he hits the wall. The same is true for Sonic breaking through a wall while spinning in Sonic 3 and Knuckles.
In Sonic CD, X speed limit removed. Sonic can pierce destructible walls by simply jumping next to them or spinning at any speed.
Destructible blocks and stones
When Sonic jumps onto destructible objects, such as stones in the Hill Top Zone, blocks in the Marble Zone or pipe covers in the Chemical Plant Zone, he bounces off them at a speed of -3. Speed X does not change.

Part 8: super speeds
- 1 Super fast boots
- 2 Super / Hypersonic
- 3 Super Tails, Super / Hypernacks
- 4 Ring selection
- 5 notes
Super-fast shoes
Translator's Note: superfast shoes (Super Fast Shoes) - This bonus increase speed for 20 seconds and increases the acceleration and top speed of Sonic. Knocked out of these monitors:

| Variable | Value |
|---|---|
| Acceleration | 0.09375 |
| Braking | 0.5 (does not change) |
| Friction | 0.09375 |
| Top speed | 12 |
| Air acceleration | 0.1875 |
| Rotation friction | 0.046875 |
| Rotation braking | 0.125 (does not change) |
Note : if Sonic falls into the water, all the effects of Super Fast Shoes are reset to zero. Underwater variables completely replace them. If you jump out of the water, the effect of superfast boots will not return. This seems to apply to all 5 games.
In Sonic 3 and Knuckles, the tempo of the musical composition is increased 1.25 times.
Super / Hypersonic Translator's
Note: Super Sonic is the superform of Sonic the Hedgehog. This form of Sonic was first used in the game Sonic the Hedgehog 2 and was then implemented in various volumes in each main Sonic game. You can turn into Supersonic by collecting all seven Chaos Emeralds, finding at least 50 rings and losing all protection. Having made a double jump, Sonic becomes a yellow Supersonic, this is a faster and almost invulnerable form of Sonic. However, rings are spent on maintaining this form (see below).

In Sonic 3 and Knuckles games, after collecting all the Chaos Emeralds at special levels, you can collect seven Super Emeralds, and then turn into a character Hyperform. She also spends the collected rings. In this mode, the character can make directed double jumps, destroy all opponents on the screen and is not able to drown, unlike superforms.


Variables refer to Supersonic in Sonic 2 and Super- or Hypersonic in Sonic 3 and Knuckles, with the exception of the noted variable.
| Variable | Value | Value (underwater) |
|---|---|---|
| Acceleration | 0.1875 | 0.09375 |
| Braking | 1 | 0.5 |
| Friction | 0.046875 (not changed) | 0.046875 (not changed) |
| Top speed | 10 | 5 |
| Air acceleration | 0.375 | 0.1875 |
| Jump start speed | 8 | 3.5 (does not change) |
| Jump speed when releasing a button | 4 (does not change) | 2 (does not change) |
| Rotation friction | 0.09375 (0.0234375 in Sonic 3 and Knuckles) | 0.046875 (0.0234375 in Sonic 3 and Knuckles) |
| Rotation braking | 0.125 (does not change) | 0.125 (does not change) |
Hyper Blast (Hypersonic only)
When a player presses the air jump button a second time, Sonic's X-axis speed is equal to 8 if he is looking to the right and -8 if he is to the left, and the speed along the Y-axis is reset. If the player holds “up” on the crosspiece when pressing the button, then Sonic's speed along the Y axis is equal to -8, and along the X axis it is reset.
SuperTails, Super / Hypernacks
| Variable | Value | Value (underwater) |
|---|---|---|
| Acceleration | 0.09375 | 0.046875 |
| Braking | 0.75 | 0.375 |
| Friction | 0.046875 (not changed) | 0.046875 (not changed) |
| Top speed | 8 | 4 |
| Air acceleration | 0.1875 | 0.09375 |
| Jump start speed | (does not change) | (does not change) |
| Jump speed when releasing a button | (does not change) | (does not change) |
| Rotation friction | 0.0234375 | 0.0234375 |
| Rotation braking | 0.125 (does not change) | 0.125 (does not change) |
| Climb Speed (Knuckles only) | 2 | 2 |
| Initial slip speed (Knuckles only) | 4 (does not change) | 4 (does not change) |
| Glide Acceleration (Knuckles only) | 0.046875 | 0.046875 |
Wall Quake (Hypernakles only)
For Knuckles to shake the screen and destroy all enemies in contact with the wall, it must glide at a speed of 4.5 pixels per cycle or higher.
Ring selection
While in Super / Hyper mode, the character loses one ring every 60 cycles, or once every 1 second.
Notes
If Super / Hyper character gets super fast boots by breaking the monitor, super fast boot variables replace Super / Hyper mode variables, actually slowing the character down (however, the maximum speed remains slightly higher). This may not be desirable in your own engine.
When Super / Hyper character falls into water, it uses the above variables. However, if they become Super / Hyper already underwater, the Super / Hyper mode variables become as if it is not under water. This is a bug and should be avoided in your engine.
PS again for the attentive and curious readers. Here the first encrypted word ends. Words do not apply to the Sonic universe, but deciphering requires her knowledge (however, by google it is quite possible to get by).
