Limiting Bullets

Hey. Looking for a way to limit the amount of bullets fired...
So i have it that when i push space it fires..but i want to only let it fire lets say every 5th touch.

Basically it fires to much.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2013
    I can understand wanting to limit the number of bullets but forcing the player to press a key to fire and only having it work 20% of the time seems like a frustrating experience.

    Either use a timer or limit the number of bullets.

    Timestamp method (1 second delay):
    When [all] conditions: key [space] is down AND self.Time>self.bulletTime+1
    .....Spawn actor [bullet]
    .....Change Attribute self.bulletTime (real) to self.Time

    Counter method (max 5 bullets):
    When [all] conditions: key [space] is down AND game.bulletCount (integer) <5
    .....Spawn actor [bullet]
    .....Change Attribute game.bulletCount to game.bulletCount+1

    *then in the bullet actor, have a rule that changes game.bulletCount to game.bulletCount-1 before the bullet is destroyed or when it goes off screen.

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

Sign In or Register to comment.