Best Practices for Organizing Projects

Posted by & filed under Tutorials.

project_organization

Something that isn’t clear by studying Corona’s included SampleCode or any of the other examples and tutorials on this website is the concept of organizing projects. We’ve sort of just let you know that everything goes into your project folder and sent you off on your way—and oh, sub-folders are supported. That’s about all we’ve said on the subject up until now.

However, as your projects get bigger, that may not be quite enough. With more and more resources are being added to your project, such as audio files, images, videos, Lua modules, etc. it can add a whole new layer of complexity to the development process—complexity that isn’t at all necessary.

This tutorial is by no means the end-all to Corona SDK project organization techniques, but it will introduce you to an effective one that you can tweak at your heart’s content to suit your needs perfectly.

Properly Removing Objects and Variables

Posted by & filed under Tutorials.

red_ex

Removing objects and getting rid of unneeded variables may seem trivial, but it’s actually common question among Corona newcomers and veterans alike.

The potential consequences of doing this simple-but-important task incorrectly can lead to memory leaks, app slowdowns, and even crashes (which you don’t want, obviously).

How to Use Custom Events in Corona

Posted by & filed under Tutorials.

event

A little over a year ago (in June of 2011), I went over the Corona Event Model, and explained exactly what events are in Corona, when they occur, and how you can “hook” into them to take advantage of some of Corona’s best features.

However, in the previous article, I kept the subject-matter focused on the built-in events associated with specific API’s that are provided out-of-the-box in Corona. What I didn’t mention is that you can define your own custom events, and have objects listen for when those events are dispatched (which you have complete control over as well).

This tutorial will walk you through defining and dispatching custom events, so you can begin applying the knowledge to your own games and apps.

Guided Tour of Corona’s API Reference

Posted by & filed under Tutorials.

api_reference

This week’s tutorial is going to be a little different. Rather than go over yet another awesome Corona feature, I’ll instead be walking you through another aspect of Corona development that’s arguably just as important (if not more important) than any one specific feature of the SDK. What you’ll be learning about today is something you’ll undoubtedly use in every single Corona project you work on, and that is of course is the Corona SDK API Reference.

Applying Basic Animation with Transitions

Posted by & filed under Tutorials.

Corona SDK provides advanced animation capabilities through the Spritesheet API, but there are also features in place that allow you to more perform basic animations with existing display objects (to include animated sprite objects). Whether you need to rotate an object continuously, fade its opacity in and out, move it from one location to another, or any combination of the three—Corona’s transition library has you covered. This tutorial will mainly cover the transition.to() function, which is what you’ll be using the most when using Corona’s transition library. As a basic overview, transition.to() takes two parameters: the object to be animated, and a table that contains the ending properties (usually a combination of rotation, alpha, x, and y) of that object, the time you wish for

Local Notifications Guide (iOS)

Posted by & filed under Tutorials.

For this week’s “Tutorial Tuesday”, I’ll be covering Corona’s Local Notification feature, which is currently only available for the iOS platform. When a user of your app receives a “local notification”, they will be alerted, a sound might play, a message will be shown, and they’ll have the option to take some course of action related to the notification (whatever you, the developer, deems that to be). If your app is not currently in the foreground when a notification is received, (e.g. they are browsing the internet, checking their Facebook, etc), you’ll have the opportunity to show your user a message as well as the option to promptly switch back to your app in response to the notification, making this a great for increasing the

How to Use Bitmap Masks

Posted by & filed under Tutorials.

In this week’s tutorial, I’m going to cover a feature that, while infinitely useful for many projects, you may not even be aware exists because of its specialized use-cases. That feature is bitmap masking, which is accessed from the graphics.newMask() function. You may not know what bitmap masking is, or you might not see how it could be useful to you. In either case, stick around because this is definitely a good tool to have in the “tool shed”. Bitmap masks can be used to solve some otherwise tricky problems which include (but is not limited to): Disable touches on transparent part of images (popular use-case). “Clip” an image (or group) to a specific shape (e.g. using a bitmap mask to clip a scrollView widget

Adding Buttons to Your Games and Apps

Posted by & filed under Tutorials.

If you could guess what the most common user-interface element among mobile apps is, what would you say that is? I’m sure we could go back and forth on a few different things, but I think we can both agree that buttons are at least among the top five most common user-interface elements found in just about every type of app. Since touchscreens are generally smooth and flat (and have no other physical characteristics) any “buttons” found on the screen are obviously virtual (of course, this doesn’t include buttons found off-screen, whether above, below, or on the edges of the device itself). With that said, what is the difference between simply detecting touches, and having an actual “button” on the screen? The answer is what

Handling Corona System Events

Posted by & filed under Tutorials.

When developing applications, it’s important to handle scenarios that occur as a result of the user interacting with your game in as many different ways possible. It’s equally as important to handle scenarios that occur as a result of “system” events, whether they are explicitly triggered by the user or not. Things that immediately come to mind are things that cause your app to become “suspended” such as the user receiving a phone call, or pressing the “home” button on their device (your app is still running in the background, but in a suspended/paused state). What about when the user comes back to your app while it is suspended, or when your app exits completely? All of those things are handled by “system” events in

LuaFileSystem (LFS) Tutorial

Posted by & filed under Tutorials.

I mentioned in last Friday’s daily build update that a LuaFileSystem (LFS) tutorial is coming—so here it is! For those who don’t know what LFS is, it’s a popular Lua library that allows you to perform common filesystem activities that can’t normally be done in plain Lua. Things like getting file attributes, creating and removing directories (folders), and iterating over files in a directory are all things that can be easily done using LFS. Now that the daily build with it has been posted, I’ll walk you through some of the more common things you might find yourself using LFS for in a real Corona app. During the course of this tutorial, it might help to have a separate tab open with the LFS Reference.