A question about drawing backgrounds from tilesets
A question about drawing backgrounds from tilesets
I seem to remember reading that even though backgrounds get broken into tiles with grit, you can't just make an array and draw your background (forest, forest, grass, water...). I'm trying to make a rogue-like and need to draw dynamic backgrounds, so would i need to assign a vram bank as my background drawing board and stamp sprite tiles all over it then copy it as a background, or just use sprites for my map tiles and draw it all on the same layer as my character and npcs?
Re: A question about drawing backgrounds from tilesets
I think you might want to take a look at the all_in_one example. In R25 it's located under examples\nds\Graphics\Backgrounds\all_in_one
Re: A question about drawing backgrounds from tilesets
To draw dynamic backgrounds you can save an bidimensional array were store the map information. Every element in the array points to a portion of tiles. Think you want to draw a 1024*1024 background but DS screens are 256*192. Every tile has 8*8 pixels, and a map so your array must have 128*128 elements(1024/8). But this array is not allocated in Vram, it is in the Ram. So when you want to draw the backgroud you must do this
1.-Calculate the position of the upper left corner on the screen in the array
2.-From this position get the 32*24 ( (256/8) * (192/8) ) elements in the array
3.-Copy this elements to Vram in the position you have the map for this background
This three steps have a lot of work, but this is mi idea to make a dynamic bg.
1.-Calculate the position of the upper left corner on the screen in the array
2.-From this position get the 32*24 ( (256/8) * (192/8) ) elements in the array
3.-Copy this elements to Vram in the position you have the map for this background
This three steps have a lot of work, but this is mi idea to make a dynamic bg.
Who is online
Users browsing this forum: No registered users and 0 guests