Class WorldEvent
java.lang.Object
com.codename1.gaming.platformer.WorldEvent
Something that happened in a tick that a view should show or play: a jump, a
coin, a hit. The simulation never calls into a view; it records events, and the
view reads
PlatformWorld#getEvents() after each step to trigger sounds,
particles and screen shake.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA spring launched an actor.static final intA checkpoint was reached.static final intThe level was completed.static final intA block crumbled.static final intAn actor dashed.static final intAn actor died.static final intA weapon fired.static final intThe player ran out of lives.static final intAn actor was hurt.static final intA projectile hit something.static final intAn actor jumped.static final intAn actor landed.static final intA door opened or a gate changed.static final intA pickup was collected;detailis its kind name.static final intThe player stomped an enemy.static final intA switch was activated. -
Constructor Summary
ConstructorsConstructorDescriptionWorldEvent(int type, int x, int y, String subject, String detail) Creates an event. -
Method Summary
-
Field Details
-
JUMP
public static final int JUMPAn actor jumped.- See Also:
-
LAND
public static final int LANDAn actor landed.- See Also:
-
PICKUP
public static final int PICKUPA pickup was collected;detailis its kind name.- See Also:
-
HURT
public static final int HURTAn actor was hurt.- See Also:
-
DEATH
public static final int DEATHAn actor died.- See Also:
-
STOMP
public static final int STOMPThe player stomped an enemy.- See Also:
-
FIRE
public static final int FIREA weapon fired.- See Also:
-
IMPACT
public static final int IMPACTA projectile hit something.- See Also:
-
CHECKPOINT
public static final int CHECKPOINTA checkpoint was reached.- See Also:
-
BOUNCE
public static final int BOUNCEA spring launched an actor.- See Also:
-
OPEN
public static final int OPENA door opened or a gate changed.- See Also:
-
CRUMBLE
public static final int CRUMBLEA block crumbled.- See Also:
-
DASH
public static final int DASHAn actor dashed.- See Also:
-
COMPLETE
public static final int COMPLETEThe level was completed.- See Also:
-
GAME_OVER
public static final int GAME_OVERThe player ran out of lives.- See Also:
-
SWITCH
public static final int SWITCHA switch was activated.- See Also:
-
-
Constructor Details
-
WorldEvent
-
-
Method Details
-
getType
public int getType()The event type.
Returns
one of the constants
-
getX
public int getX()Where it happened.
Returns
x, fixed point
-
getY
public int getY()Where it happened.
Returns
y, fixed point
-
getSubject
The id of the actor or entity involved.
Returns
the id, or null
-
getDetail
Extra information.
Returns
the detail, or null
-