Class GripAbility
java.lang.Object
com.codename1.gaming.platformer.Ability
com.codename1.gaming.platformer.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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintHow far below the corner, fixed point, the actor's head may be and still catch it: the reach of the hands.intTicks after letting go before the same actor can grab again, so a drop is not caught by the corner it just left. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonghashState(long h) Mixes the ability's own state into a hash, so two runs that diverge inside an ability are caught.booleanWhether the actor is hanging from a ledge.voidlateProcess(Actor c, PlatformWorld world) Runs after the body moved, with the new contacts.voidprocess(Actor c, PlatformWorld world) Sets velocity and claims aMovementState.voidreset()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.Methods inherited from class Ability
earlyProcess, isEnabled, mix, setEnabled
-
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
Description copied from class:AbilitySets velocity and claims a
MovementState.Parameters
c: the actorworld: the world
-
lateProcess
Description copied from class:AbilityRuns after the body moved, with the new contacts.
Parameters
c: the actorworld: the world
- Overrides:
lateProcessin classAbility
-
hashState
-
reset
-