mirror of
https://github.com/photonstorm/phaser
synced 2024-12-13 14:53:01 +00:00
34 lines
589 B
JavaScript
34 lines
589 B
JavaScript
|
|
||
|
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);
|
||
|
|
||
|
}
|