Time for action – adding a game attribute to record the level
The game file to import and load for this session is 5961_06_11.stencyl
.
Create a new number game attribute called
Level
, with the configuration shown in the following screenshot:Save the game.
What just happened?
We have created a new game attribute called Level
, which will be used to record the current level of the game.
A game attribute is being used here, because we need to access this value in other scenes within our game; local attributes have their values reset whenever a scene is loaded, whereas game attributes' values are retained regardless of whether or not a different scene has been loaded.
We'll be putting this game attribute to good use in Chapter 7, Polishing the game!
Fixing the never-ending game!
We've finished designing and creating the gameplay for the Monkey Run game, and the scoring behaviors are almost complete. However, there is an anomaly with the management of the Lives
game attribute. The monkey correctly loses...