With the Maze Game Starter Kit you can create fast paced mazes and collect objects to advance to the next level, while avoid enemies. You can create as many levels as you like by simply duplicating an existing item in the LevelSettings array in the GameData.plist. (seen below)
To define a new level map you won?t need to adjust any of the code in the kit. You?ll simply need to create a new Tiled file or even better, copy the existing Maze.tmx file and specify that name (minus the .tmx extension) for the TMXFile property. See the example below. The kit includes a file called Maze.tmx in the resources panel of the Xcode project. When you duplicate a new .tmx file be sure to import it into the Xcode project as a resource.
Alternatively you could use .sks files to layout levels, but we recommend Tiled. Its a free program, available at MapEditor.org and is much easier for laying out and designing levels. Once installed, you can open the Maze.tmx file in Tiled.
Once you are in Tiled?
By simply drawing rectangles and naming them you can layout your entire level. See the screen shot below to see where to find the Insert Rectangle Tool.
To create a Starting Point for the Hero character, the rectangle should have a Type set to Portal and Name set to StartingPoint. See the screenshot below for references or open the Maze.tmx file in the kit for reference.
To create a Boundary, the rectangle should have a Type set to Boundary. See the screenshot below for references or open the Maze.tmx file in the kit for reference.
To create an enemy, the rectangle should have a Type set to Enemy and the Name can be set to anything you want, for example enemy1. The name you specify here should match a corresponding image in your Images.xcassets catalog. See the screenshot below for references or open the Maze.tmx file in the kit for reference.
To create an edge around the entire level, the rectangle should have a Type set to Edge. See the screenshot below for references or open the Maze.tmx file in the kit for reference. You may want to toggle on and off visibility of the outer edge in Tiled since when it is visible, other objects can be hard to select.
To create an star (or collectible object, like a pellet in Pac-Man) the rectangle should have a Type set to Star. See the screenshot below for references or open the Maze.tmx file in the kit for reference.
Other Level Properties?
Each level can define a Speed, EnemySpeed, EnemyLogic and Background. The higher the speed, the faster the hero or enemy move. The lower the logic value, the faster the enemy figures out where the player is at in the map. The background can be any images you import to the kit. The GameSettings dictionary in the .plist can define the Parallax scroll of this background. The included example is called star_field in the Images.xcassets catalog.
The Look of Boundaries?
To customize the Maze Boundaries, you can see the video documentation included with your purchase of the kit, but briefly, every shape can define a fill color and stroke color. In the Boundary.swift class, find the following lines (around line 82)
shape.fillColor = SKColor.clearColor()
shape.strokeColor = SKColor.whiteColor()
shape.lineWidth = 1
In the property list, you can define how the hero looks in the HeroSettings dictionary. The HeroImage property will define the ID in the Images.xcassets catalog of the base image to use. Since the animation frames for the hero are shown almost immediately, (and take over the appearance of the hero) the base image is mostly used to define the size of the hero.
You can set the BodyShape property to equal either square or circle.
The MovingAtlasFile will define the Texture Atlas Folder for the moving frames of the character animation. The kit has a folder called moving.atlas, but notice in the property list you do not need to include the ?.atlas? extension. The MovingFrames array defines the order in which you want the frames to run (most likely sequentially).
Optimized for iOS 8!