Multiple of one object with different events

  • I started adding a shop to my game, and i want to have 4 buy buttons, 4 price tags but i don't wanna add 4 different buttons/price tags for every item in my shop. Is it possible to ctrl, drag a item with other events/sprites?

    Sorry for my English.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yeah, just use instance variables and put/modify their values for each instance so each button will do something different from other buttons

    or 4 different button objects but all are part of a family and you use family instance variables instead.

  • Ninja'd....

    Yes, you could use instance variables. Just make one button sprite, and add an instance variable (text) to them. You could call it "whantnot". Then create 4 copies of the same sprite on your layout, change each buttons whatnot property as you deem fit. For example you give two of them health and mana values.. then later in events:

    mouse on clicked button

    button.whatnot="health"

    give health potion

    else if

    button.whatnot="mana"

    give mana potion

    Hope this helps.

  • sgn15 , Windwalker thank u guys so much! It's way easier then i thought.

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