A_JumpIfTargetCloser
From DoomWiki.org
A_JumpIfTargetCloser(state, distance) is a monster function that is part of the MBF21 specification. It jumps the calling actor to a specified state if the distance to its target falls below a specific value. It has two parameters, using the values in the Args fields as arguments.
The first argument determines the state that the actor will jump to, using the index number of the frame. The second argument sets the lowest distance to the target in map units which will not trigger a jump. Therefore, a jump only occurs if the distance falls below the value specified as the second argument. The distance has to be passed to the function in fixed point, meaning the intended value has to be multiplied by 65536 (FRACUNIT).
Example[edit]
The following is an example of how to set the A_JumpIfTargetCloser code pointer in a DeHackEd file using BEX syntax:
Frame 1234 Args1 = 420 Args2 = 4521984 [CODEPTR] FRAME 1234 = JumpIfTargetCloser
Or using DECOHack syntax:
state 1234
{
TNT1 A 1 A_JumpIfTargetCloser(420, 69.0)
}
In the above example A_JumpIfTargetCloser will jump the calling actor to state 420 if the distance to its target is 68.0 map units or less.
External links[edit]
- A_JumpIfTargetCloser in the DSDA-Doom source code, hosted on GitHub.
- MBF21 specification, hosted on GitHub.
