Game Development Reference
In-Depth Information
Figure 6-4.
Texture Packer supports multiple platforms
The next options are for naming and exporting your texture and data filenames, and an option for choosing the
texture file type, which will be defaulted to
.png
. You can then publish your files by selecting
File
➤
Publish,
or by
selecting the
Publish
button in the top tool bar. The result will be what you saw in Listing 6-1 and Figure
6-1
.
You've already seen how these assets are used to create a
SpriteSheet
object. Now you need to actually
do
something with this object and start displaying your sprites on the stage. This is done by using the
Sprite
class.
Sprite Class
The
Sprite
class is a display object that is used to display a frame, or a sequence of frames defined in a
SpriteSheet
object. The following is an example of how to create a sprite and add it to the stage:
var spritesheet = new createjs.SpriteSheet(data);
var frank = new createjs.Sprite(spritesheet,'frank');
stage.addChild(frank);
stage.update();