How do I disable menu buttons after clicking 'play again'

0 favourites
  • 11 posts
From the Asset Store
Click! Click! 136 click sounds for your video games or media projects
  • hey guys,

    Pretty newbie question.. But how would i make my menu popup (upon death) be disabled upon clicking play again. I have got it to be invisible then visible when dead. Then clicking play again makes it invisible then. But technically it is still there.

    Basically I want my game over pop up to only be active when the player dies. And upon clicking play again it is disabled. (so you cant click the 'invisible' buttons)

    Thanks

  • You can simply add another condition to your click event:

    Mouse -> Clicked on MenuButton

    (and) MenuButton Is Visible

    Or a better solution would be putting all menu events into a separate group "Menu Events" and disabling this group when it's not needed.

  • You can simply add another condition to your click event:

    Mouse -> Clicked on MenuButton

    (and) MenuButton Is Visible

    Or a better solution would be putting all menu events into a separate group "Menu Events" and disabling this group when it's not needed.

    So ill have hide the buttons as well? I have hidden the popup layer as said above

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, sorry, then you should check if the layer is visible, not the button.

    But as I said, it's better to disable the entire group of events.

  • Oh, sorry, then you should check if the layer is visible, not the button.

    But as I said, it's better to disable the entire group of events.

    I tried doing this but i dont know how to disable the events if invisible (layer)

    imgur.com/a/NSxk3

    I have this.. Which shows when the player is dead and the button (with the popup menu layer being 'GameOver')

  • Just add System->Set Group "Buttons" Inactive to all events where you make that layer invisible.

    And add System->Set Group "Buttons" Active to the event where your character dies.

    By the way, you shouldn't have Mouse-Clicked and Touch-Is touching as two conditions of the same event. On a touch device it will never work. Even if you change it to "Or" block, it will still be bad, as "Is touching" condition is continuous and triggers every tick while the finger is touching the screen.

    I would move the code into a function "RestartGame" and create two different events, one Mouse-Object Clicked, and another Touch->Object touched, both calling that function.

  • Or just add a condition if layer is invisible > set group buttons inactive and vice versa. Thus, when you make layers visible or invisible, the buttons on it automatically become active or inactive.

  • Or just add a condition if layer is invisible > set group buttons inactive and vice versa. Thus, when you make layers visible or invisible, the buttons on it automatically become active or inactive.

    I have this atm.. But can't find a group action to disable the layout? Is it called something different

    imgur.com/a/Uef3A

    Tried googling it also but nothing seems to be working from what i have been referring too.

    Thanks

  • First, the actions must be outside the groups that will be activated/deactivated.

    Second, you don't disable a layout. You make Groups active or inactive, groups like the "ActiveButtons" on your pic.

  • First, the actions must be outside the groups that will be activated/deactivated.

    Second, you don't disable a layout. You make Groups active or inactive, groups like the "ActiveButtons" on your pic.

    Sorry I am still struggling with this.

    I have my 'Play again' and 'Submit' buttons outside the group, which are in the 'GameOver' layer. I am looking in system etc to find one so that I can have the buttons only activated when layer 'GameOver' is visible. Then deactivated when the layer is Invisible.

    I am guessing i am looking for the wrong wording to do this as fairly new to construct.

    Thanks again

  • No worries, let me try to put it clearer.

    You have to create a group and put all events related to the functionality of those buttons inside that group.

    Then, you must create, outside this group an action that activates the group when the layer (the one in which the buttons are) is visible, and deactivates it when the layer is invisible.

    Something like that:

    Hope this helps. Cheers!

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