Enemy

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is outdated and has not been fully updated to reflect the current version of SRB2.

Please help the Wiki by correcting or removing any misinformation, as well as adding any new information to the page.


A few of SRB2's various enemies

In SRB2, enemies (or badniks) are special Objects with artificial intelligence that appear frequently in most Single Player levels. As in most Sonic games, these are generally robots created by Dr. Eggman, the game's main villain. They will normally harm the player on direct contact, or even kill them if they have no rings. However, if the player jumps on an enemy or spins into it, the enemy is destroyed, points are awarded to the player, and a flicky trapped inside the enemy will be freed. In rare cases, enemies will take multiple hits to destroy rather than one.

Players can also destroy enemies by firing projectiles at them, exploding an Armageddon Shield within range of them, or coming into direct contact with them while invincible. Enemies can also be destroyed if they are crushed by moving floors/ceilings or solid Objects, or by coming into contact with death pits; however, no points are awarded to anyone in either case. On the other hand, they are unaffected by any sectors with damaging floors/ceilings nor Instant Kill.

Enemies also have the ability to trigger linedef executors via linedef type 313, a trigger linedef specially designed to activate linedef executors once there are no more enemies in the specified area – i.e. it will not trigger until all enemies in the area have been destroyed or have left the area.

Enemies in SRB2

Greenflower Zone

Techno Hill Zone

Deep Sea Zone

Castle Eggman Zone/Forest Fortress Zone

  • Thing type 117: Robo-Hood
  • Thing type 118: Lance-a-Bot – A special type of enemy that takes two hits to destroy rather than one
  • Thing type 119: Egg Guard – This enemy is equipped with a massive shield protecting its front and so must be attacked from behind to destroy

Arid Canyon Zone

Red Volcano Zone

Egg Rock Zone

Note: The disco room in Act 2 contains numerous enemies found in prior zones.

Frozen Hillside Zone

Pipe Towers Zone

Techno Legacy Zone

  • Thing type 107: Crawla Commander – Another enemy that takes two hits to destroy

Note: Techno Legacy Zone also contains both variants of the Buzz, as well as Detons.

Haunted Heights Zone

Aerial Garden Zone

Azure Temple Zone

Unused

Note that the Turret and King Bowser are not actual enemy Objects unlike the above, and both cannot be destroyed by normal means.

Score chains

When an enemy is destroyed, 100 points are awarded to the player who did so. If the player manages to destroy multiple enemies in one move, more points are awarded per enemy. The most typical way of doing this is through bouncing off multiple enemies after a single jump, a technique known as "Crawla bouncing". The score chain is broken if the player touches the ground or is climbing a wall (except when invincibility is in effect), resetting the points awarded to 100 each.

Number of enemies Point value per enemy
1 100
2 200
3 500
4–14 1,000
15 and above 10,000

Custom enemies

It is possible to make custom enemies for SRB2 with the use of SOCs and/or Lua. To make an Object behave like and be recognised as an enemy, it needs to be given the MF_ENEMY flag. However, MF_SPECIAL and MF_SHOOTABLE are generally also needed as well; MF_SPECIAL enables the player to bounce on and be harmed by the enemy Object, and MF_SHOOTABLE allows the Object to be harmed/killed by something, whether or not it is the player. Egg Guard and Minus in particular manipulate these two flags to allow them to be untouchable temporarily.

The only Object properties that affect all enemy behavior are:

  • PainState: This is used when an enemy has been hit and still has health points left; this is generally not needed as most enemies have only 1 health point
  • DeathState: This is used when an enemy has been hit and has no health left; in general this is set to S_XPLD1 for the enemy explosion. For the enemy to be removed from the map after destruction, this should eventually lead to S_NULL

For multiple-hit enemies, a system to make them temporarily invincible for recovery may be needed to prevent multiple health points being lost from a single hit. This is not present by default however; the Crawla Commander's own recovery system is hardcoded to be used by itself only. Options to get around this can include removal of MF_SPECIAL and MF_SHOOTABLE in the pain animation for the reasons already stated above, or otherwise use of Lua if a pain animation is not wanted: for example, a combination of the Lua hooks "ShouldDamage" and "MobjDamage" (and perhaps "MobjThinker") along with a custom variable, explained here:

  • "MobjDamage", for handling what happens when the enemy is damaged; a custom variable can be set to an initial value here, to prevent further damage for a set time
  • "ShouldDamage", for deciding whether the enemy can be damaged or not; if the custom variable is not 0 yet, the enemy should not be harmed yet
  • "MobjThinker", for handling what happens otherwise every tic; the custom variable should be decreased by 1 each time here
  Object types [view]
General EnemyBossPushableSpringMonitorNiGHTS power-upProjectileAmbient sound effect
Special PlayerShieldsFlickiesOverlay
Related links List of Object types