Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: mrmprog on November 23, 2011, 10:47:28 pm

Title: Tile map helper
Post by: mrmprog 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.



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'ords
Code: [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.
(http://img.removedfromgame.com/imgs/map1.gif)
Example of a simple terrain generator.
Title: Re: Tile map helper
Post by: aeTIos on November 23, 2011, 11:02:34 pm
Looks pretty nice, should check this out.
Title: Re: Tile map helper
Post by: chattahippie on November 23, 2011, 11:41:06 pm
Instead of putting sub(), you are able to use DSP(arg1,arg2) and so on