Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public class JetpackAbility

  1. Object
  2. Ability
  3. JetpackAbility
A jetpack: holding Input#ALT in the air thrusts upward while fuel lasts; fuel refills on the ground.

Fields

public int thrustUpward acceleration while thrusting, fixed point per tick squared.
public int maxRiseFastest rise, fixed point per tick.
public int fuelTicksTicks of thrust on a full tank.
public int refillFuel regained per tick on the ground.

Constructors

public JetpackAbility()

Methods

public void process(Actor c, PlatformWorld world)Sets velocity and claims a MovementState.
public int getFuel()Fuel left, for the HUD.
public long hashState(long h)Mixes the ability’s own state into a hash, so two runs that diverge inside an ability are caught.
public void reset()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.

Inherited methods

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)
Sets velocity and claims a MovementState.

Parameters

c Actor
the actor
world PlatformWorld
the world

getFuel

public int getFuel()
Fuel left, for the HUD.

Returns

ticks of thrust remaining

hashState

public long hashState(long h)
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 long
the running hash

Returns

the updated hash

reset

public void reset()
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.