Last keycode pressed with expression not possible?

  • Hey all

    Trying to put on expression in condition "on key code pressed"(keyboard plugin) many keycodes with | between them as "OR" but it's not working... why?

    example: 49|50|51|52

  • This comes up a lot. You can’t do some thing like

    Key = 40 | 41

    You have to do

    Key=40 | key=41

    The reason is because or is treated like an operator like +. The two numbers get or’d together which isn’t what you wanted in your op.

  • This comes up a lot. You can’t do some thing like

    Key = 40 | 41

    You have to do

    Key=40 | key=41

    The reason is because or is treated like an operator like +. The two numbers get or’d together which isn’t what you wanted in your op.

    Oh, ok then thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • actually no success, key isn't an expression, how do I make in the condition of the picture to trigger either key code 49 50 or 51 is pressed without adding 3 conditions for each key code?? possible or not??

  • First condition:

    Keyboard-> On any key pressed

    Second condition:

    System-> Compare two values -> (Keyboard.LastKeyCode=49 | Keyboard.LastKeyCode=50 | Keyboard.LastKeyCode=51) =1

  • First condition:

    Keyboard-> On any key pressed

    Second condition:

    System-> Compare two values -> (Keyboard.LastKeyCode=49 | Keyboard.LastKeyCode=50 | Keyboard.LastKeyCode=51) =1

    thanks!

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