Author Topic: Tile map helper  (Read 3066 times)

0 Members and 1 Guest are viewing this topic.

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
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.



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.

Example of a simple terrain generator.
« Last Edit: November 23, 2011, 10:51:34 pm by mrmprog »

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Tile map helper
« Reply #1 on: November 23, 2011, 11:02:34 pm »
Looks pretty nice, should check this out.
I'm not a nerd but I pretend:

Offline chattahippie

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +27/-0
  • Super Member! :D
    • View Profile
Re: Tile map helper
« Reply #2 on: November 23, 2011, 11:41:06 pm »
Instead of putting sub(), you are able to use DSP(arg1,arg2) and so on