How can I upgrade bullet damage rate as I tap the upgrade button?(just readthe description it'llhelp

mamadouad09mamadouad09 Member, PRO Posts: 4
edited July 2016 in Working with GS (Mac)

This is what I want to achieve: If I tap the button once, it charges me 50 coins and increase the firing rate by 1 second. If I tap it again a second time, it charges me 100 coins and increase my firing rate by .5 seconds. If I tap the button once, it charges me 50 coins and increase the weapon's damage by 1. or if I tap it again a second time, it charges me 100 coins and increase my weapon's damage by 2 more. I want the players to upgrade their guns separately. I don't want the reload speed to match the firing rate, or the damage.

Answers

  • mamadouad09mamadouad09 Member, PRO Posts: 4

    I am trying to use tables

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

    You can do it with tables but without tables it looks like this:

    Firing rate button actor:
    When touch is pressed
         When self.tapCount=0
              Change attribute game.firingRate to game.firingRate+1
              Change attribute game.coins to game.coins-50
              Change attribute self.tapCount to 1
         Otherwise
              When self.tapCount=1
                   Change attribute game.firingRate to game.firingRate+0.5
                   Change attribute game.coins to game.coins-100
                   Change attribute self.tapCount to 2
              
    And then a similar setup for the damage button actor.

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

  • mamadouad09mamadouad09 Member, PRO Posts: 4

    do you know how to do it with tables

  • NNterprisesNNterprises Member, PRO Posts: 387

    With tables you would just have a table where maybe cell 1,1 is the "firing rate", and 1,2 is the coins. So then do this:

    Firing rate button actor:
    When touch is pressed
    When self.tapCount=0
    Change TABLE VALUE (Table,1,1) to (Table,1,1)+1
    Change TABLE VALUE (Table 1,2) to (Table 1,2)-50
    Change attribute self.tapCount to 1
    Otherwise
    When self.tapCount=1
    Change TABLE VALUE (Table,1,1) to (Table,1,1)+0.5
    Change TABLE VALUE (Table 1,2) to (Table 1,2)-100
    Change attribute self.tapCount to 2
    Save Table

    Change Table Value is a rule that you can put in. "Table" here would be the name of your table

Sign In or Register to comment.