The title basically says it all. I am looking for a better, more in-depth documentation of the DrawTileMap basic function, because try as I might, I can't seem to figure out what each argument means/does and how it all works so I can use it in a program. If anyone could help me with this, it would be great! Thanks in advance!
So here is what I use:
First, use the LibHelp program. That'll give a good explanation of the function.
Second, I would suggest using TokenIDE to draw the map. It makes the process WAY easier.
I hope this is helpful to you.
I'll attempt to explain each of the arguments in detail, let me know if you have any more questions Smile.

Matrix_number: A tilemap is stored in a matrix variable. Use 0 for [A] and 9 for [J] (you should be able to figure out how to use the other matrices based on that). Here is an example of a simple tilemap, stored in a matrix:

Code:
[[1,1,1,1,1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,0,0,0,0,1],
[1,0,2,0,0,0,0,0,0,2,0,1],
[1,0,0,0,0,3,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,0,0,1],
[1,0,0,2,0,0,0,0,0,4,0,1],
[1,0,0,0,0,0,3,0,0,0,0,1],
[1,1,1,1,1,1,1,1,1,1,1,1]]

Each number represents a tile, found in the Pic# argument you provide. 0 is the top left tile, 1 is directly to the right of it, and so on, left to right, up to down. For example, the tile directly below tile 0 would have the value of 12 (assuming 8x8 tiles), because there is only enough room for 12 8x8 tiles across. If the tile number at any place in the matrix is greater than 95, the routine will continue starting from the top left of the next Pic variable in numerical order (so if you are using Pic1, it will continue to Pic2, Pic3, etc. as necessary).

x_offset: This allows you to show more than one "view" of one tilemap. If it is 0, the top left tile of the matrix will in the top left of the screen. If this argument is greater than 0, the section of the tilemap that will be drawn changes.
y_offset: The same as x_offset, but for the y axis.

Width and Height: If the matrix you are using only contains the tilemap and no other data, these will just be the width and height of the matrix. Otherwise, set it to the width and height of whatever section of the matrix does contain the tilemap. Since lists are usually favored instead of matrices for data storage, you'll probably only have the tilemap in the matrix.

SStartX, SEndX, SStartY, SEndY: If you want the tilemap to take up the whole screen, SStartX and SStartY should both be 0, SEndX should be 12, and SEndY should be 8. Changing these values will result in a smaller area of the screen dedicated to showing the tilemap- for example, if you want the bottom area of the screen to show the player's score, you could decrease SEndY in order to leave some room there.

Pic#: See Matrix_number to learn how tiles are stored in the selected Pic variable.

Logic: Different ways to display each tile. If you want the tile to appear exactly as it looks in the Pic variable when recalled on a blank screen, use 0. As noted in the docs, you can also add 4 to this argument if you want the tile to be inverted.

tile_size: Set to 16 if your tiles are 16x16 pixels, otherwise put anything here and the tile size will be 8x8 (these are the only two options).

Update_LCD: If this is 0, the tilemap will not actually be drawn to the screen. This is useful if you want other things or sprites to appear on the screen at the same time as the tilemap. That way, you can use multiple drawing commands without updating the LCD and just use real(6) at the end to show everything you drew all at the same time.

Once again, let me know if this helps (or if I made a mistake in writing this, it's been a while since I've used xLib Razz).
Thank you very much, I tried what you said and it works perfectly! One quick question though: Are there any easier ways to make the picture variable that stores the tiles as well as the tilemap matrix than by hand? Thanks again for your help!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement