A_FishJump

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.

To do
Update for 2.2.0:
  • Var2 sets some kind of trail object type to spawn now apparently, but only if there are players nearby

A_FishJump is an action that makes the actor jump up if it is on the ground or at least 64 fracunits below a water surface. It is recommended that this action be called every tic for it to work properly. In SRB2, this action is used by the SDURF and the Puma.

Usage

Jump strength

The strength of the actor's jump can be determined by this action in one of two ways:

  • If Var1 is set to 0, the actor's angle determines the strength of the actor's jump. Specifically, the jump strength is calculated as actor's angle ÷ 4; for example, an angle of 40° gives a jump strength of 10 fracunits/tic. Assuming the actor does not change its angle, via other actions or a thinker and so on, this means that the actor's jump strength can be controlled by the Angle value set for its map Thing when placed in a map editor. This method of setting the jump strength is used by both the SDURF and Puma.
  • If Var1 is a value other than 0, Var1 itself determines the strength of the actor's jump. Var1's value is treated as a fixed-point number, so the jump strength you want (in fracunits/tic) should be multiplied by FRACUNIT.

If the actor's Var1 and angle are both 0, it uses a default jump strength of 11 fracunits/tic; this is equivalent to a Var1 value of 11*FRACUNIT, or an angle of 44°.

Note: The jump strength is scaled with the actor's scale, unless it is determined by Var1. In this case, the actor's jump will have the same strength regardless of the actor's scale.

State animation

The actor's displayed animation is also controlled by this action, depending on its point in the jump; the actor's SeeState should be set to the first state of the actor's jumping up animation, the actor's MeleeState should be set to the first state of the actor's falling down animation, and the actor's XDeathState should be set to the last state in the falling down animation (if the actor has only one falling down state, MeleeState and XDeathState should have the same value). This means that that every time the actor starts a jump, the actor will change its state to SeeState. If the actor is instead falling down, this action checks if the actor's current state ID is between MeleeState and XDeathState, and switches its state back to MeleeState if it is outside of this state range. Note that this action will not call the actions of either SeeState or MeleeState.

Object property Use
SeeState The actor's jumping up state; The actor changes its state to this value each time it jumps
MeleeState First state of actor's falling down animation; If the actor is falling and current state ID number < MeleeState, the actor changes its state to MeleeState
XDeathState Last state of actor's falling down animation; If the actor is falling and current state ID number > XDeathState, the actor changes its state to MeleeState

  Actions – Movement [view]
A_BubbleRiseA_BunnyHopA_CapeChaseA_ChaseA_FishJumpA_ForceStopA_HomingChaseA_InstaLoopA_KnockBackA_MouseThinkA_MoveAbsoluteA_MoveRelativeA_PushAwayA_ScoreRiseA_SkullAttackA_ThrustA_ZThrust