Ammo Limit

mrgflan1mrgflan1 Member Posts: 2
edited August 2013 in Working with GS (Mac)
Hi! I am completely new to this and this is probably the wrong place to post this, but, after much searching on Google, YouTube, and the GameSalad forums, I have yet to find an answer to my question. My question is, how do I create a working ammo count for my game?
I have had moderate success with changing around a bit of the code from the health bar tutorial by GameSaladCookbook to fit my needs, but whenever I hold the shoot button down it drains all my ammo while only creating a single bullet. Can anybody find a solution please?

Here is the code I have currently.
Attribute: game.ammo = 10
Ammo counter actor: Constrain attribute self.Size.Width to game.ammo*20

Player actor: When all conditions are valid,
constrain attribute game.ammo to game.ammo-1
Spawn bullet actor

Thanks!

Comments

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    When all conditions are valid
    Change Attribute to Game.ammo to Game.ammo-1
    Spawn Bullet

    Constrain attribute keeps running. Change attribute only runs once when toggled.
  • mrgflan1mrgflan1 Member Posts: 2
    Thanks! Worked like a charm.
  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    Glad I could help
Sign In or Register to comment.