▲ 3 r/love2d
why cant i set a variable to an image without directly setting it?
i want to make it so i can set a "sprite" variable to userdata
but it ends up being nil for some reason
function love.load()
room = love.graphics.newImage("room.png") --the art
end
function tilerectangle(tx,ty,width,height,id)
for i=1,height do
for i=1,width do
table.insert(tiles,{
x = tx,
y = ty,
type = "room",
roomid = id,
sprite = room --when i draw this tile i draw it with the info in here
})
tx = tx + 1 * gridsize
end
ty = ty + 1 * gridsize
tx = tx - width * gridsize
end
end
u/Doithedum — 4 days ago