First, when you add sprites by folder like this, Texture Packer doesn’t add references to the individual sprites, it adds a reference to the folder. On the right hand side, you can see all of the images imported into Texture Atlas and click on each one to see the bounding box – another handy feature!Ī few notes about adding images using the Add Folder option, by the way. Texture Packer will load the images and intelligently lay them out within the sprite sheet as follows: Now, click the Add Folder button in the top toolbar and choose the TextureFun/TextureFun_Art/sprites folder. Agree to the license prompt and when you see the first popup that appears, choose “Test Pro for 1 week” to continue. When you download the DMG, and open the package and agree to the license, drag the TexturePacker icon to the Applications folder and follow the prompts to install Texture Packer on your machine.Īfter you finish installing, click on Texture Packer in your Applications folder to run it. There is a lite version that will work for this tutorial but you will quickly see the advantages of this great tool and want to use the full featured version. The first thing you need to do is download a copy of Texture Packer. Ok, now that you have a project template and some sample art to work with, time to make a sprite sheet using Texture Packer! Creating a Sprite Sheet with Texture Packer Download this sample artwork I gathered together, and after you unzip it, drag the entire directory as a subfolder of your TextureFun project source code folder, as shown in the image below. Next, you’ll need some images to make the sprite sheets. Expand the dropdown and select only the last four files ( main.m, AppDelegate.m, HelloWorldLayer.m, and IntroLayer.m), then click Check and finish the steps of the wizard. Just go to Edit\Refactor\Convert to Objective-C ARC. You are going to use ARC in this project, but by default the template isn’t set up to use ARC. Once you’ve got that installed, start up Xcode and make a new project with the iOS\cocos2d v 2.x\cocos2D iOS template, and name the project TextureFun. So first make sure that you have the latest “unstable” version of Cocos2D v2.x installed. Like I said, even though this is a Texture Packer tutorial, I wanted to show you an example of this working in an actual game, so we’ll be using Cocos2D for that. If you’re curious to learn more about Cocos2D, check out some of our other Cocos2D tutorials. If you are new to Cocos2D, you can still follow along with this Texture Packer tutorial, but there may be some missing gaps in your knowledge about Cocos2D itself as the focus will be on TexturePacker. This Texture Packer tutorial will show you how to use Texture Packer to create and optimize sprite sheets in your games, using a Cocos2D 2.X game as an example.Īlong the way, you’ll learn how to use pixel formats and Texture Packer wisely to make sure your games launch quickly, run smoothly, and use as little memory as possible – while still looking good! When making 2D games, it’s important to combine your sprites into large images called sprite sheets, in order to get the best performance for your games.Īnd Texture Packer is a great tool that makes it extremely easy to generate these sprite sheets – with the click of a button. Update : Fully updated for Cocos2D 2.1-rc0a, Texture Packer 3.07, and Modern Objective-C style (original post by Ray Wenderlich, update by Tony Dahbura). TP = r"C:\Program Files\CodeAndWeb\TexturePacker\bin\TexturePacker.Optimize texture usage with Texture Packer and Pixel Formats! Using glob with wildcards allows me to select images from a folder containing many images and eliminates the need to isolate the files I want into a folder just for TexturePacker's sake. I am working from Python, so here is the script I use to create the same atlas that the sample line above will give you. The key is the list of image filenames separated only by spaces. TexturePacker -format unity-texture2d img_1.png img_2.png img_3.png img_4.png To add multiple images to a single sprite sheet, here is a sample command that will create an atlas called out.png (the default) containing images img_1 to img_4. Due to the poor TexturePacker documentation, it took me much trial and error to figure this out!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |