Game Development Reference
In-Depth Information
Figure 7-38. Menu scene attributes
Managing Unlocked Levels
In order to manage levels, you will use an integer game attribute that will contain
the maximum level unlocked. By default, it will start at one. Then during the
game, every time you do a level up, you will check that the new WhatLevel
attribute is higher than MaxLevel. If this is the case, you will replace the value of
MaxLevel with the value of WhatLevel.
On the Menu Scene, you will use an actor to display either the level number of
the box or a red cross if the level has not been unlocked yet. The level number
of the box will be an actor attribute with a different value per instance on the
scene.
Let's do all this!
Create a new integer game attribute named ''MaxLevel.'' The default value is 1.
Open Initial Scene in the Scene Editor. Open the target instance and locate the
increment of WhatLevel in the Level Up rule. Just below this increment, create a
new rule with the condition ''Attribute'' ''game.WhatLevel'' ''>''
''game.LevelMax.'' Then drag and drop a Change Attribute behavior to the rule
and change game.MaxLevel to game.WhatLevel, as shown in Figure 7-39.
 
Search WWH ::




Custom Search