This small guide shows you how to fully integrate TexturePacker into XCode. This is what really saves time: You use 5 minutes to set things up and never care about sprite sheets anymore!
Advantages:
–scale 0.5 from the script.This script is for TexturePacker 1.1.0. Please upgrade to this version if you still have an older one.
#! /bin/sh
TP="/usr/local/bin/TexturePacker"
if [ "${ACTION}" = "clean" ]
then
echo "cleaning..."
rm ${SRCROOT}/resources/sheet1.png
rm ${SRCROOT}/resources/sheet1.plist
rm ${SRCROOT}/resources/sheet1-hd.png
rm ${SRCROOT}/resources/sheet1-hd.plist
# ....
# add all files to be removed in clean phase
# ....
else
echo "building..."
# create hd assets
${TP} --smart-update \
--format cocos2d \
--data ${SRCROOT}/resources/sheet1-hd.plist \
--sheet ${SRCROOT}/resources/sheet1-hd.png \
${SRCROOT}/assets/sheet1/*.png
# create sd assets from hd sprites
${TP} --smart-update --scale 0.5 --max-size 1024 \
--format cocos2d \
--data ${SRCROOT}/resources/sheet1.plist \
--sheet ${SRCROOT}/resources/sheet1.png \
${SRCROOT}/assets/sheet1/*.png
# ....
# add other sheets to create here
# ....
fi
exit 0
The importan thing is that you don't forget –smart-update because this enables a check for not creating the
sheets if nothing is to be done.
If you use sd only remove the hd part and use
# create sd assets from sd sprites
${TP} --smart-update --max-size 1024 \
--format cocos2d \
--data ${SRCROOT}/resources/sheet1.plist \
--sheet ${SRCROOT}/resources/sheet1.png \
${SRCROOT}/assets/sheet1/*.png
instead.
You can add the script to your XCode source tree to be able to change the settings without using an external editor.