2013-07-13 11:38:59 +00:00
|
|
|
/// <reference path="../../Phaser/Game.ts" />
|
|
|
|
(function () {
|
2013-08-08 03:35:13 +00:00
|
|
|
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update);
|
|
|
|
function preload() {
|
2013-08-02 17:32:26 +00:00
|
|
|
// Texture Atlas Method 2
|
2013-07-13 11:38:59 +00:00
|
|
|
//
|
|
|
|
// In this example we assume that the TexturePacker JSON data is a real json object stored as a var
|
|
|
|
// (in this case botData)
|
2013-08-02 17:32:26 +00:00
|
|
|
game.load.atlas('bot', 'assets/sprites/running_bot.png', null, botData);
|
2013-07-13 11:38:59 +00:00
|
|
|
}
|
|
|
|
var bot;
|
|
|
|
function create() {
|
2013-08-02 17:32:26 +00:00
|
|
|
bot = game.add.sprite(game.stage.width, 300, 'bot');
|
2013-07-13 11:38:59 +00:00
|
|
|
bot.animations.add('run');
|
|
|
|
bot.animations.play('run', 10, true);
|
|
|
|
}
|
|
|
|
function update() {
|
2013-08-02 17:32:26 +00:00
|
|
|
bot.x -= 2;
|
2013-08-13 03:22:24 +00:00
|
|
|
if(bot.x < -bot.width) {
|
2013-08-02 17:32:26 +00:00
|
|
|
bot.x = game.stage.width;
|
2013-07-13 11:38:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
var botData = {
|
|
|
|
"frames": [
|
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0000",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 34,
|
|
|
|
"y": 128,
|
|
|
|
"w": 56,
|
|
|
|
"h": 60
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 2,
|
|
|
|
"w": 56,
|
|
|
|
"h": 60
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0001",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 54,
|
|
|
|
"y": 0,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 3,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0002",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 54,
|
|
|
|
"y": 58,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 3,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0003",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 192,
|
|
|
|
"w": 34,
|
|
|
|
"h": 64
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 11,
|
|
|
|
"y": 0,
|
|
|
|
"w": 34,
|
|
|
|
"h": 64
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0004",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 64,
|
|
|
|
"w": 54,
|
|
|
|
"h": 64
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 1,
|
|
|
|
"y": 0,
|
|
|
|
"w": 54,
|
|
|
|
"h": 64
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0005",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 196,
|
|
|
|
"y": 0,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 3,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0006",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"w": 54,
|
|
|
|
"h": 64
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 1,
|
|
|
|
"y": 0,
|
|
|
|
"w": 54,
|
|
|
|
"h": 64
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0007",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 140,
|
|
|
|
"y": 0,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 3,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0008",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 34,
|
|
|
|
"y": 188,
|
|
|
|
"w": 50,
|
|
|
|
"h": 60
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 3,
|
|
|
|
"y": 2,
|
|
|
|
"w": 50,
|
|
|
|
"h": 60
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0009",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 128,
|
|
|
|
"w": 34,
|
|
|
|
"h": 64
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 11,
|
|
|
|
"y": 0,
|
|
|
|
"w": 34,
|
|
|
|
"h": 64
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
{
|
|
|
|
"filename": "running bot.swf/0010",
|
2013-08-13 03:22:24 +00:00
|
|
|
"frame": {
|
|
|
|
"x": 84,
|
|
|
|
"y": 188,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"rotated": false,
|
|
|
|
"trimmed": true,
|
2013-08-13 03:22:24 +00:00
|
|
|
"spriteSourceSize": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 3,
|
|
|
|
"w": 56,
|
|
|
|
"h": 58
|
|
|
|
},
|
|
|
|
"sourceSize": {
|
|
|
|
"w": 56,
|
|
|
|
"h": 64
|
|
|
|
}
|
2013-07-13 11:38:59 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"meta": {
|
|
|
|
"app": "http://www.texturepacker.com",
|
|
|
|
"version": "1.0",
|
|
|
|
"image": "running_bot.png",
|
|
|
|
"format": "RGBA8888",
|
2013-08-13 03:22:24 +00:00
|
|
|
"size": {
|
|
|
|
"w": 252,
|
|
|
|
"h": 256
|
|
|
|
},
|
2013-07-13 11:38:59 +00:00
|
|
|
"scale": "0.2",
|
|
|
|
"smartupdate": "$TexturePacker:SmartUpdate:fb56f261b1eb04e3215824426595f64c$"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
})();
|