CTRL+W and other browser shortcuts

  • Hey guys.

    Currently, browser shortcuts kind of limit what controls you can use. For instance, right now when you crouch and jump in my game you close the tab, which is a bit annoying. Browsers have sort of claimed all the convenient key combinations to do annoying things. Is there any way for Construct to disable browser shortcuts, or at least prevent the CTRL+W shortcut? Because right now that's the most annoying one for me.

  • According to the manual entry about the keyboard plugin browsers shortcuts should be intercepted. Maybe Ashley forgot about Ctrl+W.

    Or maybe it's some browser trickery once again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • From the manual:

    f any events exist for 'On key pressed' with a given key, Construct 2 blocks the browser from performing its normal action. For example, if you wish to prevent space bar scrolling down the page, add an empty 'On Space pressed' event, if you don't have one already.

    So if you add an empty 'On W pressed' event it should block it, but that particular combination may not be blockable for security reasons (so web pages cannot make it difficult to leave the page). You might need to adjust the controls...

    Behaviors using default controls block their keypresses as well, but not custom control behaviors without 'On key pressed'. Also the 'Is key down' does not block the key, only 'On key pressed', since it's too late for Construct 2 to block the key in 'Is key down'.

  • Awesome.

    <img src="http://dl.dropbox.com/u/36472942/construct/forumhelp/ctrl_w.png" border="0" />

    I had tested this trick but made the mistake of putting another "On ctrl down" in the blank event.

    Thanks for the clarification/demonstration

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