Reverse gravity tutorial

From SRB2 Wiki
Jump to: navigation, 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 the Not Climbable flag 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 WAD: ex_ld001_persectorgravity.wad
  • This example WAD can be played in any gametype. It uses MAP01, replacing 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 the Not Climbable flag 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, click on the Sidedefs tab, 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 in the Properties tab.
  • For sectors that flip gravity from reverse to regular, use the texture DOWN3A, and uncheck the Lower Unpegged flag in the Properties tab.

Sample

Example WAD: ex_ld433_enabledisablegravityflip.wad