-
-
Notifications
You must be signed in to change notification settings - Fork 591
Game State
Almas Baimagambetov edited this page Jan 18, 2017
·
3 revisions
Game state is nothing more (at the moment) than a bunch of observable values that affect the game.
A reference to GameState
can be obtained as follows:
GameState state = getGameState();
There are four types of supported values:
boolean
int
double
String
Each value has a name associated with it. A raw value can be accessed by:
int lives = state.getInt("lives");
Each value is backed up by a JavaFX Property
.
This means you can listen for changes and you can also bind to the properties for auto-updates.
A property value can be accessed by:
IntegerProperty livesProperty = state.intProperty("lives");