img = love.graphics.newImage("test.png")
for x =0, 5 do
for y =0, 1 do
tile[x,y]=love.graphics.newQuad(x*100,y*100,(x*100)+100, (y*100)+100, img:getDimensions())
end
end
function love.draw()
for x =0, 5 do
for y =0, 1 do
love.graphics.draw(img, tile(x,y), x*100, y*100)
end
end
end
The difference between stupidity and genius is that genius has its limits.
Here's a re-implementation of your code. Take note of my usage of tile[x][y] compared to your tile[x,y] in your first Loop... and the tile[x] = {} before that.
I also don't know the context of your tile(x,y) in love.draw(), so I also converted it to tile[x][y].
img = love.graphics.newImage("test.png")
tile = {}
for x =0, 5 do
tile[x] = {}
for y =0, 1 do
tile[x][y]=love.graphics.newQuad(x*100,y*100,(x*100)+100, (y*100)+100, img:getDimensions())
end
end
function love.draw()
for x =0, 5 do
for y =0, 1 do
love.graphics.draw(img, tile[x][y], x*100, y*100)
end
end
end
Here's a re-implementation of your code. Take note of my usage of tile[x][y] compared to your tile[x,y] in your first Loop... and the tile[x] = {} before that.
I also don't know the context of your tile(x,y) in love.draw(), so I also converted it to tile[x][y].
You understood me perfectly! <3
Thank you sphyrth. It works now.
But i get tearing.
The 12 tiles are drawn correctly, but then....
Edit: I don't know why the images wont show, but you can "right-click" them and open in new tab.
Here is the original image:
The difference between stupidity and genius is that genius has its limits.
As for tearing, there might be some miscalculations this time, i want to doubt that quad-bleeding would be the issue here... although to be honest, i also want to assume that if we knew what you wanted to implement, your end goal, we could suggest a better method to implement it with.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.