Sign in to follow this  
Gab648

Allow keys to propagate up to the browser

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.