Class LadderAbility

java.lang.Object
com.codename1.gaming.platformer.Ability
com.codename1.gaming.platformer.LadderAbility

public class LadderAbility extends Ability

Climbing Tile#LADDER cells. Up or down while overlapping a ladder grabs it: gravity stops, the actor centres on the ladder and moves at climbSpeed. Jumping lets go (JumpAbility treats a ladder as ground), as does climbing off either end. Standing on top of a ladder and holding down climbs down through it.

Add it before JumpAbility so a jump from the ladder sees the climbing state.

  • Field Details

    • climbSpeed

      public int climbSpeed
      Climbing speed, fixed point per tick.
  • Constructor Details

    • LadderAbility

      public LadderAbility()
  • Method Details

    • process

      public void process(Actor c, PlatformWorld world)
      Description copied from class: Ability

      Sets velocity and claims a MovementState.

      Parameters
      • c: the actor
      • world: the world
      Specified by:
      process in class Ability
    • lateProcess

      public void lateProcess(Actor c, PlatformWorld world)
      Description copied from class: Ability

      Runs after the body moved, with the new contacts.

      Parameters
      • c: the actor
      • world: the world
      Overrides:
      lateProcess in class Ability
    • isClimbing

      public boolean isClimbing()

      Whether the actor is on a ladder.

      Returns

      true while climbing

    • hashState

      public long hashState(long h)
      Description copied from class: Ability

      Mixes the ability's own state into a hash, so two runs that diverge inside an ability are caught. The default mixes nothing.

      Parameters
      • h: the running hash
      Returns

      the updated hash

      Overrides:
      hashState in class Ability
    • reset

      public void reset()
      Description copied from class: Ability
      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.
      Overrides:
      reset in class Ability