Android and iOS Apps Created by Greg Pugh – GP Animations

Latest

PhysicsEditor Review & Tutorial

Yesterday, I reviewed and went through a basic example of how to use TexturePacker. I began to wonder if enough information was given to get a new user started with the software, so for today’s review of PhysicsEditor I’ll actually be providing some code I just wrote for an iPhone app.

PhysicsEditor automatically traces images for you and then applies physics properties to each image. If you’re wondering how this is useful for games, I’m going to show you an example with oddly shaped images and apply physics to all of them. PhysicsEditor provides exporting for various platforms, but today I’ll be covering CoronaSDK.

Platforms available

The first step I did was to draw a basic rectangle in Adobe Flash to act as my ground. I then did File > Export Image > .PNG Image. I then drew three more images, a trademarked mouse shape, a trademarked half-eaten pie shape, and an obligatory heart shape. I drew these shapes because they’re not perfect circles or squares, and I thought they’d be a good example to show off PhysicsEditor’s tracing properties. I also made a basic background image of some bricks to serve as a background image since Corona’s default background is black and one of my balloon image is black.

Exporting images as PNGs in Flash

Once I had my drawings exported as PNG files, I opened PhysicsEditor and imported them. I clicked the Shape Tracer button and let the software do it’s magic. Here you can decide how precise you want PE to trace your image. The more precise, the more taxing it will be on the mobile device, so try to pick a fine balance. Also, even if you choose x number of points, you can delete and move the points later on, which I did in a few instances.

Importing PNGs into PhysicsEditor

Shape Tracer tool

PhysicsEditor tracing the shape

Manually altering the shape path

Once you have your shapes traced, you can assign a name to each shape and assign properties such as density, friction, bounce, etc. Once done, save your project and export your files to the location of your choosing.

I then opened up TextMate and saved a new document as “main.lua” (no quotes). You can use NotePad, NotePad++, TextWrangler, etc., I just prefer TextMate. I won’t get into details about the coding, but I have commented it so you’re welcome to alter and play around with it. The one thing you do need to know is that I saved my PhysicsEditor files as “balloons”, which created “balloon.pes” and “balloons.lua”.

So in the line: local physicsData = (require “balloons”).physicsData(1.0) you will swap out “balloons” for the name of you lua file PE generated for you.

Code:

– Hide Status Bar
display.setStatusBar(display.HiddenStatusBar)

– Enable physics with 4 gravity to simulate balloon falling
local physics = require(“physics”)
physics.start()
physics.setGravity(0, 4.0)

– Import PhysicsEditor Data
local physicsData = (require “balloons”).physicsData(1.0)

– Insert a background image
local background = display.newImage(“bkg_bricks.png”);

– Insert Ground from Physics Editor
local ground = display.newImage(“ground.png”)
ground.x = display.contentWidth/2
ground.y = display.contentHeight – ground.contentHeight/2;
physics.addBody( ground, “static”, physicsData:get(“ground”) )

– Create walls to contain balloons
local leftWall = display.newRect (0, 0, 1, display.contentHeight);
local rightWall = display.newRect (display.contentWidth, 0, 1, display.contentHeight);
local ceiling = display.newRect (0, 0, display.contentWidth, 1);

– Add physics to the walls. They will not move so they will be “static”
physics.addBody (leftWall, “static”,  { bounce = 0.1 } );
physics.addBody (rightWall, “static”, { bounce = 0.1 } );
physics.addBody (ceiling, “static”,   { bounce = 0.1 } );

– Create the balloons and apply PhysicsEditor properties
local pacman = display.newImage(“pac.png”)
pacman.x = display.contentWidth/2;
physics.addBody( pacman, physicsData:get(“pac”))

local mouseBalloon = display.newImage(“mouseBalloon.png”)
mouseBalloon.x = pacman.x + 180
physics.addBody( mouseBalloon, physicsData:get(“mouseBalloon”))

local heart = display.newImage(“heart.png”)
heart.x = pacman.x-180;
physics.addBody( heart, physicsData:get(“heart”))

– Apply a touch target the so the balloon moves away from user taps
function moveBalloon (event)
local pacman = event.target;
pacman:applyLinearImpulse (0, -0.4, event.x, event.y);
end

– Apply this same action to every balloon
mouseBalloon:addEventListener (“touch”, moveBalloon);
pacman:addEventListener (“touch”, moveBalloon);
heart:addEventListener (“touch”, moveBalloon);

I then saved the main.lua file and opened it in CoronaSDK. Now three balloons appear that you can click/tap on and watch them interact with each other and gravity.

Trademarked Balloon App

The beauty of PhysicsEditor is that fact that it can trace complex shapes for you to save you the hassle of trying to figure out the (x,y) coordinates of each point. Not only is there a free trial, but you can also purchase both PhysicsEditor and TexturePacker as a bundle for a very reasonable price. If you have any interest in making mobile games, you should definitely pick it up.

Source Files (You’re free to alter these as much as you want, I just wouldn’t try to sell an app with the images I created if you don’t want to get sued by big corporations)

TexturePacker Review

I’ve recently discovered two new pieces of software that make creating mobile applications easier, TexturePacker and PhysicsEditor. Today, I will be reviewing TexturePacker, which turns sprite images into a neatly compiled spritesheet with corresponding files for your platform of choice.

My platform of choice is Corona SDK, so I will be covering how to implement a Flash animation into that, but TexturePacker supports a wide variety of other platforms.

TexturePacker Data Format List

For this example, I drew a very basic animation in Adobe Flash CS6. You can use any animation software you’re comfortable with, but I chose Flash because I’ve been using it since Macromedia Flash 5. In the Flash library, I converted my animated graphic symbol into a .png sequence and named it “guy”. This nine-frame animation was exported by Flash as “guy0001.png,”, “guy0002.png”, etc.

Adobe Flash CS6 Exporting as PNG Sequence

Adobe Flash CS6 Exporting as PNG Sequence

My next step was to open TexturePacker and import my newly-created sprites. I chose Corona TM SDK as my Data Format, decided where I wanted to save my Data File, and clicked Publish. That’s all I had to do on my end, which is the beauty of TexturePacker. It assembled my individual frames into a single spritesheet, and published a “guy.lua” file for me, which contains all of the data needed by Corona.

TexturePacker creating a spritesheet

I then opened TextMate and created a new “main.lua” file. I inserted some very basic Lua coding to import the sprite, position him on screen and play the animation. Just for fun, I later added some physics to him to make him bounce up and down (physics coding not pictured below).

Lua coding to insert and position the spritesheet

The final step was to open the main.lua file in CoronaSDK and there was my little orange guy bouncing up and down, waving, blinking and moving his mouth.

Animated sprite in iPhone4 simulator

Overall, my experience with TexturePacker was great. It’s easy to use, versatile, free to try, and extremely affordable. This is probably going to be my go-to software of choice for compiling spritesheets. Also, when you decide to download TexturePacker, give PhysicsEditor a shot as well. PhysicsEditor really impressed me and I will be reviewing it next.

New Blog

I will continue updating this blog and writing about mobile app development, new software and anything mobile device related. However, I also like to draw in my free time (or the lack of free time) so I figured I’d start a second blog that will serve as a journal of my illustration work.

 

You can visit the site at www.GPIllustrations.Wordpress.com.

Flash & Dreamweaver CS6 First Impressions

Adobe’s new Creative Suite 6 debuted today and I’ve decided to upgrade my Flash and Dreamweaver CS5.5. Upon installing Dreamweaver CS6, I immediately noticed that it looked almost exactly the same as CS5.5. Nothing jumped out at me as to say “Hey look what Adobe added!” and it was kind of disappointing. One window I did find that was added is the “PhoneGap Build Service” tab. This tab requires you to create a PhoneGap account and once registered, you can log in through Dreamweaver CS6. This feature lets you create native applications for iOS, Android, Blackberry, webOS and Symbian, and then you can take a picture of the QR Code to test it on your device. Pretty neat, but on the other hand, PhoneGap already existed in Dreamweaver CS5.5 and it allowed you to create native apps using HTML, CSS and JavaScript.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Flash CS6′s upgrades seem to all be for mobile development. This is fine with me because lately it’s all I’ve been using it for, but it feels a bit like Adobe has turned their backs on their animator customers. Makes me wonder if it’s time I set time aside to learn Toon Boom Animate and give up Flash for animated cartooning. The major upgrades are spritesheet exporting, JavaScript exporting through the CreateJS extension, and AIR packaging for Android apps.

 

 

 

 

 

 

 

 

 

 

 

The AIR packager was the first feature I utilized out of the gate. I had an app that I developed in Flash for my day job and I figured it’d be a great time to try it out. For those who have never published an Android app in Flash, when the user downloads and installs your app from Google Play, they must also download and install Adobe AIR before they can use your app. Now you have the option of packing AIR with your app to save your customers having to download two apps in order to use one. This of course comes at a price of an extra 9 megs or so of increase file size.

The CreateJS extension must be downloaded separately and installed through Adobe Extension Manager CS6. This allows you to publish out your Flash files as JavaScript that can be viewed without the need of a Flash Player plug-in. However, there is a learning curve to this. If your have any actions in your timeline they need to be converted to a format such as:

/* js

this.stop();

*/

Also, if you have actions for interactivity, they must now be written in JavaScript inside the exported files that Flash produces. I don’t have a lot of experience with JavaScript so this is a bit of a learning curve for me. I looked for EaselJS/CS6 tutorials, but only found videos in French and the obligatory Adobe videos that skim over anything you’d want to know.

The spritehseet exporter can be useful if you plan on developing in JSON, Starling or Cocos2D. If you don’t plan on using those, you can create your own data format using JSFL, but I have no clue how to even begin to do that. As a CoronaSDK user, I’ll probably stick to Zwoptex or SpriteHelper, but it’s nice Flash included the spritesheet exporter.

Overall I think the CS6 upgrade is nice, but it’s nothing too crazy. Maybe my opinion will change once I get to really dive into the software, but initially I wasn’t wowed by anything I’ve seen.

iPad 3rd gen vs. iPad 1

Scaling issues on iPad3 vs. iPad

Apple debuted their latest iPad last Friday and it caused some major issues for app developers such as myself. Since the 3rd generation iPad’s retina display is 4x greater than the original iPad’s, on some apps it tried to scale the images 4x as well. So many apps on the App Store now only display the lower right of apps that used to work fine on iPad1 and iPad2. This has led to a flooding of the App Store with updates from developers trying to get fixed versions of their apps to their customers before bad reviews begin to emerge. Fortunately, I have been able to fix all of my apps to work on the new iPad, but unfortunately, I have to wait for Apple to approve the updated versions. So in the meantime, anyone who already owns my apps and has a new iPad will not be able to use them. I wonder if this would have happened if Steve Jobs were still here.

Ansca Mobile Ambassador

Today I officially became an ambassador for Ansca Mobile‘s software “Corona.” You may not realize it, but a lot of the apps that you enjoy on your iPhone, iPad, Android, Kindle and Nooks are created with Corona. The reason this software is so popular is because it makes coding games and apps a lot easier than creating them with Objective-C and Java programming. Flash developers will especially have an easy time going from actionScript to Lua, the language used in Corona.

The Photoshop plug-in, Kwik writes the Lua code for you that you can test in Corona and then export directly to your mobile devices. Kwik is especially useful for people who want to make apps, but don’t want to write any coding, they just want to do the drawings and already know how to use layers in Photoshop.

However, if you are willing to dive into the Lua coding, a little goes a long way. Instead of having to write hundreds of lines of Objective-C code to program physics into an iPhone game, you can just type local physics = require ”physics” and your game will automatically have gravity programmed into it. Plus, you don’t need any special tools to get starting writing Lua code, any basic text editor such as Notepad or Text Wrangler will do.

Being a front-end designer who learned actionScript 1, 2, 3, Objective-C and Java out of necessity, I know first hand what it’s like not being a huge fan of typing hundreds of lines of code and how frustrating it can be to try to learn. With software like Corona and Kwik, the coding is minimal and you achieve great results. As usual, the more time you’re willing to spend learning Lua will yield even greater results, but the ease of the software makes it a great starting point for novice app developers and professionals alike.

If you have any questions about  Corona and/or Kwik send me an e-mail and I’ll help you get started.

Corona Ambassador badge

 

Kindle Fire Review

Samsung Galaxy Tab 7, Kindle Fire, iPad (1st Gen), Nook Color

Kindle Fire:

When I opened the packaging, I was reminded of the experience of opening an iPad box. Just the unit and a charging cable, all someone would need if the interface is designed properly. Like the iPad, you can play around with it for 5 minutes and figure out how entire experience operates without an instruction manual. As soon as it booted up, it knew I was its owner and my Amazon.com account was already tied to it. It had to install an update before it could get started, whch I thought was weird since it just came out 2 days ago.

The unit itself is sleek with only one button on the entire device, which is the power button. To adjust the volume while watching a movie you have to touch screen and then options to pause, adjust volume, or exit appear. The speed is pretty quick, much faster than a Nook Color. It has a soft backing which has some grip to it on smooth desktops and it’s almost the exact size as a Galaxy Tab 7. The only thing I don’t care for is the power cord connection to the device. It rocks back and forth when it’s inserted and feels like it might snap off at any moment. Its the same size plug as an HTC Thunderbolt so some Android smartphone users can always use one of their existing chargers. The power cord is also pretty short, so it’s hard to find a spot in the house where you can use the device while it’s charging.

The Cloud system that stores all of your digital Amazon.com purchases is nice and since the physical memory storage is so small on the Fire, I can only assume they prefer you use the Cloud service. Devices like the Nook Color and Nook Tablet utilize a microSD card, which hackers exploit to root the devices to install uncensored versions of the Android OS and Marketplace. Opting out of a microSD slot means users will have to use Amazon’s App Store and Marketplace, which will compensate for the money lost on each Kindle Fire sold. The downside of limited storage and reliance of the Cloud is that you’ll have to choose carefully what books, movies, TV shows, music, pictures and apps you actually save to the device if for some reason you’re not near a wi-fi hotspot. The good part is that wherever you have a wireless internet connection, you have access to all of your Amazon.com digital purchases.

One thing about the Kindle that I’m pleasantly surprised about is the fact that you can go into settings and allow app installs from unknown sources. This is huge for developers because you can test your .apk files on the Kindle Fire before you submit them to Amazon for approval. I tested this with the app “Mosby’s CEN Exam Prep” that I developed for MC Strategies for Android phones. Interestingly enough, when I spoke to someone from Amazon tech support they said the CameraRoll function won’t be supported and must be removed from the coding or the app won’t work. This actually didn’t cause any issues on the app I tested, and CameraRoll coding is fine to use if you’re using it for screenshots and not accessing a physical camera, since the Fire doesn’t have one.

Even though the Kindle Fire is very much a limited system and you can only download apps that have been approved by them, the fact that you can install your own .apk files shows their not totally closed off. A device such as the Nook Color doesn’t even understand what an .apk file is even though it too, runs on Android. For $200 it’s a solid eReader that comes with plenty of extras. People have a tendency to try to compare it to an iPad, which it is not. A $200 tablet made for accessing your Amazon.com media is not going to be able to compete with a $500 device that some people use as a laptop replacement. However, for what it is, the Amazon Kindle Fire is well worth the money.

Kindle Fire vs. Nook Color: The Kindle Fire is faster, has better quality apps, and let’s you install your own .apk files. However, since the Nook Color supports microSD cards, you can root Froyo or Honeycomb onto it. Of course, the Nook Color wasn’t built to run rooted versions of Honeycomb and Froyo, so they’re a bit slow and unstable. Also, the Fire was made to compete with the more powerful Nook Tablet, not the older Nook Color, so the comparison is a bit unfair. In a side by side comparison, the Kindle Fire wins this battle though.

Kindle Fire vs. Samsung Galaxy Tab 7: This is purely a competition of features vs. cost. Both units have similar processing power, the same screen resolution and are almost exactly the same size. However, the Tab is a fully-functional Android tablet with access to an uncensored Marketplace and the features that everyone seems to love, front and back cameras. Plus, you can sign up for 3G access through Sprint or Verizon if you don’t want to always have to be near a wi-fi hotspot. This of course comes at a price. Over twice the price in fact. The Galaxy Tab will run you a little over $400 at Best Buy sans 3G contract. Verizon will give you the device for less, if you’re willing to sign up for 2 years of monthly data plan fees, which ends up costing more in the long run. So for features Galaxy Tab wins, for price Kindle Fire wins hands down.

Kindle Fire vs. iPad: This isn’t really a fair comparison because the Kindle Fire isn’t really meant to be an iPad competitor, especially an iPad 2 competitor. Again, it’s a features vs. cost compensation you’ll have to make. Tons of apps, the backing of Apple, plenty of accessories, front and back cameras, and microphone at a starting price of $500 or a solid Amazon tablet with plenty of extras for $200. If you can afford it, the iPad will give you many more features, but if you don’t believe in spending the cost of a new computer on a tablet, then pick up the Fire.

The Perfect Pillow v2.0: Now Available

After discovering Corona SDK and the Kwik plug-in, I decided to re-create my children’s book “The Perfect Pillow”. Going from Objective-C to Corona’s Lua programming language was a sigh of relief. Also, by using Kwik, I was very easily able to implement the “Read to Me’ feature found on many other children’s iPad books. My sister-in-law Leslie (@darlingstewie) graciously donated her time and voice talent to narrate and do some voice acting for the new version.

Pick up the new version on iTunes: http://itunes.apple.com/ye/app/the-perfect-pillow/id466002172?mt=8

I was so thrilled by the ease of Kwik, I decided to create them a badge, which resembles Corona’s bade, both shown here:

Developed with Kwik badge

A badge I created for Kwik.

Cross-platform Mobile App Development Showcase

Basic Math Tutor

Basic Math Tutor

Basic Math Tutor app on HTC Thunderbolt & iPad

I recently discovered mobile app development software called Corona and Kwik. Corona uses its own programing language called Lua, which is a lot like actionScript, to create apps. The beauty of the software is that it takes a fraction of the code to create apps and it publishes out to both iOS and Android.

Kwik is a Photoshop plug-in that is great for people who don’t want to have to code at all. You assign actions from a drop down menu to each Photoshop layer and Kwik automatically publishes out the Lua code for you, which you can test in Corona. Another great part about both software companies is that they’re small, so any questions you send them will most likely be answered by the people who developed it directly. This is much nicer than the obligatory auto-response from Apple saying that you must have made a mistake and it’s not their fault.

I’m hoping to release a new update to my iPad eBook “The Perfect Pillow” in the next day or two, which I have completely remade in Kwik and Corona. The reason I chose to remake it with Kwik was because of how easy it is to integrate the “Read to Me” functionality and it handles memory management very well. Since I didn’t have to worry about memory management as much as I did when using Xcode and Cocos2D, I was also able to incorporate more animations and interactivity. So keep an eye out for version 2.0 coming soon.

While in between projects, I quickly threw together (about 4 hours of work) an app completely made in Photoshop/Corona. I wanted to test out how the software would do exporting out the same code for all Android devices, iPhone, iPhone 4, and iPad. It seems to run fine on my Android phone and iPad, but I did notice for some reason Corona automatically says the app requires Internet and Phone permissions for Android. If you delete those permissions (since the app doesn’t require either), Corona overwrites what you wrote and puts the requirements back in. So anyone reading this, no I am not listening in on your phone calls, nor does my app need internet access. Also, the sounds on the Android sometimes overlap and after the 99th question a new screen briefly appears before restarting the app. Kind of an odd behavior, but I guess it can’t be perfect trying to export for every mobile device.

I’m still waiting on Apple’s approval, but Android users can grab the app now here:

https://market.android.com/details?id=com.gpanimations.basicmathtutor

“The Perfect Pillow” Children’s eBook – iPad

On Saturday, October 1, 2011 my first children’s book was published on the Apple App Store. Even though I was unsure of how a book written by a first-time author would do in a market that is overly-saturated, I decided to jump in regardless.

The story is about a young turtle named Colin who cannot fall asleep because his pillow is lumpy. His mother takes him to a pillow store where he hopes to find the perfect pillow in order to go to bed. The story was written, illustrated and coded for the iPad by myself, which was not an easy task considering I don’t have any experience in anything except illustration.

It has been about 36 hours or so since the book debuted on the App Store and over 40 people have downloaded it so far. Even though as far as apps go that number is relatively low, I’m still excited that so many people have a copy of my book on their iPads. I was honestly expecting 5-10 downloads total after about a month so the response exceeded my expectations greatly.

This also gives me encouragement to write and illustrate another book since I would like to create an entire line of children’s books in the future.

The Perfect Pillow eBook Cover

Click to view The Perfect Pillow App Store download page.

Follow

Get every new post delivered to your Inbox.

Join 240 other followers