Menu second click

SilverApeSilverApe Member Posts: 4
edited November -1 in Working with GS (Mac)
Hi all,

I have a problem with a menu I am making.
When the game starts it starts out with a single button for the menu, when you click on it three more buttons pop up next to it. These popup with a timer one after eachother.
But they disappear immediately after, I want them to stay and when I click again go away.

I have made a game attribute named "Menu active" (boolean)
In my main menu button I made a rule with mouse button down, mouse position inside and attribute game.Menu active false.
Inside that rule I have change attribute game.Menu active to true and 3 timers (for each sub menu) which spawns the actor ofter a set amount of time to a certain spot (run to completion on)
End rule
Next rule
Attribute game.Menu active is true, mouse button down, mouse position inside.
change attribute game.Menu active to false

Now in the submenu buttons I have:
attribute game.Menu active is false destroy this actor.

But it does not work. I have changed many things but it still does not work.
Does anyone have any ideas of what I am doing wrong??

Thanks in advance,
Aaron

Comments

  • RHRH Member Posts: 1,079
    Not sure if i got the right end of the stick, but when i did something like this i didn't use any attributes.

    Here is what i did (EDIT: Here is what it looked like http://gamesalad.com/game/play/51067)

    made these actors: Mainmenu | submenu1 | submenu2 | submenu3

    On Mainmenu i made this rule:

    When: Actor receives event: touch: is released

    Then i put these timers in the rule

    Timer: After 1 second: Spawn Actor (submenu1)
    Position +200X +50Y (relative to actor)

    Timer: After 2 seconds: Spawn Actor (submenu2)
    Position +200x +0Y (relative to actor)

    Timer: After 3 seconds: Spawn Actor (submenu3)
    Position +200X -50Y (relative to actor)

    Obviously the position of spawn depend on the size of your submenu and the time depends on how long you want it to take for each submenu to pop up afterwards.

    Hope this is what you were after
  • RHRH Member Posts: 1,079
    Sorry for this second post but why on earth is it not registering my post above :/
  • CatOnAKeyboardCatOnAKeyboard Member Posts: 39
    Well your rules setup seem pretty straightforward to do exactly what you don't want it to do!

    You seem to have those submenus to be destroyed when MenuActive is false, and you have a rule that sets MenuActive to false! My advice would be to change it like this:

    Menu:
    Rule1:
    If MenuActive == true and mouseButtonDown and MousePositionInisde:
    -- Change MenuActive := false
    -- spawn submenus

    Rule2:
    If MenuActive == false and mouseButtonDown and MousePositionInisde:
    Change MenuActive := true

    Submenu:
    Rule:
    If MenuActive == true
    -- Destroy self

    If this still doesnt work, you may have to add additional, very specific logic controls like nested rules that check if the mouse WAS down, but NOW it is up, etc. Hopefully you wont have to do that.

    Good Luck!
  • SilverApeSilverApe Member Posts: 4
    Hi CatOnAKeyboard,

    Thanx for your help.

    My method was basically the same, only I used the Menu active in a different way (active = true, inactive (no subs) = false).
    Now I have tried the way you mentioned but it does the same thing.

    Actually it does some strange things.

    Sometimes the submenu's come up and disappear immediately, the next time (click) they stay but on my next click they also stay (they should go away then) and double and double and.... (I see that in the shadow of the menu, it gets darker). This happens randomly, although the immediate disappearing more often.

    Should be easy to make an appearing menu, doesn't it?

    I just started a couple off weeks ago with GS, so probably I am doing something wrong.

    Any help is much appreciated.

    Aaron
  • RHRH Member Posts: 1,079
    ARGG, sorry for this but it is really annoying me, for some reason nobody else can see the reply I posted 24 hours ago
Sign In or Register to comment.