2013-04-18 14:48:06 +00:00
|
|
|
/// <reference path="../../Phaser/Game.ts" />
|
2013-04-18 13:16:18 +00:00
|
|
|
(function () {
|
|
|
|
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
|
|
|
|
function init() {
|
|
|
|
myGame.loader.addImageFile('teddy', 'assets/pics/profil-sad_plush.png');
|
|
|
|
myGame.loader.load();
|
|
|
|
}
|
|
|
|
var teddy;
|
|
|
|
function create() {
|
2013-05-22 23:36:53 +00:00
|
|
|
teddy = myGame.add.sprite(0, 0, 'teddy');
|
2013-04-18 13:16:18 +00:00
|
|
|
teddy.x = myGame.stage.centerX - teddy.width / 2;
|
|
|
|
teddy.y = myGame.stage.centerY - teddy.height / 2;
|
2013-04-20 02:40:17 +00:00
|
|
|
teddy.renderDebug = true;
|
2013-04-18 13:16:18 +00:00
|
|
|
}
|
|
|
|
function update() {
|
|
|
|
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
|
2013-04-19 17:53:21 +00:00
|
|
|
teddy.angularAcceleration = -40;
|
2013-04-18 13:16:18 +00:00
|
|
|
} else if(myGame.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
|
2013-04-19 17:53:21 +00:00
|
|
|
teddy.angularAcceleration = 40;
|
2013-04-18 13:16:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})();
|