A_JumpIf

From ZDoom Wiki
Jump to navigation Jump to search

state A_JumpIf (expression, int offset)
state A_JumpIf (expression, str "state")

Note: Jump functions perform differently inside of anonymous functions.

Jumps offset amount of states forward, or to the state label state, if expression evaluates to true. See DECORATE expressions for more information on expressions.

Examples

Example of a projectile that “fizzles out” if it enters water:

actor FizzleBall : DoomImpBall
{  
  states
  {
  Spawn:
    BAL1 AB 4 bright
    BAL1 A 0 A_JumpIf(waterlevel == 2, "DeepWater")
    loop
  DeepWater:
    BAL1 A 0 A_PlaySound("Fizzle")
    FIZZ ABC 6
    stop
  }
}