Level Design of Legend of Tux

From LD Smith Games Workshop
Jump to navigation Jump to search

General Process

  • Create tile data and enemy data arrays
    • Create tiles/collision block data
    • Add enemy data
  • Make the level selectable in the lotux.c file
  • Add mappings in the file_read.c file, in the "getMapArray", "getCollisionMapArray", and "loadEnemiesArray" for the level to the arrays defined in the maps.h file. The arrays in maps.h are named levelX_Y_mapZ, where X is the level number, Y is the room number, Z=0 for the collision/title array, and Z=1 for the enemies array. In the future, there may be a separate tile and collision array, for invisible walls, but at the game's current state I am just making all walls impassible
  • Modify the bkg.bmp, block01.bmp, block01_00.bmp, block01_01.bmp, block01_10.bmp, and block01_11.bmp files in the "images/level" directory (where "level" is the name of the level, such as astro, bolt, flame, etc). Use gimp set the background image in bkg.bmp, and make the block01 files have a color scheme appropriate for the level, such as make the blocks a dark red color for the flame world. Ensure that there is a high contrast between bkg.bmp and the block01 files, so that the user is able to clearly distinguish the background from the impassible wall blocks.
  • Add music for the level, and enable the music in the lotux.c file

Creating the tile data

Download Mappy: http://www.tilemap.co.uk/mappy.php

Extract the zip file to a directory

Start Mappy

Select File => New Map

Use the following settings

Mappy001.jpg

Press "OK"

Press "OK" to the warning

Select File => Import

Navigate to the project directory, and select the "tiles.bmp" file in the images directory

(Use Gimp to modify the tiles.bmp file to add new tiles, if needed)

Ensure that Layer 0 is selected. Layer 0 will hold the collision block data

Mappy002.jpg

Select the second block (1/64), and use it to draw the collision blocks. Make sure the whole room is enclosed, and leave an empty space to join to the next room. If the is not the first room, make sure to leave an empty space aligned with the door from the previous room.

Use the "f" key to flood fill tiles; "z" key to undo mistakes

Mappy003.jpg

Use the third block to draw the door, which will be removed once all enemies are defeated. So far, I have been using blocks locations 31,9 through 31,13 for the door. Make sure blocks 0,9 through 0,13 are empty in the next room, otherwise the player may get stuck in the wall when zoning into the next room.

Mappy004.jpg

Select Layer => New Layer

Ensure that the New Layer is selected

Select Onion Skin

Mappy005.jpg

Check "Enable Onion Skin" and ensure that Background Layer is set to 0

Mappy006.jpg


Use block 1/64 to set the starting enemy location. Currently, the game only has one type of enemy. However, in the future we may use other tiles for different enemies. You may also want to use a different sprite sheet for enemies.


Mappy008.jpg


File => Save As

Navigate to the "maps" directory. Save the map as "levelX_Y.FMP" where X is the level number and Y is the room number.

Mappy009.jpg


File => Export as text

Use the following settings. Ensure that "Prefix with" is set to "int"

(Colour Map can be unchecked, but it won't hurt anything to leave it checked)

Mappy010.jpg

In cygwin, navigate to the project directory.

Go to the "maps" directory, add "cat levelX_Y.TXT >> maps.h" to the file, run makeheader, and copy the maps.h up to the project directory

 # cd maps
 # vi makeheader
 # ./makeheader
 # cp maps.h ..

Press "OK"

Edit the file_read.c file and add mappings for the new level. Hopefully, I will have time in the future to figure how to simplify this process so the three huge switch statements aren't needed.