How do I create repeatable upgrades?

  • Hello, I've got a weird logic quirk that you folks can surely help me unravel. I want my game to have certain upgrades be repeatedly buyable for a number of ranks. This seemed like it'd be easy, but it's proving to be pretty tricky.

    The way I've got this set up, what I expected to happen is: when the player clicks the button, if var_isbought is 0 it does the first upgrade and then sets it to 1, and stops. What I figured is that it would only perform the action that is true when the player first clicks the button, but it turns out that's not the case. Instead, it continues to the second upgrade and makes that change as well. How do I make it work like I intend for it to?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Reverse the sequence or use OR logic word.

  • Oh, interesting! I reversed the order of the two upgrade actions and now it works just fine. I guess order of operations is more important than I thought. Thank you!

  • Events are read from top to bottom.

    Events are executed when all actions are true.

    The events in your original sequence check if the player has enough money and if the object is bought.

    In the first event, the player has money, and the object is not purchased. There "is_bought" is set to 1.

    Second event, the player has money and the object is NOW purchased (in the same tick). So the upgrade is completed as well.

    In order to "do the pause" as you intend, your second event requires to have a "Else" system condition.

    This way, it would only execute one or the other event, and indeed the behaving of those events would equal what you expected.

    Reverting events here will work, but is only a band aid that can go wrong if you were to attempt to add more upgrades later.

  • Ahh, thank you for the explanation! That's a big help, I appreciate it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)