Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Gamesalad Essentials

You're reading from   Gamesalad Essentials Create awesome cross-platform games in no time, and with no coding

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784391973
Length 154 pages
Edition 1st Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
 DeQuadros DeQuadros
Author Profile Icon DeQuadros
DeQuadros
Arrow right icon
View More author details
Toc

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!

To count ammo that is being depleted, go into our Inter-Dimensional Gravity Distributor actor. That didn...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images