Easy Screen Management in Corona

I have been messing around with the Corona SDK for a while. My goal is to have a game on the app store and the android market before then end of the year.

A small hang up that I was having was screen management. On the surface lua is really easy to learn but nothing is said about any good practices at all. As more of an OOP programmer it is essential that I am able to write my projects in a very modular way. Well luckily jonbeebe wrote a post about this very thing. Not so much a good OOP article as it is more of a way to organize your Corona projects into screens, so for me this is a good start. I am half way through my first game and the main.lua file was getting pretty large.

You can download the template that Jon has created below and I encourage you to take a look at the full article. It’s not to long and very helpful

The Corona Project Template

I created an example that contains three files:

  • main.lua
  • screen1.lua
  • cheat-sheet.txt

You can download the project template here. It contains your main project file, an example screen template that you can duplicate for as many screens (or “scenes”) you need in your app, and a “cheat sheet” text file that’ll walk you through all the steps that need to be accomplished to add a new screen to your app (only 5 steps).