27 June 2014
From the Forum — Issue #26
Welcome to the latest installment of From the Forum. In this series, guest blogger Alex Jackson highlights outstanding threads from the Corona Forum. The goal is to bring attention to the most captivating, interesting, and thought-provoking discussions taking place in our very own backyard.
Please visit the forum to join these conversations or start your own!
1. Creating scenes programmatically
Composer is very useful in respect to managing scene data and moving around inside of our code. Everything from games to recipe apps are possible within the functionality, and I think the evolution from Storyboard has brought some pretty cool features. One option we have been looking for is more flexible scene generation, where you can dynamically create scenes in code.
The below thread lays out a oft-overlooked Composer API call and a third-party GitHub library that makes creating dynamic scenes easier for us. Ideally, the OOP Composer coupled with some Lua skills and a bit of elbow grease will get you through to the promised land!
Click through to the thread below to learn about this functionality and how it can fit into your code.
2. App refresh upon update
Squashing code bugs is a necessary evil and learning from your mistakes helps you improve your skills. Rolling out app updates to your users is something we should all know how to do, but sometimes we can trip up when we include an upgrade that breaks previous working code.
Rob Miracle included an interesting tidbit regarding developmental updates: that is, when you release an upgrade that may break previous saved data, you can create a flag that checks a variable in the saved info — or a version number as Rob suggests — and migrate the saved data to a temp table, then clear out the saved info and re-populate the data table with the temp table.
Check out the original thread to see exactly what Rob suggested. Or, if you have your own method of handling the same situation, please let us know.
3. Resize images after they’re loaded from a remote server
Linking up server instances to deliver data and other assets to our apps is becoming increasingly popular within the Corona developer community. Develephant’s Coronium platform, for example, makes it easy to provide cross-platform leaderboards and deliver other media to your app after installation.
One challenge is importing image files and resizing them on the fly in your app. It can be tricky to wrap your head around this, but developer alzaabi98, with some help from our active development community, figured out a succinct method for achieving asynchronous image population, along with resizing!
Read about the process in the following thread and, if you have a better way to accomplish this, please share it.
Alex Jackson is an indie developer and the founder of Panc Software, specializing in retro-style gaming. He has created several mobile applications, enjoys long walks on the beach, pixel art, and reading the Corona forums. Contact him by email or follow him on Twitter: @pancsoftware. Check out his new game Crosstown Smash on iOS, Android, and Amazon devices!