Browser Focus / KeyDown Problem - is there a solution?

0 favourites
  • 2 posts
From the Asset Store
This is a single chapter from the Construct Starter Kit Collection and the Student Workbook from the Workshop.
  • Hi, I submitted this as a bug report but the issue is caused by the browser having no access to key down and key up triggers when it is not in focus.

    Have a look at this simple example and you'll see that, if a key is down when the browser becomes out of focus, the c2 engine never receives a key up trigger - so when you return to the game it continues as if the key is still being continually pressed, even though it is not!

    When running in a browser tab this can be detected by the Page is Visible Browser condition, but if you run a game in a stand-alone browser- or NW window - then nothing gets triggerd that can be detected by c2. This is a real problem when running a game in NW... and I can't think of a robust work-around to detect when something else on the desktop has been put into focus.

    I have tried using the Browser: On Suspended / On Resumed / Page is Visible conditions. However, none of these work when the browser/NW window is stand-alone, they only register when if page/tab/window is minimized...

    Is this a limitation of javascript - that there is never going to be a way to detect a key-up condition if that change happened when the window was out of focus, or is this a bug in the Browser object, because the Page is Visible is not detecting all out of focus conditions?

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A small Friday night bump back to the top.

    The more I think about this, the more of a potential problem this could be for non-browser (NW) based games if they are not always played in full screen. Anyone for trying to sell a game with apparently run-away controls? No, me neither... :/

    spongehammer - I tag you here because it appears that my earlier advice about your game in immediate full screen might not have been the best advice after all.... Sorry!

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