[SOLVED]How do I Hide all buttons with the same name

Get help using Construct 2

Post » Mon Nov 24, 2014 5:38 am

I have the same button names on different Layouts sheets, and they control actions from an INCLUDE.

My question is if I make a button invisible on one layout how do I make that button invisible on the the other layouts? (For example if you break your sword you can not hit the ATTACK button on any other layouts till you get a new one).

I know I could use a global variable at the stat of each page but there has to be a more elegant way. I was looking into Global objects but that did not seem to do anything.

please help
Last edited by Guyon on Tue Nov 25, 2014 5:51 am, edited 1 time in total.
B
29
S
8
G
8
Posts: 531
Reputation: 7,181

Post » Mon Nov 24, 2014 10:40 am

Indeed, I'd set a variable called ATTACKButtonState=0 or 1
Then If ATTACKButtonState = 0 set Button Invisible (trigger once)
B
17
S
3
G
3
Posts: 89
Reputation: 2,825

Post » Mon Nov 24, 2014 12:10 pm

So there is no global command to turn off all buttons named "Attack"?
Or even a way to clone the "Attack" button so that when one is turned invisible they all are turned invisible?
Thanks
B
29
S
8
G
8
Posts: 531
Reputation: 7,181

Post » Mon Nov 24, 2014 12:24 pm

So I assume when you say named the same you mean the same instance? If so you can use 'system -> pick all -> select your button' and then 'select your object -> Set visible -> Invisible'
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Mon Nov 24, 2014 1:12 pm

I just created all the buttons normally "by insert new object". Do you create you instance button differently?

You may be on the right track i just don't understand how to accomplish it. I want to turn on and off all of the same named buttons on all layouts.

Thanks
B
29
S
8
G
8
Posts: 531
Reputation: 7,181

Post » Mon Nov 24, 2014 1:24 pm

So each button is a separate object if you did that. Which is fine. So you just need a way of the game knowing that they are grouped together.

I see you have an 'early adopter' medal so assume you have a full version of C2? If so you can create a family and add all the buttons to it. Then you can just use the action '[family name] -> Set visible -> Invisible'.

If you don't have a full version then you will need to do something like what @Telyko said above, but just know when he says variable he means on the object and not a global one.

P.S an instance is when you use the same object by copy one that is already in the layout or by dragging an object into the layout from the project.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Mon Nov 24, 2014 4:50 pm

I figured out away. May not be the best solution, but it is working
Thanks for the help

...
Checking out Family it seems that I can only add buttons on my particular layout. I need to make the same name button invisible on all my layouts.

Also researching I do not see how instance can make all my same name buttons invisible on all layouts. Example?
B
29
S
8
G
8
Posts: 531
Reputation: 7,181


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 9 guests