Welcome to my Programming Blog...

I am currently working on a couple of projects: An original game called "Implosion" which I am porting from Flash to the iPad, and a remake of Q*bert in Python (pygame), as part of the class I am teaching. Please feel free to use the "Labels" (at right) to follow a specific project or theme. If you are one of my Python students, I recommend that you check out the Python thread.

Thursday, January 13, 2011

Sprite Sheets and Zwoptex

Here are some notes from Matt on using Zwoptex and making sprite sheets in your program:

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