Putting rectangles in a table and drawing to screen
Posted: Sun Apr 23, 2017 6:47 pm
I've been trying to figure out how I could put rectangles (created with love.graphics.rectangle()) into a table and draw them to the screen as you would a tileset. It seems like something that would be easy but I can't seem to figure it out. And if you're wondering, my game requires that the player can change the width and height of the objects, that's why I can't use regular sprites.
and here's the table code, I was planning on adding to the x value in a for loop to draw them in a straight line.
and here's the table code, I was planning on adding to the x value in a for loop to draw them in a straight line.
Code: Select all
objects = {
love.graphics.rectangle("line", rectX, 490, 50, 50),
love.graphics.rectangle("line", rectX, 490, 50, 50),
love.graphics.rectangle("line", rectX, 490, 50, 50),
love.graphics.rectangle("line", rectX, 490, 50, 50),
love.graphics.rectangle("line", rectX, 490, 50, 50)
}