My code is as follows:
Code: Select all
function love.load()
Tileset = love.graphics.newImage('countryside.png')
local tileW = 32
local tileH = 32
local tilesetW = Tileset:getWidth()
local tilesetH = Tileset:getHeight()
GrassQuad = love.graphics.newQuad(0, 0, tileW, tileH, tilesetW, tilesetH)
BoxQuad = love.graphics.newQuad(32, 0, tileW, tileH, tilesetW, tilesetH)
end
function love.draw()
love.graphics.draw(Tileset, GrassQuad, 368, 268)
love.graphics.draw(Tileset, GrassQuad, 400, 268)
love.graphics.draw(Tileset, GrassQuad, 432, 268)
love.graphics.draw(Tileset, GrassQuad, 368, 300)
love.graphics.draw(Tileset, BoxQuad , 400, 300)
love.graphics.draw(Tileset, GrassQuad, 432, 300)
love.graphics.draw(Tileset, GrassQuad, 368, 332)
love.graphics.draw(Tileset, GrassQuad, 400, 332)
love.graphics.draw(Tileset, GrassQuad, 432, 332)
end
Code: Select all
main.lua: 16 bad argument #2 to 'draw' (number expected, got userdata)
Traceback
[C]: in function 'draw'
main.lua:16: in function 'draw'
[C]: in function 'xpcall'