Using same button/command to different events

This forum is currently in read-only mode.
From the Asset Store
Voice command game
$9.50 USD
50% off
In this game you will command the character by voice command.
  • I have tried to learn the program myself as best as possible without asking any help. But now I have run into a same problem so many times that I really need to ask some.

    So the problem is very simple actually:

    I would like to know how to, for example turn something on and off with a same command. For example when pressin "escape", "pause menu" is set to "visible". And when pressing "escape" again, it's set to "invisible".

    I made this simple example file if someone is kind enough to show how it works:


    So in this example file there is a blue box. Now when You press a "Enter" the blue box is set to visible. So what I wold like to happen is when You press "Enter" again, the blue box is set to "invisible".

    And so that this keeps on going everytime when pressin "Enter", like in a "pause menu" case.



  • Here is your amended .cap. Hope it's what you want.

    Event shown below:

    <img src="" border="0">


  • This works. Thank You.

    Now I have to figure out how to make it work with more complicated stuff like sounds and etc.

    But now that I have somekind of a start It shouldnt be too hard. Thanks again

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The approach I use is to have a private variable for the menu, which is toggled with the key.

    on key enter pressed - set object.value('menu') to 1 - object.value('menu')

    Now with this you can have event stacked under each value.

    object.value('menu') = 0

            -make box invisible

            -enable player movement

            -disable mouse

            -disable mouse

            -disable menu events

            -disable etc

    object.value('menu') = 1

            -make box visible

            -disable player movement

            -enable mouse

            -run menu events


    I actually made an example of this the other day

  • i'm always using same method as Steven


    + MouseKeyboard: Key Space is down
    -> Sprite: Add 1 to 'do_stuff'
    + Sprite: Value 'do_stuff' Equal to 0
    -> "do something"
    + Sprite: Value 'do_stuff' Equal to 1
    -> "do something else"
    + Sprite: Value 'do_stuff' Equal to 2
    -> Sprite: Set 'do_stuff' to 0

    It makes some kind of a loop :)

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