Limited Ammo Question

eromingeroming Member Posts: 13
edited November -1 in Working with GS (Mac)
My one ship can drop bombs but i want to know a clean method that when i have my game.bombs=0 the bombs can't spawn. I tried destroy actor but i can still see the bombs if you click fast enough.

Also is there any way i can make it so you can only drop one bomb per two seconds even if you click faster?

Thanks in advance!

Comments

  • DimensionGamesDimensionGames PRO Posts: 993
    When attribute 1 is true

    spawn bomb.
    -----
    When bomb = 0

    Change attribute 1 to false.

    EDIT:

    Didn't see the second part to the post, pretty sure it can be done more efficiently but I would have:

    attribute and reset it every 2 seconds
    When attribute is over 1 then don't spawn bomb.
  • RedlerTechRedlerTech Member Posts: 1,583
    Okay
    Create an attribute called BombCount (integer) - whatever number you want
    Create an attribute called BombGo (boolean) - true

    In the bomb put a change attribute game.BombCount to game.BombCount + 1
    Timer. For 2 Seconds, constrain BombGo to false
    Timer After 2 Seconds, change attribute BombGo to true

    Put in ship:
    RULE
    When BombGo is true, and whatever to spawn bombs (EX: when key space is down)
    Spawn Actor: Bomb

    RULE When game.BombCount =< 0, constrain BombGo to False

    Matt :D
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Im guessing you have a touch is pressed or mouse button down rule that spawns your bomb.
    Just add the condition

    when game.bombs > 0

    the touch will no longer work when bombs reach 0

    If you want to also only allow 1 bomb every 2 seconds make a boolean called bomballowed

    And in the same rule you just added game.bombs > 0 Add a third condition game.bombsallowed is true

    Add to your spawn rule a change attribute game.bombsallowed to false

    Then add a new rule

    When game.bombsallowed is false
    --after 2 seconds run to completion checked
    ----Change attribute game.bombs allowed to true

    So to re-cap

    When touch is Pressed And
    When game.bombs > 0 And
    When game.bombsallowed is true
    --Spawn Bomb
    --Change attribute game.bombsallowed to false

    When game.bombsallowed is false
    --Timer, After 2 seconds Run to completion checked
    ------Change attribute game.bombsallowed to true

    Hope that helps.
    Good luck
  • eromingeroming Member Posts: 13
    i tried every option. I think my gamesalad isn't working based on multiple reasons. I am going to reinstall it an try again! :)
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Post a screen shot of your rules. What I posted should work perfectly I have done several things like that before.
  • eromingeroming Member Posts: 13
    I am gonna try it again with a different game I am making! Then I will let you know!
  • eromingeroming Member Posts: 13
Sign In or Register to comment.