From SRB2 Wiki
Jump to navigation Jump to search

A_JetJawRoam is an action which is used as the movement thinker for the Jet Jaw. It makes the actor roam back and forth until it finds a player, at which point it switches into the SeeState. Together with the attack thinker A_JetJawChomp, this action forms the AI for the Jet Jaw.

The actor's reaction time is used as the timer for the movement. At the beginning, it is equal to the Object's ReactionTime attribute (which is 140 for the Jet Jaw). Each time the action is performed, it is reduced by one and the actor dashes forward with a speed defined by the Object's Speed attribute (Speed*FRACUNIT/4). Because the Jet Jaw is not affected by gravity, it will simply move forward in the air or water, but if an actor that is affected by gravity is used, it will be simultaneously pulled down by gravity while dashing forward.

At the same time, the actor checks if a player is within seeing distance. The seeing distance is the Object's Radius attribute multiplied by 16, resulting in a radius of 192 fracunits for the Jet Jaw. If a player is within that distance, the actor switches into its SeeState. For the Jet Jaw, this means that is switches into attack mode.

If no player is found and the the reaction time reaches 0, the actor turns around by 180 degrees and the reaction time is reset, starting the whole movement process over. This makes the actor move back and forth until it spots the player, with the ReactionTime attribute controlling how many times the action is performed before the actor turns around.

Object property Use
SeeState Goes to this state when a player is spotted
Speed Sets how fast the actor moves (Speed*FRACUNIT/4)
ReactionTime Sets how often the action may be called until the actor turns by 180° and starts over
Radius Sets the actor's seeing distance limit (Radius×16)

  Actions – Enemy thinkers [view]