Game Development Reference
In-Depth Information
Creating Dummy Projectiles
The very cool trick to manage the various projectiles is that in reality you will
only use one projectile. You will create dummy projectiles that will just disappear
one by one after each attempt while the main projectile is brought back to the
slingshot.
The dummy projectiles will have the same appearance as the projectile. But they
will just contain one rule and one Change Attribute behavior in this rule.
Create a game attribute to define the number of attempts left to complete the
scene. I set this number of attempts to 4 (you can choose any other number that
suits you), so you will need three dummy projectiles. As you have one on the
slingshot, it will initially display four projectiles on the scene. After each attempt,
you will decrement by one the game attribute. The rule in the dummy projectile
will check the game attribute compared to a position number. If the game
attribute is lower, you will make invisible (color alpha to 0) the dummy projectile.
And the magic is done!
In the Scene Editor, create a new game attribute of type integer, name it
''Attemptleft,'' and set its default value to 4, as shown in Figure 6-36.
Figure 6-36. Game Attribute attemptleft
Next, create a new actor and rename it ''dummy projectile'' and change the
following attributes in the Actor Editor:
Size/Width: 25
Size/Height: 25
Color/Red: 1
Color/Green: 0
Color/Blue: 0
Next, create a new rule with the condition ''Attribute''''game.Attemptleft'' “<”''4.''
Drag and drop a Change Attribute and change dummy projectile.Color.Alpha to
0, as shown in Figure 6-37.
 
Search WWH ::




Custom Search