RetroBASIC
Retrogamecoding(.org) => EGSL => Topic started by: pielago on September 05, 2017, 09:54:02 PM
-
looking at the documentation I saw tilesets but I am not able to work them!
I see
loadtileset(filename, lines,rows,string )
tileset( image, lines,rows,string )
I tried to do it but the string? got me confused
can someone give me a small example how to properly use it
hope someone respond and thanks so much!
-
It's similar to the bitmapfont function.
Let's assume you have an image with two tiles in it. Now you can load your image with
mytile=loadtileset ("image.png",1,2,"ab")
or if you already loaded the image
mytile=tileset(image,1,2,"ab")
The string is similar to the fontface of a bitmapfont, so if you want to draw the first tile you do the following:
drawtile (0, 0, "a", mytile)
the second tile
drawtile (0, 0, "b", mytile)
or a longer line (with both tiles)
drawtile (0, 0, "aaabbaabbbbaaaabbaaa", mytile)
It's not very nice as you can see, I recommend it only for background drawing where no tiles are changing because string manipulation is slower than using numbers. (And of course you are limited to a string which means if you are using the alphabet you can handle with upper and lower case 52 tiles.)
-
thank you so much ill practice the tiles...