Levels Overview

In the Role Playing Games iOS Starter Kit

The Levels dictionary can contain an UNLIMITED number of sub-dictionaries that house the data for the levels in your game. Notice in the image below, the Grassland dictionary has the same name as a corresponding SKS (Scene Editor file). The Scene editor is where you’ll visually layout all the elements in your level.

Optionally, you can have two SKS files, one for the iPhone, and one for the iPad. To include an alternate iPad version, name the SKS file with “Pad” after the base name. For example, GrasslandPad.sks would be an iPad only version of the level. Unless you want drastically different levels between the iPhone and iPad, you do NOT need to make two versions of the same level. The kit includes code to adjust the camera and GUI elements within the camera for the iPad.

Making new levels

The easiest way to setup a new level is to Duplicate an existing SKS file.  Select the Grassland.sks and go to File > Duplicate.

On the next screen, name the level, and be sure the box next to Targets is toggled on.

One reason this is a time-saver is that the duplicated SKS file will already contain the camera and GUI. The camera and GUI elements are a shared resource between every level. So if you want to edit the GUI, you would find the GUI.sks file. 

You’ll notice the TheCamera is a parent of every GUI element. So if you try moving the camera around the scene, everything else moves with it.

Fun fact: Back in the Grassland.sks you’ll notice when you select the camera, it is an SKReferenceNode. In other words, it is referencing the contents of the GUI.sks file. If you wanted to create a level from scratch and import the camera / gui, all you’d have to do is drag and drop the GUI.sks file into your new level. That creates an SKReferenceNode.

Level Properties

Every level can contain a Settings dictionary, Items dictionary, TileMaps dictionary, Enemies dictionary, Sounds dictionary, NPC dictionary, Rewards dictionary, and Clear Array.

All of these are optional. If you don’t want to include any of these, you can simply delete them, or change the name to something slightly different. For example, “Clear – OFF”. Xcode just ignores names it isn’t supposed to recognize.

We’ll take a look at each of these property list entries on a dedicated page in the documentation for each.