05 December 2014
From the Forum — Issue #49
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. An eventListener inside of a class, as a class?
One of the benefits of coding with Lua is how simple everything seems to be. Arrays, metatables, listeners and objects all play in harmony, and Corona takes this simplicity and adds the logic to allow creating apps and games that much easier.
One of the biggest advantages (and steepest learning curves) involves the use of classes. Check out this guide for a bit more of an introduction, but suffice to say, they can make your Corona development-life much more stress-free. One Corona developer recently ran into an obstacle in using being able to access properties of their class object when using a touch listener. After chatting with some other devs, they came to the conclusion that anonymous functions coupled with a table listener would be the best way to move forward. And guess what? It worked like gangbusters!
Head to the link below to learn a bit more about the problem and the recommended solution. Have your own questions about classes and how they work? The Corona community is always ready to lend a helping hand!
2. You must be this old to ride!
In the winter, the holiday season inspires developers to release a small army of apps and games into the marketplace that involve holiday themes. In many cases, they are targeted specifically at the youngest app users. They sometimes need to incorporate some more mature features (like IAP, for example!), to which the target audience shouldn’t really have access. And thus, the Parental Gate was born!
But where to put it? Should you have every section handle a check to see if the user is of the required age? Should every purchase be double-checked, both by your own logic and the respective app store? A developer had this very dilemma, and decided to ask the forum for some guidance. He found some wisdom from some experienced developers in this field, who felt as though a simple “parent’s only” section which checked ages before allowing entrance worked for them in the past.
Check out the original thread to see the main discussion, and if you have your own tale of intrigue as to how and when to perform an age check, feel free to chime in!
http://forums.coronalabs.com/topic/53033-use-parental-gate-for-an-entire-section
3. New OS version, new font issue solution!
Android Lollipop is out, and with it comes a new crop of users exciting about downloading the latest awesome games and apps to their devices. Corona developers know the time to capitalize on this new market is now, so they are making sure their releases work on the new OS, and the new devices that will use it.
A few developers, however, found that their custom fonts weren’t showing up correctly on their devices with Android L installed. A bit of Googling found that they were not alone, and it wasn’t a Corona-specific problem, either. This didn’t stop some intrepid Corona devs to post in the forum about the problem, in the hopes of crowdsourcing a solution. Thankfully, it worked, and another Corona user found that a solution involving some open-source third party tools could modify the font file itself, so that it was something Lollipop could interpret correctly.
Head on over to the original thread to find out more about the issue and the solution!
http://forums.coronalabs.com/topic/52830-custom-font-not-working-in-lollipop
About Alex
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!
Antheor
Posted at 10:28h, 06 DecemberAs for the tip 1, the posted linked is rather tough … :
Any way to add eventlistener into a class without using the obscur “setmetatable” ?
Alex
Posted at 11:26h, 07 DecemberAntheor, that tip assumes that one has a grasp of metatables and how to use them within Corona SDK. They aren’t really obscure, and getting a thorough understanding of their use is always a good idea, but I understand if you don’t want to use them for whatever reason.
Perhaps you can create a forum post identifying your specific need/issue, reply back here with the link, and we can work together to find the best way to help you out? Look forward to hearing!