Spring

From SRB2 Wiki
Jump to navigation Jump to search

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.

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: If set to 0, the player will change to their falling animation after bouncing on a spring (which is the default behavior as seen with SRB2's springs). If set to any other value, the player will change to their jumping animation, able to perform any aerial actions they would be able to perform if they jumped, such as their special ability.
  • 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