-
-
Notifications
You must be signed in to change notification settings - Fork 2
Loading tilemaps
As said in the previous section, the tileset is stored in an appvar, so be sure to transfer TILES.8xp
to your calculator. We need to 'load' the appvar data in our ICE program, and that is what the token LoadData(
is for. Copy the data from the text file and put the token in front of it. This returns a pointer to the table with pointers to the sprites. If you have no idea what that means; no problem, you don't need to understand it. However, you need to store this pointer into a variable, which we will use in DefineTilemap(
. The syntax for DefineTilemap(
is this:
DefineTilemap(TILE_HEIGHT,TILE_WIDTH,DRAW_HEIGHT,DRAW_WIDTH,TYPE_WIDTH,TYPE_HEIGHT,TILEMAP_HEIGHT,TILEMAP_WIDTH,Y,X,PTR[,"MAP_DATA"])
Argument | Explanation |
---|---|
TILE_HEIGHT / TILE_WIDTH |
Individual tile pixel height / width (Respectively). |
DRAW_HEIGHT / DRAW_WIDTH |
Number of tiles per row / column to draw (Respectively). |
TYPE_WIDTH / TYPE_HEIGHT |
See the commands.html file for options. |
Y / X |
The Y / X pixel location of tilemap (Respectively). |
PTR |
Pointer to tiles (more information below). |
"MAP_DATA" |
Pointer to indexed map array (more information below). |
The most important argument is the PTR
one; that must be the variable holding the pointer from LoadData(
. You can get the "MAP_DATA"
from tilemaps.txt
, which we already converted earlier. This function returns a pointer to the tilemap struct, which should be used in the tilemap functions.
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