mirror of
https://github.com/wassname/phaser.git
synced 2026-08-19 12:30:07 +08:00
New Input handler implemented.
This commit is contained in:
@@ -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,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() {
|
||||
|
||||
Reference in New Issue
Block a user