Misc Variables

You can specify fonts to be used for displaying the level numbers and score or you can set one or both as nil and OGT Level Manager will use whatever you’ve set in the k.fontName variable. Make sure whatever font you choose is available on your target device.

k.fontName = "Helvetica" -- required

In many games you want the player to progress from Level 1 until the end, with later levels locked until they have passed the previous ones. You have to have at least the first level unlocked, and you can have as many as you want by setting the k.numUnlocked variable.

If you don’t want any levels to be locked, make sure you set the value to the same value in the k.totalLevels variable.

k.numUnlocked = 1 -- how many of the first levels are unlocked (minimum 1)

When the player returns to the choose level screen do you want it to always appear on the first page of levels? Or would you rather it start from the page where they last selected a level?

k.rememberPage = true -- if true, shows page from last selected level

If you want a different number for maximum stars, you can set that here. Just remember you have to make sure there’s room for all of them.

k.maxStars = 3

By default the code shows a dim star as a kind of placeholder for a star that wasn’t earned, so if the user gets two stars on a level two normal stars will be shown and a third very dim star. If you don’t want the missing stars to be shown at all, set the following variable to false.

k.showMissingStar = true

When the player chooses a level you can select the Storyboard effect and timing to go from the choose level scene to the play scene.

k.sboardEffect = "crossFade"
k.sboardTime = 700

You can set the amount of time it takes for the paging to happen. Set k.slideTime lower to make sliding to next or previous pages happen faster. The time is milliseconds, so a value of 500 in k.slideTime equals a half second.

k.slideTime = 300 -- milliseconds (lower number = faster slide)

You can allow the user to swipe the level chooser left or right to page through the levels in addition to (or instead of) tapping the arrows. Turn on or off the swipe with the first variable below, and tweak the distance a user’s finger has to swipe to activate it with the second.

There may be times when you need to do some “cleanup” before leaving the choose level screen. For example, in one of my games I have sprites flying around and I want to disable them before leaving that screen. You can set a function to be called before leaving: