Removing buttons/graphics when clicked

Get help using Construct 2

Post » Tue Jan 24, 2012 5:07 pm

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.

Update:

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? Cstix2012-01-24 17:20:08
B
7
Posts: 15
Reputation: 756

Post » Tue Jan 24, 2012 6:21 pm

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
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Jan 24, 2012 6:23 pm

@Yann . you're useing an Array?!?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Jan 24, 2012 6:28 pm

@Weishaupt What do you mean? I don't do anything...
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Jan 24, 2012 6:30 pm

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

....I did in my last tutorial
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Tue Jan 24, 2012 6:58 pm

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.
B
7
Posts: 15
Reputation: 756

Post » Wed Jan 25, 2012 5:46 pm

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.
B
7
Posts: 15
Reputation: 756

Post » Wed Jan 25, 2012 5:53 pm

@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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Jan 25, 2012 5:55 pm

I'll take another look around there Kyatric. I'll figure this out yet
B
7
Posts: 15
Reputation: 756

Post » Wed Jan 25, 2012 6:46 pm

@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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Next

Return to How do I....?

Who is online

Users browsing this forum: jeffige and 1 guest

cron