Class CrumbleBlock
java.lang.Object
com.codename1.gaming.platformer.LevelEntity
com.codename1.gaming.platformer.BlockEntity
com.codename1.gaming.platformer.CrumbleBlock
A floor that gives way:
delayTicks after the player first stands on it, its
cells vanish, and they come back respawnTicks later (never, if 0).-
Field Summary
Fields inherited from class LevelEntity
h, w, x, y -
Constructor Summary
ConstructorsConstructorDescriptionCrumbleBlock(String id, int x, int y, int w, int h, int delayTicks, int respawnTicks) Creates a crumbling block. -
Method Summary
Modifier and TypeMethodDescriptionintgetPhase()A small number the view reads to pick a frame: open or closed, lit or not, how cracked.longhashState(long h) Mixes the entity's play-relevant state into a hash.voidonAdded(PlatformWorld world) Called once when the entity is added to a world, before the first step: the place to write solid cells.voidonTouch(PlatformWorld world, Actor c) Called each tick a living actor overlaps the entity.voidstep(PlatformWorld world) Advances one tick.Methods inherited from class BlockEntity
getTouchMargin, isSolid, setSolidMethods inherited from class LevelEntity
deactivate, getId, getType, isActive
-
Constructor Details
-
CrumbleBlock
Creates a crumbling block.
Parameters
id: the idx: left, fixed point, on a tile edgey: top, fixed point, on a tile edgew: width, whole tiles, fixed pointh: height, whole tiles, fixed pointdelayTicks: ticks between first being stood on and giving wayrespawnTicks: ticks until it returns, 0 for never
-
-
Method Details
-
getPhase
public int getPhase()Description copied from class:LevelEntityA 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
- Overrides:
getPhasein classLevelEntity
-
onAdded
Description copied from class:LevelEntityCalled 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: the world
- Overrides:
onAddedin classLevelEntity
-
step
Description copied from class:LevelEntityAdvances one tick. The default does nothing.
Parameters
world: the world
- Overrides:
stepin classLevelEntity
-
onTouch
Description copied from class:LevelEntityCalled each tick a living actor overlaps the entity.
Parameters
world: the worldc: the actor
- Overrides:
onTouchin classLevelEntity
-
hashState
public long hashState(long h) Description copied from class:LevelEntityMixes the entity's play-relevant state into a hash. The default mixes the position and whether it is active.
Parameters
h: the running hash
Returns
the updated hash
- Overrides:
hashStatein classBlockEntity
-