Class WallJumpAbility

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

public class WallJumpAbility extends Ability

Wall clinging and wall jumping. Falling while pushing into a wall slows the fall to slideSpeed; jumping from the wall (or within graceTicks of leaving it) kicks the actor up and away, locking control for lockTicks so the kick carries before input steers again.

Add it before JumpAbility, which it pre-empts on the wall.

  • Field Details

    • slideSpeed

      public int slideSpeed
      Fastest fall while clinging, fixed point per tick.
    • kickX

      public int kickX
      Horizontal kick of a wall jump.
    • kickY

      public int kickY
      Vertical speed of a wall jump.
    • lockTicks

      public int lockTicks
      Ticks horizontal control is locked after a wall jump.
    • graceTicks

      public int graceTicks
      Ticks after leaving a wall that a wall jump still works.
  • Constructor Details

    • WallJumpAbility

      public WallJumpAbility()
  • 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
    • 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