Game Development Reference
In-Depth Information
Figure 6-16. Sprite sheet export screen in Flash CC
As you can now see, you can export multiple animations into a single sprite sheet by exporting directly out of
the Flash IDE. As convenient as this is, it's even more convenient that the data exported for the sprite sheets will
also create the necessary SpriteSheet and Sprite objects for you. Because of this, you want to make sure that you
give each movieclip an instance name that will make sense in your game. In this case, the coin instances are named
GreenCoin , YellowCoin , and PinkCoin .
Let's take a look at the data exported from Flash in Listing 6-8, which is written to the generated coins.js file.
Listing 6-8. Objects Extending Sprite Class, Generated from Flash CC
(function (window) {
GreenCoin = function () {
this.initialize();
}
GreenCoin._SpriteSheet = new createjs.SpriteSheet({images:["coins.png"],
frames:[
[0, 0, 78, 78, 0, 38.4, 38.5],
[78, 0, 78, 78, 0, 38.4, 38.5],
[156, 0, 78, 78, 0, 38.4, 38.5],
[234, 0, 78, 78, 0, 38.4, 38.5],
[312, 0, 78, 78, 0, 38.4, 38.5],
[390, 0, 78, 78, 0, 38.4, 38.5],
[468, 0, 78, 78, 0, 38.4, 38.5],
[546, 0, 78, 78, 0, 38.4, 38.5]
]});
 
Search WWH ::




Custom Search