0 Favourites

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

  • 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

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Indeed, I'd set a variable called ATTACKButtonState=0 or 1

    Then If ATTACKButtonState = 0 set Button Invisible (trigger once)

  • 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

  • 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'

  • 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

  • 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.

  • 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?

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