Sprite Sheets
- Doing “Tribble” way by adding in the picture with a bit of code and having the class handle it is fine, but if you add lots of instances of that class the iPod will start to run slow
- Sprite sheets make this less of a problem
- Sprite sheets
- A larger image that holds many smaller images in a power-of-2 dimension.
- A secondary file is then used to define the dimensions of each of the smaller sprites on the sheet
- This helps because then all the sprite images are loaded at once and it is easy to call for a specific picture in the whole sheet.
- Using Zwoptex
- Program to make the process of making spritesheets a lot easier by automatically put it in a power-of-two dimensional page
- Fairly straight forward once you have tweaked settings
- Import the pictures
- They will be stuck together
- Tweak settings to what we want then click “Apply” to make Zwoptex make the spritesheet
- Before clicking “Apply” make the spritesheet large enough for all the images to fit on the screen, but make it the smallest possible for the best results
- Once you have added all the pictures Zwoptex will crop down the images to be the smallest possible so they might not line up which is okay because cocos2d will compensate with the offset to realign the images
- Padding
- It is basically talking about how many pixels separate each picture
- Recommended to just use the default 2 pixel padding
- Once done with these steps click File => Save which saves it in a ZSS file. Then click the “Publish” button which will create a .png and .plist file for the sprite sheet
- .png is the actual image that holds all the spritesheets
- .plist holds all the information about which image is which
- talk about dimensional stuff if necessary
No comments:
Post a Comment