What am I doing wrong - 'else' command

0 favourites
  • 6 posts
From the Asset Store
In this game you will command the character by voice command.
  • How come the below block of code works and the above block of code does not work?

  • The little green arrow indicates that the "On key pressed" is a trigger, which works differently than a regular event. It gets called outside of the main script loop. The second way is the most appropriate mechanism to use.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hm, seems really awkward to create many menus then?

    If UI # 1 (main menu) is up, then hitting arrows should let you do X

    If UI # 2 (sound menu) is up, then hitting buttons should let you Y

    If UI #3 (inventory) is up, then hitting buttons should let you do Z

    You could only do a single trigger and cascade actions based on what menu was up?

  • You can use Groups to toggle whole groups of events.

    For #1, The "Main" group would be active, all others inactive.

    For #2, the "Sound" group would be active, all others inactive.

    etc.

  • Hm, but if the Sound group is a sub-menu within the Main menu, I'm still having issues where commands cascade. For example, when I hit Enter it goes through several menus. I would really like to do something like:

    If Menu 1 is up,

    -arrows move up and down

    -if enter pressed while sound selected, go into Menu 2

    -if enter pressed while display selected, go into Menu 3

    else If Menus 2 is up

    -if enter pressed, toggle volume

    else if Menu 3 is up

    -if enter pressed, toggle display

    It sounds like the only alternative is to say

    -if enter pressed,

    if on menu 1, do x

    if on menu 2, do y

    if on menu 3,do z

    But this gets really unintuitive quickly with a lot of menus and multiple controls per menu (e.g., enter, arrows, left, right, gamepad controls, etc)

  • This would happen if you enable the group and then that group's code is turned on so the same event is triggered in the next group, just due to timing. If you put a Wait 0 before the activate, it will get delayed until the end of the event sheet, and will only get picked up next time.

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