Game Development Reference
In-Depth Information
Test it out to see if everything works. If it does, Kevin should emit particles for 10
seconds, then stop. Again, in the next chapter, when we are creating our enemies, we
will talk more about Kevin taking damage from them, and how we can differentiate
between getting hit normally and when he has a star.
Ammo
While we could let Kevin have an unlimited amount of ammo, what kind of
challenge would that be? Ammo is another easy thing to program into GameSalad.
We will start by creating a game-wide attribute, which will be an Integer, and we
will call it Ammo , change the Value to 500 . Alternatively, you could set it to a low
number such as 7 , and create another attribute for the amount of clips; then once
you run out of ammo, decrease the number of clips and reload the ammo. However
you want to do it, I'm going to show you how to do it! In our Kevin actor, create a
new rule, change it to Attribute | game.GunCollected | is | true , and then drag in
a Display Text behavior. For the text click on the e button to open up the expression
editor and select game.Ammo , and set the Y position to 40 , and the Size to 10 . Once
you collect the gun, it will display the ammo value above Kevin's head. Handy!
 
Search WWH ::




Custom Search