Removing buttons/graphics when clicked

0 favourites
From the Asset Store
Over 1700 16x16 pixel art RPG icons for item and skills
  • Hey everybody,

    First time posting, I've looked for several hours on the forums and manuals for my answer and I apologize if I've missed it somewhere. I'll try to explain the best I can what I am trying to accomplish.

    I have created an upgrade shop in my game (layout). In this layout i have added buttons that upgrade stats and such. I am trying to make those buttons disappear after they have been clicked and the upgrade obtained. Currently every time i switch back to my main(layout), and then back to the upgrade shop, the buttons are still there. Any help would be greatly appreciated.


    Ok i got it working by setting a variable change when the button is clicked. If value = 0 the button is visible if value = 1 the button is invisible (pretty much a true false). Is this the best way to do this if I plan on needed a lot of these buttons to work?

  • If you plan on having many button you might want to save this kind of data a more efficient way like:

    1/ bit flags in a global number

    2/ global array

    3/ global tokenized text

    so you keep track of things from layout to layout

  • Yann . you're useing an Array?!? <img src="smileys/smiley23.gif" border="0" align="middle" />

  • Weishaupt What do you mean? I don't do anything...

  • Yann - just teasing you, since any time I said "use an Array" you said use a "list" instead.

    ....I did in my last tutorial <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Thanks Yann,

    This is all pretty new to me, I think I'll dive into an Array. The game I'm designing is going to have hundreds of buttons.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anybody willing to show a quick example of organizing buttons using an array? I've been messing with arrays for many hours and with my limited knowledge I just can't figure out how they work. A CapX would be very nice.

  • Cstix: there are several example of use of Arrays in the how do I FAQ (Section "Arrays").

    And you can also cross-reference with the manual.

    I hope it helps you.

  • I'll take another look around there Kyatric. I'll figure this out yet <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Cstix: I've made this commented capx to show a bit how to use arrays, and allow you to test some stuff.

    Hope it helps.

  • That is great Kyatric!!!!!! 5 minutes look at this CapX has accomplished more than all I read in the Ho can I section or the manual section. I guess I learn best seeing it in action. I think i can better understand the manual now though. Thanks a ton!

  • Kyatric! :) Your link is broken, can you make a new one? I will be forever in your dept :)

  • : The link works as intended.

  • Kyatric Oh, sorry, didn't work for me a moment ago... It's okay now, thank you :)

  • And here I just registered so I could ask a question about arrays in Construct2 and someone has a great example of it with comments! :)

    I haven't looked at it yet, but I just downloaded it. Waiting to get back to my PC (on my Mac now) so I can run it (a Mac version of Construct2 can't come soon enough). <3 Construct2!

    Thanks for this. I'll update with its degree of helpfulness in a bit.

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