Many game engines come with examples to get you started, but most are minimal in scope and actually show pretty horrible programming practices in exchange for being compact, or just out of pure laziness. Corona has long needed a meaty sample and finally it has one. The just released Corona Cannon, basically an Angry Birds clone. From the announcement blog:
Five years have passed since then. The original GvM was developed for Graphics v1, it only supported 480×320 or 960×640 resolution screens, and the code didn’t follow current best practices.
For instance, there were many global variables, the project didn’t use OOP (Object Oriented Programming practices), and the code wasn’t DRY (Don’t Repeat Yourself). Each level needed a new levelN.lua file, which repeated the entire logic of the game plus level layout.
The project wasn’t perfect, but it was a great example 5 years ago. Director class was the only scene management choice at the time and there was no way to organize projects with sub-directories. Dark times.
After the acquisition of Corona Labs by Perk, and with addition of new hires, it was time that we made a fresh new clone! Or a remake of the clone. Or is it a clone’s clone? Too many clones… Let’s just call it a remake.
The “remake” started as a simple code update to the original game, to make it compatible with modern versions of Corona SDK. As a side note, it was actually my first task at Corona Labs as a new hire. Initially, I started updating the code, but quickly realized it was not enough. Developers would not fully benefit from simple code update. We needed a game that shows best practices. So, I created a new game with similar features, from scratch.
The old graphics weren’t made for high resolutions, so we decided to use free assets bykenney.nl, which are great for prototyping. I also wanted to use Tiled to showcase how to integrate it into a Corona game. I wanted to integrate a simple level editor too. It also needed to be playable on all platforms including OS X, Windows desktop and Apple TV, so controller support was a must.
As for the new game theme, I came up with an idea to fire Corona Labs and Perk logos from a cannon, like cannonballs. We can’t fight pigs, right? No unnecessary animal cruelty… So what can we fight with in Corona? Why, bugs of course! Corona Debugger could have been a cool name for this game, but we settled down on Corona Cannon instead.
During development, some fixes and improvements were also introduced in Corona. The
easing.continuousLoop was fixed, and Apple tvOS remote support was improved, as was desktop support.
The code is available for download on their github page.