Locking and Unlocking Levels in Your Own Corona SDK Games
4.9 (7 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
69 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Locking and Unlocking Levels in Your Own Corona SDK Games to your Wishlist.

Add to Wishlist

Locking and Unlocking Levels in Your Own Corona SDK Games

Use the OGT Level Manager to handle level management in your games! Lock and unlock levels easily. Full code included!
4.9 (7 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
69 students enrolled
Created by J. A. Whye
Last updated 3/2016
English
Current price: $10 Original price: $20 Discount: 50% off
1 day left at this price!
30-Day Money-Back Guarantee
Includes:
  • 1 hour on-demand video
  • 10 Articles
  • 2 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Create fun and easy-to-use level selectors in your game.
  • Keep track of how many stars are earned on each level in your game.
  • Save and retrieve scores for each level of the game.
  • Make more games, faster!
View Curriculum
Requirements
  • Intermediate level knowledge of Corona SDK
  • Making a game using Corona's storyboard feature.
Description

Many games are based on levels, and most of those games have a screen where:

  • The user can choose a level to play.
  • Some levels are locked until previous levels have been played.
  • A number of stars are shown based on the player’s score for that level.

One of the most commonly asked game dev questions is, “How do I lock and unlock levels?” Until now I’ve tried to explain the concept to people but now I have a better answer…

The Outlaw Game Tools Level Manager
OGT Level Manager is a library you include in your game and then “tweak” some variables to specify which graphics you want to use, how many total levels you have, etc.

And then in your game it’s as easy as this to unlock the next level when the player has finished with the current level:

  unlockNextLevel()  

OGT Level Manager keeps track of which levels have been unlocked and it’s shown automatically when the player goes back to the level select screen!

If you’re using a “stars” system in your game, OGT Level Manager will even keep track of how many stars were earned on each level. And it’s this easy to use:

  updateStars(2)  

That one call will let OGT Level Manager know the player earned two stars on that level and it will automatically show the correct number on the level select screen.

Here are some of the features found in this library:

  • No limit to the number of levels.
  • Multiple pages with next and previous arrows.
  • One to three stars shown on levels (optional).
  • Use your own graphics. Using smileys instead of stars? No problem!
  • Tweak the position of level boxes, arrows, stars, numbers, etc.
  • One storyboard scene with data loaded for each level? Works that way.
  • One storyboard scene for each level? Works that way, too!

Basically, I’ve made it easy to drop in your own graphics, and then tweak the position of any that may need it by setting variables. Changing the actual code is not necessary.

Requirements:

  • Corona SDK (works with both the free and paid versions).
  • Use Storyboard in your game (does not work with Director).

OGT Level Manager comes with two sets of tutorial videos.

The first set is for those people who want to just use the library in their games and don’t really care about the stuff under the hood. These are the “basic how to use it” videos.

The second set dives in behind the scenes and shows you how things work. Just a word of warning, for this second set of videos I’m assuming you have at least an intermediate knowledge of using Corona SDK. I don’t start clear back at the “this is how you display a graphic” point.

The normal price for OGT Level Manager will be $29, but as a launch special it’s available now for just $19 — and that includes all updates for at least the next year! (Actually, I have no plans to ever charge for updates, but now you know you’re good for a year.)

You will save a LOT of time by using OGT Level Manager -- time you can spend working on the more fun parts of your new game!

Who is the target audience?
  • Corona SDK game developers who use levels in their games.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
18 Lectures
01:21:47
+
OGT Level Manager: Overview and Code
3 Lectures 16:45

Below is a quick look at how easy it is to use OGT Level Manager in your own storyboard-based project. In a nutshell, you paste this line of code in a couple scene files:

local lm = require("ogt_levelmanager")

And then in the scene where you want your player to choose a level to play, you add this:

lm.init(group)

Yeah man, that's the basics! Of course, you'll want to tweak OGTLM by adding your own graphics, but I've also made that easy with a set of variables at the top of the library file. Here's a chunk to see what I mean:

k.backgroundImage = "background.png"
k.lockImage = "lock.png"
k.fontName = "Helvetica"
k.fontSize = 36
k.totalLevels = 30
k.numCols = 4
k.numRows = 2

There are quite a few variables you can tweak, but otherwise you don't have to mess with any of the actual code in the library.

Watch the overview video and see how it works!

Preview 10:03

There have been changes in Corona SDK and OGT Level Manager since the videos were recorded. Please read the following so you know what's what! :)

New Information You MUST Read!
00:44

The library is actually inside a complete project that you can download and run inside the Corona SDK simulator. In fact, the tweaking we’ll be doing in some of the tutorials here will use that project.

The OGT Level Manager Code
05:58
+
OGTLM: Basic Usage
3 Lectures 34:56

I’ll be straight with you — it’s easier to use OGT Level Manager in a new project than putting it into an existing project. Mainly because your existing project is (probably) full of hardcoded stuff that was never designed to be generic. I’ve done both and will show you how I retrofitted an existing project, but for now let’s look at starting from scratch.

If you want to kind of follow along, get a “blank project” ready to go — main.lua, config.lua and build.settings files. Also a couple storyboard scene files called chooselevel.lua and play.lua (you can use the blank storyboard scene file from the Corona Labs site).

Preview 10:18

Most of the time when I record videos I’ve done the steps at least once ahead of time so it flows more smoothly.

Not this time. :)

I wanted a “warts and all” look at how to pull an existing level selector out of a game and replace it with OGT Level Manager. But I picked the wrong project — one that I’d written using the older version of Corona SDK that still allowed setReferencePoint() and things like that. D'oh!

So you’ll see more “oops!” moments in this video than just about any other. But I left them in because if you do the same (retrofit an older project) you’ll probably run into the same things.

Retrofit an Existing Project
17:57

Here's a look at some of the utility functions available in OGT Level Manager. These will make level handling much easier.

In the Documentation section of this course you'll find a written reference for the utility functions. That will come in handy when you want to quickly look up the available functions to help create your game.

Utility Functions
06:41
+
OGTLM: Advanced Usage
3 Lectures 11:57

These videos are for people who want to take OGT Level Manager a bit farther and do more than just the basics. If you’re still a beginning Corona SDK developer these techniques might be beyond you right now, but they’re here when you get to that point.

OGTLM is usually used with the same single image showing for each level. But if you need a level selector where each level select image is different, that can be handled with OGT Level Manager, too.

[Note: At about the 2:20 mark I said something that's not quite right (in the current version of OGTLM). The code does NOT pick up the width and height of the custom image/group to be displayed. Instead, by setting k.levelSquareImage to nil you tell the library not to set the width and height. Then you need to set k.tileWidth and k.tileHeight in the variables to whatever dimensions you want. Which means each level image/group can't be a different size, but I don't really think that's much of a limitation. ;) ]

Custom Level Display
04:11

These videos are for people who want to take OGT Level Manager a bit farther and do more than just the basics. If you’re still a beginning Corona SDK developer these techniques might be beyond you right now, but they’re here when you get to that point.

If your game allows different people to play and keep track of scores, levels unlocked, etc., for each player, OGTLM can help you handle that.

Multi-User Settings
04:15

These videos are for people who want to take OGT Level Manager a bit farther and do more than just the basics. If you’re still a beginning Corona SDK developer these techniques might be beyond you right now, but they’re here when you get to that point.

Some games have multiple “worlds” the user can choose from and then levels inside each of those worlds. Using OGT Level Manager you can easily put that together.

Worlds and Levels
03:31
+
OGTLM: Reference Documentation
9 Lectures 12:54

Level Names
01:07

Asset Filenames
01:56

Level Numbers
01:35

Showing Scores
01:33

Image Offsets
00:35

Grid Settings
01:05

Misc Variables
01:22

About the Instructor
J. A. Whye
4.5 Average rating
4,420 Reviews
102,187 Students
7 Courses
Course Instructor

Jay has been programming professionally since 1988, starting with game programming and then over the years moving to internet programming with a major Seattle telecommunications firm. Jay started programming for mobile devices in 2010 and currently has several games and apps in the Apple App Store with more on the way.

In addition to writing hundreds of technical articles over the years, Jay has recorded dozens of hours of tutorial videos. He's been a speaker at technical conferences and enjoys teaching how to make games and apps almost as much as making games and apps themselves.

Jay is a Certified Developer with Corona SDK, and is also diving into Unity to make 2D games and tutorials.