Travis Posted October 27, 2013 Share Posted October 27, 2013 Whenever I press spacebar, my screen scrolls down This happens even when I've just clicked in the canvas. Maybe it has something to do with the way the web page is set up? Link to comment Share on other sites More sharing options...
Mike Posted October 27, 2013 Share Posted October 27, 2013 Oohhh I can help you this was a one of my first reports/requests long ago. So what you have to do is to tell phaser to stop the event from propagating up to the browser. http://gametest.mobi/phaser/docs/Phaser.Keyboard.html addKeyCapture(keycode) And example how i use it: in function preload() {...} var arPreventedKeys = [ Phaser.Keyboard.SPACEBAR, ,Phaser.Keyboard.UP ,Phaser.Keyboard.DOWN ,Phaser.Keyboard.LEFT ,Phaser.Keyboard.RIGHT ]; game.input.keyboard.addKeyCapture(arPreventedKeys);Edit I just saw that your complain is about the examples... well maybe rich should add it to all examples Link to comment Share on other sites More sharing options...
rich Posted October 27, 2013 Share Posted October 27, 2013 It's added automatically when you use the addKey command or addCursors (this is in the 1.1.1 release now in master), but otherwise it needs to be set manually yes. I did ought to add it to any other examples not using that approach, although there shouldn't be many. Will sort it out next week, but I'm adamant that the default for Phaser should be that it DOESN'T prevent all keyboard input from propagating. Link to comment Share on other sites More sharing options...
Recommended Posts