Skip to content

SpriteSheet

何波 edited this page Feb 23, 2019 · 9 revisions

SpriteSheet

var data = {
    images: ["sprites.jpg"],
    images: [this.game.load.get('ship')]],
    frames: {width:50, height:50},
    frames: {width:64, height:64, count:20, regX: 32, regY:64, spacing:0, margin:0},
    frames: [
        // x, y, width, height, imageIndex*, regX*, regY*
        [64, 0, 96, 64],
        [0, 0, 64, 64, 1, 32, 32]
        // etc.
    ],
    animations: {
        // start, end, next*, speed*
        run: [0, 8],
        jump: [9, 12, "run", 2]
    },
    animations: {
        stand:0,
        run:[1,5],
        jump:[6,8,"run"]
    },
    animations: {
        walk: {
            frames: [1,2,3,3,2,1]
        },
        shoot: {
            frames: [1,4,5,6],
            next: "walk",
            speed: 0.5
        }
    }

};
var spriteSheet = new createjs.SpriteSheet(data);
var animation = new createjs.Sprite(spriteSheet, "run");

Clone this wiki locally