TexturePacker and Corona SDK

I used TexturePacker to organize some of my art work for Rolly Bear World. In the Rolly Bear World game the player needs to move around different platforms to guide Rolly Bear to the treasure chest. All the objects which can be dragged and moved by the player I included in one single image sheet using TexturePacker. Why? TexturePacker is a great tool to keep your project organized so you don’t get to many image files in your project; as TexturePacker creates one image sheet with a large part of my art work it saves memory and thus increase the performance of the game. Lets not forget it is super easy to create the required @2x files for re-scaling across devices. If you missed the discussion around re-scaling for different devices read this post.

In case you you dont use TexturePacker yet for your Corona SDK developments, check it out here: http://www.codeandweb.com/texturepacker/.

Step 1: Drag your image folder into Texture Packer.

When you open TexturePacker you see the screen below. Drag and drop you art files into the right container.

Step 2: You should see now your images files sorted on the right and a preview in the middle container.

Step 3: Make your sheet ready for @2x (or multiple device resolution)

Go to AutoSD and select Corona SDK and set main extension to @2x.

Step 4: Set the name of your files

TexturePacker will create two files. A .PNG file containing all your images in one sheet and a .lua files which have the references to each of the images in the sheet. Both files you need to export to your project folder. Note that TexturePacker requires you to have the correct Corona SDK naming convention of @2x for re-scaling across devices. Good stuff!

Step 5: Publish

Publish the files into your game project folder of your game. TexturePacker provides a dialog window with the progress and status.

You should now have in your game project folder the four files: two .lua and two .PNG. files In my case platform platformsheet.lua and platformsheet.png (and the an additional two with the @2x convention).

An important tip is to save your TexturePacker project as by hitting save in the menu bar. This saves your project as a .tps file. This makes it easy to make later on changes without starting completely over. I lost my project before because I didn’t know you needed to save the project separately. Maybe something which will be fixed in a future release of TexturePacker.

In this post you can find the tutorials to include your texturepacker work into your code.

You can view this post also on GitHub.


Where I am? After a few days Kuala Lumpur we traveled to Hat Yai in Thailand and we took a bus to Pak Bara to take a ferry to Koh Lipe. We stayed overnight in Pak Bara which turned out to be my worst night so far on the trip. It took us 10 hours in total. We stayed at a place called Marina Resorts (don’t let the name mislead you though). This was the most horrible place I ever stayed in. Besides the cockroaches which was the least of our problems the room and bed was the most filthy place I ever saw in my life. I thought for a moment to check-out immediately but then again, this is part of our adventure. The next morning we took a boat to the Thai island Koh Lipe, which is the most southern Thai island. In contrast with Phuket this place is actually not over developed by tourist attractions and bars. It’s a true paradise and we decided to stay at least one day longer that we planned before heading out more north to Ko Kradang (an even more secluded island).

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>