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
Category: Tutorials, Tips and Demos
For those who don’t know what LFS is, it’s a popular Lua library that allows you to perform common file system 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. During the course of this tutorial, it might help to have a separate tab open with the LFS Reference. Directory Scanning Let’s say you were creating a note-taking app that allows users to create, save, and read text-based notes that are all saved to system.DocumentsDirectory. Sure, it’s easy to keep track of what the user does inside of your app. You could simply keep your own record of
If you know what events are Corona (if you don’t, you should start here), then you know that they allow you to “do something” whenever a specific action that corresponds to an event occurs. You can even define your own actions, and dispatch custom events whenever it is appropriate for your app. However, no events are dispatched whenever a property of a display object (such as x, rotation, alpha, etc.) is changed, and it’s not readily apparent how (or even if it’s possible) to do so. But how many times have you wished that you could “do something” (e.g. call a function, display a message, update a graphic, etc) whenever a certain property gets changed on a specific object though? If you can’t see how
One of the two most-requested items in regards to the Storyboard API was the ability to pass custom data between scenes as you switched between them, and also some kind of “pop up” feature, where a scene can be loaded and displayed above another scene, leaving the currently active scene intact. The documentation for both is available now—parameter passing with storyboard.gotoScene() and scene overlays with storyboard.showOverlay()—but I’ll give you a quick overview right now to get you started. Parameter Passing I keep throwing around this term, so for those who don’t know, parameter passing allows you to easily “pass” custom data (such as a single variable or a table with as much data as you want) from one scene to the next when you initiate
Lights… camera… CUT! Corona’s Storyboard API has been around for a while now, but there is still some confusion among the community in regards to how to use it. And while I’m sure that my recent explanation of the various events associated with the Storyboard API certainly helped a little, perhaps an explanation of the Storyboard API by itself isn’t quite enough. Prior to the Storyboard API, there was no “official” Corona SDK solution to scene management, so most people used Ricardo Rauber’s Director Class, a really great 3rd-party open source library that helped with scene management and also allowed you to transition between scenes with a number of cool effects. When Storyboard finally did show up, it came with some significant differences in terms
The topic of databases is far-reaching in the world of programming (especially for web developers), and for good reason. Databases are great for storing tons of information. Not only that, when it comes to retrieving that data for later use, there’s hardly a better option. For instance, if you were writing a notes app, you might store the user’s individually created notes in a database. Sure, you *could* just store each note as a separate text file, but then you’d have tons of files on your hands (rather than just a single .db file), and things such as sorting and searching (both commonplace in the world of databases) is out of the question. What’s more, is that in that same database file, notes could be
Today, I’m going to explain the individual events that drive the entire Storyboard API, and then show you how all the different events fit together. If you previously had trouble using the Storyboard API due to a lack of understanding of scene events, this resource should clear things up for you. I’ll begin by explaining what Storyboard scene objects are, their view display group, and what it means to “purge” a scene. And while these thigns have nothing to do with scene events directly, it is important that you understand these concepts before attempting to work with Storyboard scene events. Scene Objects The primary object that the Storyboard API handles is a “scene” object. It is really nothing more than a special table with specific
In case you missed it, Corona SDK now officially supports “the new iPad” (or “iPad 3″, as I’ll be referring to it for the rest of this post) in both the public release and cutting-edge Daily Builds. Since the iPad 3 sports four-times the number of pixels as the original iPad, there’s some confusion among some users as to how exactly graphical assets should be set up to ensure apps look their absolute best. The good news answer is: generally the same way, that is, if you’ve been supporting Apple’s existing retina display for the iPhone and iPod touch. But just for the sake of alleviating any potential confusion, I’ll go over everything in this tutorial.
NOTE: This tutorial is outdated and has been replaced by the Image Sheets (Sprite Sheets) guide. Please refer to this guide for details and usage examples.
To some developers, it’s not apparent exactly what the purpose of an enterFrame event is — if you’re new to Corona, it’s easy to bypass it and possibly never learn of its purpose. More importantly, enterFrame events can be dangerous for your app if you’re under-educated in their purpose and usage. What is an “enterFrame” event? As you may know, everything you can see in your app is the result of several frames being “drawn” to the screen at a very rapid pace. Corona supports two different “frames-per-second” (FPS) settings for your apps: 30 and 60 (more info here). This is also known as the “frame rate” of your app. To put it into perspective, if your app is set to 60 FPS (in config.lua),