using draw.graphics.rectangle to draw tiles
Posted: Mon Nov 07, 2011 9:06 pm
Hi.
I recently started using Love to shape a longtime dream into reality (agreed that sounds weird).
I'm making a 2D, tile-based, turn-based sim/strategy game. Right now I'm at the stage where I'm trying to draw a scrolling 2d map onto the screen. This works well using tilesets and some newSpriteBatch magic. So far, so good.
However, I want to impose a sense of altitude in each tile by having an altitude value (each tile gets a value between 0 and 255 assigned which is it's altitude) determine the background color of the tile, and put trees, animals, buildings etc. on top of that using tilesets. So instead of using preloaded background tiles I use draw.graphics.rectangle() directly to build my background.
This works well in terms of FPS (my tiles are 16x16 and I draw on a 1024x640 screen)--everything renders quickly even while scrolling. But since I use a double for/next loop to draw each rectangle, there's a delay in drawing between the 1st and last rectangle, which is very annoying to the eyes.
I initially wanted to use framebuffers but I get the dreaded "Cannot create framebuffer: Not supported by your OpenGL implementation" message, so I turned to rectangles.
My question: is there any other way to do this? Can I draw rectangles into quads and put those into tilesets?
I use Love 0.7.2 on a mid-2009 MBP13" 4GB 2.53GHz Core2Duo, running Mac OS X 10.5.8.
Oh and what code editor do you guys recommend?
cheers
I recently started using Love to shape a longtime dream into reality (agreed that sounds weird).
I'm making a 2D, tile-based, turn-based sim/strategy game. Right now I'm at the stage where I'm trying to draw a scrolling 2d map onto the screen. This works well using tilesets and some newSpriteBatch magic. So far, so good.
However, I want to impose a sense of altitude in each tile by having an altitude value (each tile gets a value between 0 and 255 assigned which is it's altitude) determine the background color of the tile, and put trees, animals, buildings etc. on top of that using tilesets. So instead of using preloaded background tiles I use draw.graphics.rectangle() directly to build my background.
This works well in terms of FPS (my tiles are 16x16 and I draw on a 1024x640 screen)--everything renders quickly even while scrolling. But since I use a double for/next loop to draw each rectangle, there's a delay in drawing between the 1st and last rectangle, which is very annoying to the eyes.
I initially wanted to use framebuffers but I get the dreaded "Cannot create framebuffer: Not supported by your OpenGL implementation" message, so I turned to rectangles.
My question: is there any other way to do this? Can I draw rectangles into quads and put those into tilesets?
I use Love 0.7.2 on a mid-2009 MBP13" 4GB 2.53GHz Core2Duo, running Mac OS X 10.5.8.
Oh and what code editor do you guys recommend?
cheers