From the Forum — Issue #116

From the Forum — Issue #116

From the ForumWelcome 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!

Custom drop shadow on your text objects

Getting custom text objects to appear accurately 100% of the time can feel like a bit of a magic act. Sometimes it feels like it would be easier to pull a rabbit out of a hat than ensure that all of our text effects, scaling and kerning has been implemented correctly across the board.

One of the issues I always run into is the ability to add a nice shadow or outline effect to my text objects. There is of course display.newEmbossedText() which works well in simple cases, but it is simply not robust enough to handle all of the logical gymnastics we might throw at it. Unfortunately, another developer had the same issues, and looked to the community for some assistance. Fortunately, a bunch of developers came out to throw their solutions into the ring.

There are some pretty useful solutions and code snippets for this problem contained in the below thread. Click through and check’em out!

A thorough check inside of onComplete

The onComplete() callback function that Corona provides is, as we all know, invaluable when paired with Corona’s event-driven model. With an asynchronous system, returning control to your app is a matter of course, and as Rob Miracle’s excellent tutorial points out:

“When these events complete, they notify your program that they’re finished and allow you an opportunity to respond”

The handling of these returned values takes place in a callback function. But what if you want to use something a bit more complex with only one callback function. Exactly the same issue was posted in the forums earlier, and the question received some fantastic responses. The suggestions were fantastic, and you would do well to read through the entire thread!

Swiping the day away

I’ve got quite an interesting thread on tap here that displays some deft mathematics for identifying some crucial user interaction. By detecting the movement of a single finger on the screen and comparing the present touch with the delta X/Y location. This has the added wrinkle of using separate functions for location detection, which, in my opinion, is an underused and oft-overlooked technique. Head on through to the original thread to learn more about how you can implement this functionality in your app now!

About Alex

Alex Jackson is an indie developer and the founder of Panc Interactive, 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: @pancinteractive. Check out his new game Segreta on iOS, Android, Windows Phone and Amazon devices.

No Comments

Sorry, the comment form is closed at this time.