The Keyboard class has had a complete overhaul. Phaser.Key objects are created automatically, there are fixes against duration and keys reset properly on visibility loss.

Keyboard.removeKey has been removed. The way the new keyboard manager works means it's no longer required.
Fixes issue #462
This commit is contained in:
photonstorm
2014-02-24 15:58:02 +00:00
parent 9d9fd06392
commit d9cadc70ac
7 changed files with 191 additions and 110 deletions
+33
View File
@@ -0,0 +1,33 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
}
var text;
var key1;
var key2;
function create() {
game.stage.setBackgroundColor(0x0b7276);
game.add.text(32, 16, "SPACE");
game.add.text(32, 170, "A");
key1 = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
key2 = game.input.keyboard.addKey(Phaser.Keyboard.A);
}
function update() {
}
function render() {
game.debug.renderKey(key1, 32, 64);
game.debug.renderKey(key2, 32, 220);
}