mirror of
https://github.com/photonstorm/phaser
synced 2024-12-03 09:59:42 +00:00
23 lines
802 B
JavaScript
23 lines
802 B
JavaScript
/// <reference path="../../Phaser/Game.ts" />
|
|
(function () {
|
|
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
|
|
function init() {
|
|
// Texture Atlas Method 3
|
|
//
|
|
// In this example we assume that the TexturePacker JSON data is stored in an external file
|
|
myGame.loader.addTextureAtlas('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
|
|
myGame.loader.load();
|
|
}
|
|
var bot;
|
|
function create() {
|
|
bot = myGame.createSprite(myGame.stage.width, 300, 'bot');
|
|
bot.animations.add('run');
|
|
bot.animations.play('run', 10, true);
|
|
bot.velocity.x = -100;
|
|
}
|
|
function update() {
|
|
if(bot.x < -bot.width) {
|
|
bot.x = myGame.stage.width;
|
|
}
|
|
}
|
|
})();
|