I built a simple expanding icon menu but can't have closing routine to work

0 favourites
  • 7 posts
From the Asset Store
A well commented template with list menus and shops to use in your top-down RPGs or metroidvania games!
  • I made a menu for a game. When player clicks/tap on screen, a marker is created with round icons around it allowing actions. Everything works fine except when I want the menu to close when I tap marker/icon, the menu closes but a new one is instantly created at touch point.

    I guess there is something with the click action that is taken in account twice : once for closure and second for creating a new menu.

    File is here dropbox.com/s/akq2580095tlkds/Bubble%20menu.c3p

    Thanks for your help !

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well the input events are run top to bottom.

    You have it so if you tap on either red circle it closes the menu, then third event runs because it’s not tapping on anything.

    I thought maybe rearranging the events would be an option but that causes the menu to be instantly destroyed so you don’t see it.

    But here’s this for a solution. Have one on tap event and have it do just one thing depending on what was tapped on.

    on tap
    -- touch is over sprite1?
    -- -- close menu
    -- else
    -- touch is over sprite2?
    -- -- close menu
    -- else
    -- — close menu
    -- — create menu
  • Well the input events are run top to bottom.

    You have it so if you tap on either red circle it closes the menu, then third event runs because it’s not tapping on anything.

    I thought maybe rearranging the events would be an option but that causes the menu to be instantly destroyed so you don’t see it.

    But here’s this for a solution. Have one on tap event and have it do just one thing depending on what was tapped on.

    on tap
    -- touch is over sprite1?
    -- -- close menu
    -- else
    -- touch is over sprite2?
    -- -- close menu
    -- else
    -- — close menu
    -- — create menu

    Hi R0J0hound

    Thanks for the answer !

    I tried you suggestion but it doesn't seem to work either.

    Here's link to this version : dropbox.com/s/7lr8j1pxzz2dsbr/Bubble%20menu.c3p

  • Make event 9 a sub-event of event 8 and it works.

  • Thank you very much !

    I already spotted that there seems to have a very special logic about sub events but understand now that it is more subtile than I thought. Is there a simple logic about that or a tutorial somewhere that tells everything about it ?

  • Sub events are only run when their parent event runs. Anyways here it matters because or the else’s. An event with an else will only run if the event on the same level above it doesn’t run.

  • Thank you !

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