Skip to content
dxiao edited this page Dec 5, 2012 · 6 revisions

When designing new levels, please make sure your level follows these guidelines to make sure the level is loaded properly and plays as expected. It's not that long a file, so PLEASE READ ALL OF IT.

Table of Contents

Absolute Basics

Levels are specified by .tmx files, which you can create by a convenient GUI called Tiled, available for free at mapeditor.org. The level tilesets are in the Platformer/assets/Levels directory.

.tmx Files

Your level should have the following tile layers, in some order:

  • "collisions" the main terrain tiles which bunnies collide with should go here. Walls, floors, etc., with the exception of spikes or eye candy - those should go on "spikes" and any other level, respectively. This layer should be visible.
  • "spikes" spike tiles need to be on this layer. Don't use this layer for regular terrain - "collisions" is much easier on performance. This layer should be visible.
  • "players" if you want custom start positions for the players, set two tiles in this layer. One player will start where the first tile is, the second on the other one.
  • "bouncys" bouncy tiles should be put here.
  • "stomps" stomps, tiles which drop down to crush the player. Speed can be adjusted in TileWorld.java.
  • a number of layers containing disappearing tiles. Each of these layers should have a set of layer properties (right-click the layer -> Layer Properties) that define how the disappearing tiles on that layer behave:
    • type - this value must be set to "disappearing" (quotes for clarity). IF YOU DON'T DO THIS, THE LAYER WILL BE IGNORED!
    • flicker_count - the number of times the tile should flicker. Currently the reference number is 3, and should not be changed without Turner's consent.
    • flicker_time - total time spent flickering into and out of view. Players can stand on the tile while it's flickering out, but not when it's flickering into view. In fact, any collision with any tile while it's flickering into view will reset the flicker timer.
    • geometric - the parameter for the geometric progression that the flicker pause intervals follow. Lower numbers = more drastic differences in how long the intervals between flickers are. Should never be negative or greater than 1! Currently the reference value is 0.4 and should not be changed without Turner's consent.
    • invisible_time - time the tile spends being completely invisible (i.e. not flickering)
    • normal_visible_time - time the tile spends being completely visible (i.e. not flickering)
Your level may also have the following group layer:
  • "level markers" is used for level locations, currently only the location of the win zone. By default, this is the right edge of the level. However, if you have a custom win location, create a rectangle object in this layer with name "finish". (Object properties/names are set by right-clicking the object and selecting "Object Properties")
Your level may also include any number of text layers, which may be named any way you want, as long as they include the following layer properties:
  • "text": the text you would like to appear. Dollar signs "$" denote new lines
  • "x": the x-position, _in pixels_, of the text.
  • "y": the y-position.
Optional properties:
  • "r": the red component of the color used to display the text.
  • "g": the green component of the color used to display the text.
  • "b": the blue component of the color used to display the text. You must include all three to get a custom color for the text, otherwise the default (white) will be used.
Text layers will show their text whenever a bunny is overlaps with a tile on the layer. Tiles on the layer will be made invisible by the code, so you can see them while developing, but players will not.

For each set of moving tiles, create a new layer with properties "speed", which is floating-point and in tiles per second, and "translationX" and "translationY", which specify how far away the final position is, in tiles. NOTE: the collision engine does not yet handle players being crushed by moving platforms, so make sure you don't let that happen.

For each checkpoint, create a new layer with property "type" equal to "checkpoint". Use the tileset in levelMarkers.png, using the green "C" tiles for the triggering wall and the pink and yellow "C" tiles for respawn positions. See split_world for an example.

Level Properties

If you want a different camera system, go into Map > Map Properties in Tiled, and set a property "camera". The value "panning" is the default camera, "stalking" is the other which follows the players as they move in the level. If you want a wall of death, please specify it by setting a property called "wallofdeath", and set the speed of the wall in pixels per millisecond. If no valid decimal value is given, it will default to 0.035.

Tileset Files

Please make sure that these files and the .tmx files are in same folder when you create them - otherwise, other people will ask why they're getting "Unable to locate file C:\Users\xiao\Documents\BunnyLevels" errors instead of loading levels.

When you want to playtest, please make sure these files get moved to the Platformer/assets/Levels/ directory. Make sure it's a descriptive name so we know what level this is without having to play it!

PlatformerGame.java

When you want to play your new level, open up the PlatformerGame.java file in the Platformer/src/com/gravity/root directory. You'll see a "levels" array near the top of the file. Add a new entry to the list, with a short title, description, path to your new level, and a level id. The level id is nothing special, just some number in sequece after 1000 that no other level has. Start up the game, it should just work!

Implementing new Mechanics

If you have a mechanic you want to implement for your level, feel free to implement the mechanic yourself *provided it is on YOUR OWN BRANCH in the repository*. Also feel free to bring up your new mechanic in meetings or email mazemaker@, and see if the programmers can do it for you ^_^.

Final Comment

If you have any questions, PLEASE EMAIL/CHAT the group or just the programmers so we can help you design your level. We're all in this together, after all.

Clone this wiki locally