0 Favourites

How do I unlock object only once

  • Hi all,

    I am making game and right now I stopped at unlocking characters with ingame money.

    I unlock new character let's say spending 500 coins. It is selected and everything is ok. Then I unlock another and use it for awhile, but when I want to change back to previous I have to spend again 500 coins.

    I need the game to remember that I unlocked that character and I don't have to spend again coins just to use it again.

    Have any ideas how to do that?

  • yes but it would take some tedious work

    1) Make a global variable for each character with its own localstorage key.

    2) When you buy the character, make sure to update the global variable and the key so it saves you buying the character.

    3) Update your code if your global variable is the right value, then you don't get charged for the charater.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 1 bolean or variable on the item

    tripple condition :

    Trigger once

    is bolean X inverted/variable=0

    cash =>500

    action --> subtract 500 from cash

    ------------> set bolean true /set variable to 1

    this should solve it.

    i placed bolean and variable with a / so you can choose the way you want it... it doesnt require both just one of the solutions.

    here is a capx example using mouse and instance bolean

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
220 14,901
Tom's avatar
Tom Construct Team Founder
Unread hot topic
99 10,158
karshinkoff's avatar
karshinkoff
Unread hot topic
167 14,517
DMT2005's avatar
DMT2005