How do I,... create a dynamic shop?

0 favourites
  • 4 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • Hello!

    I am doing some tests with an ingame shop feature. I have 2 instance variables, price and locked(bool).

    I wanted to summon a button under each locked instance and write the price. I wanted this button to 'buy' (unlock) the item if there's enough money.

    The problem is the "buy". Once I click on the button it gets the price from the latest price value, stored in the variable. Also when unlocking, it unlocks everything :/

    I don't know how to pick the particular value ....

    Subscribe to Construct videos now

    Thank you for your time!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are many approaches to this. You can relate the button to the eyes object then you can say on button clicked, subtract eyes.price with a condition where you relate button to eyes such as 'eyes is overlapping button'. You could also try something clever with matching IDs where eyes and its related button have the same ID variable and use this as a condition instead.

    Also on the eyes object I would add a string instance variable for the eye colour then you can limit all those set eyecolour events to one which would be set global variable EyeColor to eyes_UI.eyecolour(the instance variable). So rather than set a value based on animation frame, you can set the global variable based on information on the eyes object itself.

  • There are many approaches to this. You can relate the button to the eyes object then you can say on button clicked, subtract eyes.price with a condition where you relate button to eyes such as 'eyes is overlapping button'. You could also try something clever with matching IDs where eyes and its related button have the same ID variable and use this as a condition instead.

    Also on the eyes object I would add a string instance variable for the eye colour then you can limit all those set eyecolour events to one which would be set global variable EyeColor to eyes_UI.eyecolour(the instance variable). So rather than set a value based on animation frame, you can set the global variable based on information on the eyes object itself.

    Hello lionz ! Thank you for your ideas!

    I tried with the eye object instance thing, but I can't get it to work :/ In the debug I can see it gets the right label "Black", "Brown", "Hazel"... etc

  • Does the animation name on the char look correct? You can see in debug which animation it is trying to play.

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