Jump to content

Spring

From SRB2 Wiki

Springs

Springs are common objects in Sonic games that propel the player upward and/or forward at a high speed. In SRB2, there are three types of springs that propel the player at different strengths; from low to high these are colored blue, yellow and red. Depending on the type of spring, they propel the player either upward (e.g. Yellow Spring), downward, diagonally upward and forward (e.g. Diagonal Yellow Spring) or diagonally downward and forward. As of SRB2 v2.2, horizontal springs have been introduced into the game; these propel the player forward (e.g., Horizontal Yellow Spring).

The height to which a spring can propel the player is impacted by two things: A player who is about 50 fracunits below a ledge will be automatically be pulled up to that ledge, increasing the practical height to which a vertical spring can propel the player. The pull-up effect increases with the player's speed, so the effect will be larger for stronger springs. Additionally, any object that is underwater and breaks the water surface will be given a speed boost that is proportional to their current speed. This means that underwater springs, especially stronger springs, will propel the player to a much larger height if they allow the player to break the water surface.

Apart from the player, pushable Objects such as the Gargoyle or Snowman can also be propelled by springs in the same manner. This is shown especially in Deep Sea Zone.

Springs in SRB2

All of the above types of springs (excluding horizontal springs) propel the player upwards by default; to place springs that propel the player downwards instead, simply turn on the Flip Thing flag when placing them in the map. Internally, a few other objects are also classified as "Springs" in order to launch players.

Spring Shells are similar to springs in that they use the SOC properties listed below in exactly the same fashion for exactly the same purpose, but they do not in fact have MF_SPRING set; only part of them acts like a spring to players/pushables, the rest acts like a standard enemy Object instead. However, the yellow versions will spawn yellow springs when destroyed.

Custom springs

It is possible to make custom springs for SRB2 with the use of SOCs or Lua. To make an Object behave like a spring, it needs to be given the MF_SPRING flag. The following Object properties control the spring's behavior:

  • RaiseState: The spring will go into this state when the player touches it. Springs that make a sound when touched should use an action that plays the appropriate sound in this state.
  • Mass: Indicates the vertical thrust of a spring. Negative values indicate downward thrust. To determine the Mass value that needs to be set in order to propel the player to a certain height, take the desired height in fracunits, take its square root and multiply it with the constant FRACUNIT (65536). For example, a spring with a Mass value of 16*FRACUNIT propels the player to a height of 256 fracunits.
  • Damage: Indicates the horizontal thrust of a spring. For purely vertical springs, leave this at zero.
  • PainChance: Decides the "mode" of the spring.
    • 0: Behaves like all other labelled "Spring" objects.
    • 1: Curls the player into their jump state when sprung. They can use all their abilities out of it.
    • 2: Whatever movement and animation state the player was previously in will be kept after being sprung, and the player will not be moved adjacent to the spring's hitbox.
    • 3: The Spring gains the properties of a boost panel. If this spring has MF2_AMBUSH, it will force the player into a roll. This spring type isn't meant to be used vertically, and the player will be sprung normally immediately after if this is the case. The decorative sprites surrounding boost panel objects in SRB2 is hardcoded behavior that cannot be directly applied to a custom object.
    • -1: This object behaves like a Bumper. Damage is ignored, and Mass and the object's spawned angle change the strength of the bumper.
  • ReactionTime: If set to a value greater than 0, using the spring will award the player 10 points. This will only happen a limited number of times per spring, determined by the value specified; afterwards, the spring will no longer award points.
  Object types [view]
General EnemyBossPushableSpringMonitorNiGHTS power-upProjectileAmbient sound effect
Special PlayerShieldsFlickiesOverlay
Related links List of Object types