Corona Game Example: Balloon Pop

AIR for Android ActionScript Charting ExampleIntroductionWhat

Here’s a simple, unfinished, Corona game. It shows how to:

  • use a sprite sheet for animation
  • use tweening to move things
  • play audio
  • handle touch events

Why

As a Flex and Flash Architect, you’re probably wondering why I’m even bothering with Lua, specifically Corona.  A few reasons.

First, you should try to learn at least one new programming language a year.  Creating even just a few prototypes is enough as it forces you to write code and learn about the platform.

Second, there is a lot of hype around Corona, so I wanted to learn for myself the facts.

Third, if I were to release anything, apparently the market penetration far exceeds AIR.  I haven’t compared performance on iPhone yet, just the 2 Droids I have.  I like the prospect of re-using a large portion of my code vs. a pure native implementation.  Speaking specifically for games here, not applications.

Fourth, a high level language like Lua is a nice break from ActionScript 3.

Fifth, I like to see how others create games.  It reminds me A LOT of the Flash Lite community.  They tend to create a lot of small games.  Some aren’t very sophisticated, but their quick ability to port to different platforms was the key to their sale.

Code

Just unzip the folder, and open main.lua in Corona.  Here’s my Lua for ActionScript Developer’s guide to help, and here’s the main Lua documentation.

Balloon Pop – ZIP

9 Replies to “Corona Game Example: Balloon Pop”

  1. Just remember that if you make that awesome game and you want to publish it live you have to pay $199 for iOS only or $349 for iOS and Android, add on top of that the $99 for a developer account with Apple.

    Not trying to discourage devs from testing tools, just a friendly reminder of using 3rd party SDKs with a price tag on them.

      1. You can develop Adobe AIR apps for free. You don’t need Flash or Burrito. I’m using AXDT a lot nowadays, and Adobe’s amxmlc and adt are free.

        I get Helmut’s point about Corona’s price tag. A cheaper Lua (on top of C++) alternative is AirplaySDK. Free for iPhone, or $99 for all other platforms.

  2. Trying out Actionscript -> LUA in lieu of learning objective-c is very appealing. I can’t quite wrap my head around the object-oriented LUA equivalents are and how they work (classes, etc.). Are there include statements? Or does my main.lua just turn into a billion line program?

    This is great and inspiring stuff!

    1. @Mistersuits Yeah, you can definitely do “imports”. For example here is the Stats equivalent for Corona. Notice the line:

      local fps = require("fps")

      And how you can treat that as an object, and access it’s properties. That’s just one way to create reusable objects, they have classes too, and a variety of ways to create them. I show you 3 class examples in the classes section in my previous blog entry and Ted Patrick showed me some more info on how to “cheat at Lua”.

  3. OK, Corona looks just fine, but it’s better for us (I think) to force users instal AIR on their devices. For me (as a developer) it’s unbelievably easy to code something in Flash/AIR and then just export it as SWF for web, APK for Android and IPA for iOS. Why should I start learning Corona and pay for it? I have AIR, I didn’t pay for it and it just works.

  4. @MaRmAR Good point. I too find it extremely easy. Again, it’s good to see what the competition is doing, what alternatives are out there, and what they offer that AIR doesn’t. This includes:

    • built in iOS purchasing (can use for micropayments)
    • access to native alerts and loading screens
    • compass integration
    • built-in, C optimized Box2D engine w/ physics
    • cryptography libraries running on C vs. JIT’d ActionScript
    • bones/joints in line with the physics engine
    • Sprite sheets, a more efficient MovieClip

    These are helpful for building games, and other interactive apps. This gives you a broader perspective as what is possible, and makes you ask questions. Why does Adobe not have these features? Do we need them? Who are our clients and why are we building what we do the way we do? Answering these questions helps you learn about technology, about the industry, and generally improve your skills overall.

    It’s like saying, “America is the greatest country in the world!” and yet never leaving the United States. How can one say that without actually having been to other countries to make that statement with context and an informed opinion. There are countries who give free shit away EVERY DAY! Canada… they have free health insurance! — Lewis Black

    Additionally, it helps me advise clients. I like AIR. I can confidently explain that it’s compiled to C++, whereas on Android it’s an optimized Flash Player for mobile. Whereas Corona compiles Lua to C/C++ for Android and iPhone, no interpreter like Flash Player has. Also, the speed of development for smaller apps with a light weight language such as Lua is faster, and has a lower learning curve.

    I couldn’t say any of the above unless I knew both, or even a passing familiarity, know what I mean?

    Yes, I’ll probably be sticking to AIR still based on Corona not having the bitmap functionality I need, but it still was a rewarding experience to play and learn.

Comments are closed.