Class JetpackAbility

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

public class JetpackAbility extends Ability
A jetpack: holding Input#ALT in the air thrusts upward while fuel lasts; fuel refills on the ground.
  • Field Details

    • thrust

      public int thrust
      Upward acceleration while thrusting, fixed point per tick squared.
    • maxRise

      public int maxRise
      Fastest rise, fixed point per tick.
    • fuelTicks

      public int fuelTicks
      Ticks of thrust on a full tank.
    • refill

      public int refill
      Fuel regained per tick on the ground.
  • Constructor Details

    • JetpackAbility

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

      public int getFuel()

      Fuel left, for the HUD.

      Returns

      ticks of thrust remaining

    • 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