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 Gate

  1. Object
  2. LevelEntity
  3. BlockEntity
  4. Gate
A gate wired to a channel: open while the channel is on (or off, when inverted). Switches turn channels on and off.

Constructors

public Gate(String id, int x, int y, int w, int h, int channel, boolean inverted)Creates a gate.

Methods

public int getPhase()A small number the view reads to pick a frame: open or closed, lit or not, how cracked.
public void onAdded(PlatformWorld world)Called once when the entity is added to a world, before the first step: the place to write solid cells.
public void step(PlatformWorld world)Advances one tick.

Inherited fields

From LevelEntity

x, y, w, h

Inherited methods

Constructor details

Gate

public Gate(String id, int x, int y, int w, int h, int channel, boolean inverted)
Creates a gate.

Parameters

id String
the id
x int
left, fixed point, on a tile edge
y int
top, fixed point, on a tile edge
w int
width, whole tiles, fixed point
h int
height, whole tiles, fixed point
channel int
the channel, 0 to 31
inverted boolean
true to be open while the channel is off

Method details

getPhase

public int getPhase()
A small number the view reads to pick a frame: open or closed, lit or not, how cracked. The default is 0.

Returns

the visual phase

onAdded

public void onAdded(PlatformWorld world)
Called once when the entity is added to a world, before the first step: the place to write solid cells. The default does nothing.

Parameters

world PlatformWorld
the world

step

public void step(PlatformWorld world)
Advances one tick. The default does nothing.

Parameters

world PlatformWorld
the world