Bug or not?

0 favourites
  • 9 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hello everyone,

    I'm not sure if this is a bug or i missed something.

    For example, we have the following Object types:

    - Button, named LeftButton

    - Button2, named RightButton

    - Keyboard

    - Text

    If LeftButton or left arrow on Keyboard is pressed, text "Left" should be printed,

    If RightButton or right arrow on Keyboard is pressed, text "Right" should be printed.

    After running, it works if we start with keyboard arrows, but after clicking on butttons keyboard doesn't work anymore and the black frame is printed around button. Below is the code screenshot.

  • Definitely not a bug. It's not working as expected because those are button click events (indicated by the green arrow next to it). So that means they will only ever run when the button is clicked. So I would expect your keyboard controls to not work at all.

    The "Or" condition has no effect on the whole event. You're basically saying "When the button is clicked, do these action, but only if the keyboard key is up or down (which is always true).

    The solution is just to create 4 events instead of 2:

    On Left Button Clicked

    On Right Button Clicked

    On Left Arrow Key Pressed

    On Right Arrow Key Pressed

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello Fib, thank you very much for reply.

    Just tried with 4 events, as you said, but got the same - keyboard does not work after clicking on any button. Or did I misunderstand something?

  • Tried and with "Keyboard is pressed" instead "Keyboard is down", but got the same situation.

  • Buttons are HTML elements that float over the canvas, so when you press a button, the keyboard focus is sent to the button. Just make your own sprite buttons to avoid this issue.

    Alternately, you can call Button->Set unfocused

  • OHHHHH I see what your issue is. You ARE experiencing a bug where once a form control got focus, you couldn't return focus to the canvas.

    That bug was fixed in beta r203.

    So you can either wait until the next stable release (probably 1 - 2 weeks away), or just use the latest beta release.

  • in r203 you still need to click somewhere else on the screen to unfocus the button, or use "set unfocused" action.

    And one other thing - "Key is down" is a continuous condition. If you need to execute this event only once when the key is pressed, you need to use "On key pressed" event:

    On Button Clicked 
    OR On Keyboard Key Pressed
    
  • Thank you colleagues blackhornet, Fib and dop2000 very much for the detailed explanation and help.

    I solved this problem with Button->Set unfocused, after clicking, as you suggested.

    Best regards

  • I expressed myself badly. You solved this problem, not I.

    Thank you again and all the best.

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