How To Make a Game Like Doodle Jump with Corona Tutorial Part 1

This is a blog post by iOS Tutorial Team member Jacob Gundersen, an indie game developer who runs the Indie Ambitions blog. Check out his latest app – Factor Samurai! I’m willing to bet that when you woke this morning your first thought was “I wish there was a way to create a doodle jump […] By Jake Gundersen.

Leave a rating/review
Save for later
Share

This is a blog post by iOS Tutorial Team member Jacob Gundersen, an indie game developer who runs the Indie Ambitions blog. Check out his latest app – Factor Samurai!

I’m willing to bet that when you woke this morning your first thought was “I wish there was a way to create a doodle jump game in 300 lines of code.”

“Oh, and I want it to run on both iOS and Android, and I want the code to be really simple. And I want a cherry on top!”

Well, you’re rather greedy, but you’re in luck. Wish granted! :]

In this 2-part tutorial series, we’ll make this game with a popular and easy-to-use game engine for iOS and Android called Corona. By going through this tutorial series you’ll learn the following:

  • How to make a game with Corona
  • The pros/cons of Corona vs Cocos2D
  • How to make levels with LevelHelper
  • And of course, how to make a game like Doodle Jump!

This tutorial is for complete beginners to Corona, although it’s OK if you have some prior experience.

It’s also best if you have prior experience with LevelHelper and SpriteHelper – if you are new to these tools, check out this tutorial first. But don’t worry if you don’t have these tools or don’t have much experience – you can use the premade sprite sheets and levels if you’d like.

OK, so grab a Corona (or two) and let’s begin! :]

What is Corona?

Not that kind of Corona!

Not that kind of Corona!

Not that kind of Corona!

Although most of you on this site are probably familiar with the Cocos2D game engine (or the Corona beer), you might not be familiar with the Corona game engine yet.

So let’s start with what Corona is!

Corona is cross platform game engine that supports Android and iOS. It’s developed by a company named Ansca, and you can use a free trial to try out Corona and develop your game. When you are ready to publish you are required to buy a license, prices range from $199 to $349.

You program in Corona with a programming called Lua, which is a lightweight and easy to use scripting language. There is no IDE for Corona (such as Xcode), instead you often program with a normal text editor. Corona comes with a simulator you can use to test your game as you’re coding it.

Corona has built-in APIs for the normal game programming aspects (sprites, sounds, etc.) as well as various APIs from the Apple including Game Center Leaderboards (new), In App Purchase, and TableViews (new).

There are also a number of third party developer APIs including Open Feint (leaderboards), inMobi (ads) and Flurry (analytics). It does not have access to all of Apple’s APIs. Some of the notable APIs not included in Corona include iAds, Game Center Multiplayer, and access to bluetooth connectivity.

Corona vs Cocos2D

Corona vs Cocos2D: The ultimate showdown?

Corona vs Cocos2D

Corona vs Cocos2D: The ultimate showdown?

Next let’s cover the differences between Corona and Cocos2D so you guys can understand the differences between each engine.

First of all, Corona and Cocos2D have many similarities:

  • Positioning a sprite in Corona is easy, just set the .x/.y properties of the sprite.
  • There are scale, rotation, and alpha properties associated display objects.
  • There’s a ‘transition.to’ method that animates position, scale, rotation, etc.
  • Corona uses the Box2D physics engine, so the methods and properties should be familiar to you if you’ve used Box2D with Cocos2D.
  • Like Cocos2D, Corona has sprites, text labels, and primitive drawing methods, but they’re called by different names. Any object that appears on screen is called collectively a ‘display object’, which is similar to a CCNode in Cocos2D. Corona has a display group, which is functionally very similar to a CCLayer in Cocos2D.

There are some significant differences between the two engines:

  • A Cocos2D program is written using Objective-C, while a Corona program is written using Lua. The Corona API is heavily influenced by Action Script. Flash developers find Corona a very welcome environment. Corona code can be written according to an OOP model, but the functional programming model is more common.
  • Cocos2D is open source allowing the integration of 3rd party libraries written in Objective-C. Corona is a proprietary, closed system. While some 3rd party libraries have been written in Lua for use with Corona, there are currently far fewer 3rd party tools available for Corona.
  • And of course, Cocos2D is free while Corona is paid.

So I know what you’re all wondering – which one should you choose when? The best way to answer this is to list the pros and cons of using Corona instead of Cocos2D:

Pros:

  • Rapid development time. Making a game with Corona can often be faster and easier than making a game with Cocos2D. Since it’s based on Lua, adding a variable to an object doesn’t require any more than the assignment (ex: Sprite.newvalue = 0). The Box2d engine is integrated so that a sprite object and a physics body are one object. You don’t have to write interface files, declare instance variables, or even declare variable data types (there are a few exceptions to this).
  • Cross platform support. If you make a game with Corona, it works on both iOS and Android out of the box!

Cons:

  • Lack of API support. Corona doesn’t have access to all of Apple’s APIs, or as many 3rd party extensions as Cocos2D. Some of the areas where Corona is still lacking is easy data persistence (there are methods to write/read files, and Sqlite integration, but nothing as slick as reading a plist into a dictionary). Network multiplayer code has to be written from scratch. The coolest new stuff from Apple takes time before it’s integrated, if at all.
  • Slower performance. Since Corona is built on top of Lua, your code will not run as fast as it would if it was straight Objective-C.
  • It’s not free. Yep, you gotta cough up money to use Corona when you want to ship your game, whereas Cocos2D is gloriously free!

Whether or not you’re convinced Corona is for you, going through this tutorial is still a good idea so you can judge for yourself which you like better! :]

Jake Gundersen

Contributors

Jake Gundersen

Author

Over 300 content creators. Join our team.