61
TI Z80 / Tile map helper
« on: November 23, 2011, 10:47:28 pm »
This is my tile map helper. It uses several simple subroutines to help with tilemapping. Just put prgmMAP at the end of your code. There are 4 routines.
EDIT:More info
This uses only vars r1-6 for stuff, so it should be safe. Just have a list of numbers representing your tile values, and corresponding sprite data. The first sprite is displayed for a value of 1 and so on.
Example of a simple terrain generator.
EDIT:More info
This uses only vars r1-6 for stuff, so it should be safe. Just have a list of numbers representing your tile values, and corresponding sprite data. The first sprite is displayed for a value of 1 and so on.
Code: [Select]
:sub(DSP,"pointer to tile data","pointer to sprite data"
This displays a tile map. For speed, it assumes a value of 0 means a blank tile.Code: [Select]
:sub(ADD,"tile number to add",X,Y,"pointer to data"
Adds a tile to the data, using normal co'ordsCode: [Select]
:sub(ADT,"tile number to add",X,Y,"pointer to data"
Same, but uses tile co'ords ( 12*8 )Code: [Select]
:sub(GET,"pointer to data",X,Y
Gets the value of the tile in the specified co'ords. Useful for checking if a tile is in the players way.Example of a simple terrain generator.