-
-
Notifications
You must be signed in to change notification settings - Fork 2
Creating tilemaps
Games often use tilemaps, so it’s important to cover them in this guide. Using tilemaps is a bit harder than sprites, but definitely not impossible. You need ConvPNG and ConvTile to convert to ICE format. Be sure to put them both in the same folder! To edit tilemaps, we will use Tiled.
You can't use tilemaps without a tileset. This means we first need to make a tileset, consisting of tiles of equal size. Again, you can use your favorite sprite editor (tiles are basically sprites). Be sure to save the tileset as a .PNG in the same folder as the three tools! In this guide we will use this tileset:

With this tileset we are going to create the tilemap. That is why we need Tiled, a 2D level editor that will help us designing the tilemap. When you open Tiled, you need to create a tilemap, so click on the button New Map.
Note: Tile layer format should be CSV!
Change the map size and tile size to what you want, and save it in the folder where you stored the tools and tileset. But, we currently have only an empty tilemap, without any tiles. Click on File > New > New Tileset, browse for your tileset and save this tileset somewhere (you don't need it, unless you want to create more tilemaps with the same tileset). Go back to your tilemap, and start editing! Example:

When you are ready with editing, export this tilemap as a .csv file, and be sure to save it in the same folder again. Now we need to convert the .csv file to ICE format, and what is why we need ConvTile. Open Command Prompt, navigate to the folder, and run convtile --ice. The converted files will be in tilemaps.txt.
However, we still have one big problem. A tileset of 128x64 doesn't fit within one program! The only solution would be to store it in an appvar, and load the tileset from the appvar in ICE. That is why we need to use ConvPNG again. Create a new file with the following text in it:
#AppvarICE : TILES
#PNGImages :
#GroupICE : tileset_gfx
#OutputPaletteArray : false
#Tilemap : 16,16,true
#Palette : xlibc
#PNGImages :
Put the name of the tileset under both the #PNGImages : lines, and save the file as convpng.ini, again in the same folder. Double-click on the convpng.exe file, and if everything went right, TILES.8xv will be created, and tiles.txt. You will see a line of text which looks like this:
"TILES",0,384
These are the arguments of LoadData(, which we will explain in the next section.
ICE Compiler | Peter Tillema
- Introduction
- Building your first program
- Math and numbers
- Variables
- Standard system commands
- Program flow control
- Pointers
- Graphics
- Sprites
- Tilemaps
- Useful routines