Class DashAbility

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

public class DashAbility extends Ability
A horizontal dash on Input#DASH: dashTicks at dashSpeed in the facing direction with gravity off, then a cooldownTicks wait. In the air it can be used airDashes times before landing.
  • Field Details

    • dashSpeed

      public int dashSpeed
      Dash speed, fixed point per tick.
    • dashTicks

      public int dashTicks
      Dash length in ticks.
    • cooldownTicks

      public int cooldownTicks
      Ticks before the next dash.
    • airDashes

      public int airDashes
      Dashes allowed per jump.
  • Constructor Details

    • DashAbility

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

      public boolean isDashing()

      Whether a dash is under way.

      Returns

      true mid dash

    • 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