Reverse gravity tutorial

From SRB2 Wiki
Jump to navigation Jump to search

This tutorial explains how to make sectors that flip the player's gravity direction, as seen in Egg Rock Zone. There are two types of reverse gravity: Sector-based reverse gravity only affects the player as long as they stay in a specific sector. Once the player leaves the sector, gravity is restored back to normal. Player-based reverse gravity persists even when the player leaves the sector that flipped them.

Sector-based reverse gravity

Create a new sector inside your map and give it an unused tag. Then, create a new control sector outside the map. Give one of its linedefs linedef type 1, Per-Sector Gravity, and tag it to the in-level sector. Check Flag [6] / Not Climbable to flip the player. The floor height of the control sector determines the strength of the gravity, with 1000 being regular gravity. Negative values produce reverse gravity. To create reverse gravity with regular strength, set the floor height to -1000.

Sample

Example file: ex_ld001_persectorgravity.wad (MAP01)
How to use
  • You may load this file into your favorite map editor, such as Zone Builder. Select MAP01 as the map to load.
  • You may also load this file in the game:
    1. Save ex_ld001_persectorgravity.wad into the addons folder of your SRB2 directory.
    2. Start SRB2, go to the Addons menu, and then select ex_ld001_persectorgravity.wad.
    3. Start the game in Single Player mode.
    4. Press the Console button (~), and type in the command MAP MAP01 to access the example map.
  • When you load this file in the game, it replaces Greenflower Zone Act 1.
  • The effect is applied to four sectors in this level. The yellow sector has normal gravity, the red sector has low (50%) gravity, the blue sector has reverse gravity, and the green sector is split in half with the use of an intangible, invisible FOF: The lower half of the sector has normal gravity, but the upper half has reverse gravity. The player can switch to reverse gravity by jumping and back to normal gravity by jumping again.

Player-based reverse gravity

This effect is achieved with linedef type 433, Enable/Disable Reverse Gravity. This linedef type can be used both to flip the player to reverse gravity and to flip them back.

Regular to reverse gravity

Create a new sector inside your map. Give it an unused tag and sector type 64, Trigger Linedef Executor (Anywhere in Sector). This sector will trigger the gravity change when the player enters any part of the sector. Then, create a new control sector outside the map. Give one of its linedefs linedef type 433, Enable/Disable Reverse Gravity. No tag needs to be given. Select another linedef on the same control sector. Give it linedef type 300, Trigger Linedef Executor – Continuous and tag it to the in-level sector. This activates the gravity flip once the trigger sector is activated.

Reverse to regular gravity

Create a new sector inside your map. Give it an unused tag and sector type 64, Trigger Linedef Executor (Anywhere in Sector). This sector will trigger the gravity change when the player enters any part of the sector. Then, create a new control sector outside the map. Give one of its linedefs linedef type 433, Enable/Disable Reverse Gravity. No tag needs to be given. Check Flag [6] / Not Climbable on the linedef. This changes the effect so that the player is flipped back to normal gravity. Select another linedef on the same control sector. Give it linedef type 300, Trigger Linedef Executor – Continuous and tag it to the in-level sector. This activates the gravity flip once the trigger sector is activated.

Visual effects

Egg Rock Zone uses middle textures on the gravity-changing sectors as visual markers. To do this, select the linedefs of the in-level sector, open the linedef properties window and add middle textures for both sidedefs.

  • For sectors that flip gravity from regular to reverse, use the texture UP3A, and check the Lower Unpegged flag to attach the texture to the floor.
  • For sectors that flip gravity from reverse to regular, use the texture DOWN3A, and uncheck the Lower Unpegged flag to attach the texture to the ceiling.

Sample

Example file: ex_ld433_enabledisablegravityflip.wad (MAP01)
How to use
  • You may load this file into your favorite map editor, such as Zone Builder. Select MAP01 as the map to load.
  • You may also load this file in the game:
    1. Save ex_ld433_enabledisablegravityflip.wad into the addons folder of your SRB2 directory.
    2. Start SRB2, go to the Addons menu, and then select ex_ld433_enabledisablegravityflip.wad.
    3. Start the game in Single Player mode.
    4. Press the Console button (~), and type in the command MAP MAP01 to access the example map.
  • When you load this file in the game, it replaces Greenflower Zone Act 1.