Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public class GripAbility
Ledge grab: falling past the top corner of a solid tile while holding toward
it, the actor catches the edge and hangs (MovementState.GRIPPING). Jump or
up climbs onto the ledge; down or away lets go. Hanging takes no stamina and
lasts until the player decides.
Only a corner with open space above it is gripped – the top of a wall, the
lip of a platform – never the middle of a wall, which WallJumpAbility
owns. Put grip after walljump and before jump in the ability list.
Fields
public int regrabTicks | Ticks after letting go before the same actor can grab again, so a drop is not caught by the corner it just left. |
public int reach | How far below the corner, fixed point, the actor’s head may be and still catch it: the reach of the hands. |
Constructors
public GripAbility() |
Methods
public boolean isGripping() | Whether the actor is hanging from a ledge. |
public void process(Actor c, PlatformWorld world) | Sets velocity and claims a MovementState. |
public void lateProcess(Actor c, PlatformWorld world) | Runs after the body moved, with the new contacts. |
public long hashState(long h) | Mixes the ability’s own state into a hash, so two runs that diverge inside an ability are caught. |
public void reset() | Forgets what the ability was in the middle of, when its actor respawns: a dash, a buffered jump or a grip does not outlive a death. |
Inherited methods
From Ability
Field details
regrabTicks
public int regrabTicksTicks after letting go before the same actor can grab again, so a drop
is not caught by the corner it just left.
reach
public int reachHow far below the corner, fixed point, the actor’s head may be and
still catch it: the reach of the hands.
Constructor details
GripAbility
public GripAbility()Method details
isGripping
public boolean isGripping()Whether the actor is hanging from a ledge.
Returns
true while gripping
process
public void process(Actor c, PlatformWorld world)Sets velocity and claims a
MovementState.Parameters
cActor- the actor
worldPlatformWorld- the world
lateProcess
public void lateProcess(Actor c, PlatformWorld world)Runs after the body moved, with the new contacts.
Parameters
cActor- the actor
worldPlatformWorld- the world
hashState
public long hashState(long h)Mixes the ability’s own state into a hash, so two runs that diverge inside
an ability are caught. The default mixes nothing.
Parameters
hlong- the running hash
Returns
the updated hash
reset
public void reset()Forgets what the ability was in the middle of, when its actor
respawns: a dash, a buffered jump or a grip does not outlive a death.
The default does nothing; an ability with per-run state overrides it.