Adding an Ammo Counter

I have added a counter so that when my bullet actor is shot from the gun, the counter decreases (starting from 10). Once it reaches 0, it heads into the minus numbers (-1, -2 , -3 etc).
Could i please have some help in fixing?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    On a Mac, you can use an Index attribute to keep the value greater than or equal to zero. On either platform, you can use the max() function which returns the larger of two values. Let's say you have an integer attribute called game.shots that starts at 10. You would do change attribute game.shots to max(0,game.shots-1).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.