Jump to content

Allow keys to propagate up to the browser


Gab648
 Share

Recommended Posts

Hi,

I want to allow a key that was added with "theKey = game.input.keyboard.addKey(Phaser.Keyboard.A)" to be propagated up to the browser without having to remove the key capture with "game.input.keyboard.removeKeyCapture(Phaser.Keyboard.A)".

I want to do this because on the page where the Phaser window is, there is also a comment section where those letters actually can not be typed.

I do not want to remove key capture because then I will need to use "theKey.onDown.add(function)" and this function will only be called one time ( I want the key to repeat some action as long as it is pressed down ).

Here is the said project, where the key "A", named "p1.leftKey", is used to move the first player's canon ( as you can see on line 448 in the script.js file : "if(p1.leftKey.isDown){p1.canon.rotation -= 0.02;}", wich is in the update function ).

script.js

Link to comment
Share on other sites

Hello,

basically you want to keep keyCapture but you also don't want to keep key capture? That's what I got from your post :-). Kind of hard to do both at the same time considering they are exlusive.

There are some other posts (I remember this one which leads to another one if needed) which are tackling the same problem as you have just encountered feel free to go throug them, possible solution is there somewhere too.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...