How do I make my keyboard based menu work?

0 favourites
  • 5 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I'm working on a menu that works using the keyboard.

    For example [Option1] - [Option2] - [Option3] - [Option4]

    (When [Option1] is highlighted, you press -> and [Options2&3] aren't visible, jump to [Option4])

    My problem is that, when [Options2&3] are visible. When I press -> It works so fast that the [Options2&3] dont even highlight and jumps directly to [Option4].

    I know it works because if I remove [Option4] it jumps to [Option3], and if [Options3&4] are removed, [Options1&2] move perfect

    -Thanks for your help and time-

  • Could you share your code?

    Are you using "On key pressed" events or "Is key down"?

    "On" events are triggered once.

    "Is" events are triggered many times a second, which could cause that problem of yours.

  • Could you share your code?

    Are you using "On key pressed" events or "Is key down"?

    "On" events are triggered once.

    "Is" events are triggered many times a second, which could cause that problem of yours.

    Thanks for taking your time, I solved it like 15 minutes ago.

    My previous code was something like (When menu opens, highlight [option1])

    (If [option1] is highlight and -> is pressed, turn [option1] off and check if [option2] is visible and highlight it. If [option2] is not visible, highlight [option3] if visible. If not, highlight [option4]

    Now I created a numeric global variable and it works.

    Its something like (if GlobalVar = 1, highlight [option1])

    On -> pressed, add 1 to global variable if [option2] is visible, etc, etc.

    -Hope anyone with the same problem benefits from this Post-

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am curious, how did you create it? did you make it into a state engine (ex. Default Var is X, IF x, then y, IF xy, then yx)?

  • I am curious, how did you create it? did you make it into a state engine (ex. Default Var is X, IF x, then y, IF xy, then yx)?

    Default Var = 0

    set [option1] highlight when Global Var = 0

    set [option2] highlight when Global Var = 1

    set [option3] highlight when Global Var = 2

    if [option1] is highlight and you press -> , add 1 to Global Var

    if [option2] is highlight and you press <- , subtract 1 from Global Var

    When you close the menu, set Global Var to 0

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