how to upgrade once at a time

AppulocityAppulocity Member, PRO Posts: 46

I've got a table full of upgrades in a game with 4 columns:

Price Gold (integer) , Price Food (integer) , Price Wood (integer) and Unlocked (boolean).

In the actor controlling the upgrades I have a self attribute of 'current level' which goes up by one each time the next tier is unlocked. I'm pulling all the info from the tables and then changing it when the player has greater than or equal to the price in each currency, taking away the cost from the amount the player has.

The problem I'm having is that when the player has more than enough in each currency to buy, say 3 consecutive upgrades, with one press it will upgrade it to the highest level affordable, which is annoying because it completely drains the currencies and doesn't allow the player to spread the upgrades between different things.

Any ideas of how to limit it to one tier upgrade per tap?

Thanks in advance

Comments

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

    Can you show your rule for this?

    If you use something like this, it should work fine even with tableCellValues:

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

  • AppulocityAppulocity Member, PRO Posts: 46
    edited January 2015

    Ok, here they are. I have the same rule for each lvl (for lvl 2, for lvl 3 etc.)

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

    For some reason I'm not seeing your images.

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

  • AppulocityAppulocity Member, PRO Posts: 46

    Yeah I don't think those pics uploaded properly... Weird, will try again

  • AppulocityAppulocity Member, PRO Posts: 46

    this should work

  • AppulocityAppulocity Member, PRO Posts: 46

    rule for lvl 3 etc is the same except for the self.Current level being greater and the table values being different

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

    So you're not using a When Touch is Pressed rule? Do players have to click/tap or do you want upgrades to happen automatically (which seems to be the problem you described)?

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

  • AppulocityAppulocity Member, PRO Posts: 46

    No I have got a when touch pressed. All the conditions are for the same rule. When touch is pressed is the second condition down

  • AppulocityAppulocity Member, PRO Posts: 46

    so when all

    self.current lvl = 1
    touch is pressed
    gold = price required
    bread = price required
    wood = price required

    then change the attributes

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

    Is there also a Touch is Pressed condition in the second rule you posted?

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

  • AppulocityAppulocity Member, PRO Posts: 46

    it's all one rule, I posted it in 3 pics because not all the conditions would fit in a single shot

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

    Oh, sorry, I misunderstood. I think the reason that the rule is firing more than once is because you're increasing the level... I'm guessing you also have a separate rule for when game.Current lvl is 2? You might try changing it to When Touch is Released to see if that makes a difference.

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

  • AppulocityAppulocity Member, PRO Posts: 46

    thats okay haha. Hmm yeah I think that might be what it is. Yes I do. Tried changing to when released but no difference

  • kikkankikkan Member Posts: 24

    I´m also on basicly the same problem, have you figgured out how to fix it yet?

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

    @Zenithax @kikkan I think this will help. The trick is to use the Otherwise section. Let me know if you have any questions.

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

  • kikkankikkan Member Posts: 24

    Thanks Tatiang :) I appreciate it :)

Sign In or Register to comment.