New Input handler implemented.

This commit is contained in:
Richard Davey
2013-05-16 02:36:58 +01:00
parent ce7bfd1fc2
commit 3cdd2baff0
31 changed files with 3048 additions and 2029 deletions
+6
View File
@@ -3,10 +3,12 @@
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
function init() {
myGame.loader.addTextureAtlas('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
myGame.loader.addTextureAtlas('atlas', 'assets/pics/texturepacker_test.png', 'assets/pics/texturepacker_test.json');
myGame.loader.load();
}
var bot;
var bot2;
var car;
function create() {
// This bot will flip properly when he reaches the edge
bot = myGame.createSprite(myGame.stage.width, 300, 'bot');
@@ -18,6 +20,10 @@
bot2.animations.add('run');
bot2.animations.play('run', 10, true);
bot2.velocity.x = -150;
// Flip a static sprite (not an animation)
car = myGame.createSprite(100, 400, 'atlas');
car.frameName = 'supercars_parsec.png';
car.flipped = true;
}
function update() {
if(bot.x < -bot.width) {
+7
View File
@@ -7,12 +7,14 @@
function init() {
myGame.loader.addTextureAtlas('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
myGame.loader.addTextureAtlas('atlas', 'assets/pics/texturepacker_test.png', 'assets/pics/texturepacker_test.json');
myGame.loader.load();
}
var bot: Phaser.Sprite;
var bot2: Phaser.Sprite;
var car: Phaser.Sprite;
function create() {
@@ -28,6 +30,11 @@
bot2.animations.play('run', 10, true);
bot2.velocity.x = -150;
// Flip a static sprite (not an animation)
car = myGame.createSprite(100, 400, 'atlas');
car.frameName = 'supercars_parsec.png';
car.flipped = true;
}
function update() {