I'm trying to render a background made of a repeated tile (let's say 100x100px) in a great square (let's say 3000x3000px) that is the ground where the player walks. I've got four types of tiles, but I display just one at a time! For example, for a while there is a sandy ground, then a grassy ground, and so on. But for a while there is only one type of tile repeated over and over, and then there is a little transition between a place to another, and then the second tile repeated over and over.
Basically, I'm achieving this by making four images (100x100) and a great quad (3000x3000) in which the images are repeated.
The code is roughly this:
Code: Select all
function love.load()
blockimage = {}
for i = 1, 4 do
blockimage[i] = love.graphics.newImage("graphics/block"..i..".png")
blockimage[i]:setWrap("repeat", "repeat")
blockquad[i] = love.graphics.newQuad(0, 0, 3000, 3000, 100, 100)
end
ind = 1
end
function love.draw()
love.graphics.draw(blockimage[ind], blockquad[ind], 0, 300)
end
And, generally... to display four tipes of different but uniform background, is it better (performance-wise) to use Quads or SpriteBatch? Thanks!