Sheet = class("Sheet") function Sheet:initialize(img, tileWidth, tileHeight) self.x = 0 self.y = 0 self.image = img self.tw = tileWidth self.th = tileHeight self.quads = {} local i = 1 local iw, ih = img:getWidth(), img:getHeight() for y = 0, ih, tileHeight do for x = 0, iw, tileWidth do self.quads[i] = love.graphics.newQuad(x, y, tileWidth, tileHeight, iw, ih) i = i + 1 end end end