Texture Packer for cocos2d, written in Python.
Not much yet, so far:
- Sprite packing with a choice of two extremely basic algorithms
- Generates plist for cocos2d
- Algorithms can choose to rotate sprite (one algorithm does this already)
[sudo] python setup.py install
The sprite is definied in a config file. To get started, create an empty config file:
sprite-packer -n test.cfg
Now, edit this appropiately, save it and run
sprite-packer test.cfg
Your sprite and plist will now be generated.
- Python 2 (2.5 or newer)
- PIL
- In Xcode 4, click your project target and select the 'Build Phases'.
- Click 'Add Build Phase'.
- Move this up above 'Compile Sources' and below 'Target Dependencies'.
- You can let the shell be '/bin/sh'.
- Finally, enter the code here below.
Code:
exec sprite-packer path/to/config.cfg
I had some problems with this though, because it seems that Xcode loads its PATH from a different place. You could either fix this somehow or be lazy like me and just use absolutes to find the right stuff (I also had to add 'exec /path/to/python' to get it to run my macports python).
The config path is relative to your projects top-most folder (the one that houses the .xcodeproj folder). To double check where this is, add this to the shell script:
echo $PWD