1quad = class:new() 2 3--COLLIDE? 4--INVISIBLE? 5--BREAKABLE? 6--COINBLOCK? 7--COIN? 8--_NOT_ PORTALABLE? 9 10function quad:init(img, imgdata, x, y, width, height) 11 --get if empty? 12 13 self.image = img 14 self.quad = love.graphics.newQuad((x-1)*17, (y-1)*17, 16, 16, width, height) 15 16 --get collision 17 self.collision = false 18 local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17) 19 if a > 127 then 20 self.collision = true 21 end 22 23 --get invisible 24 self.invisible = false 25 local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+1) 26 if a > 127 then 27 self.invisible = true 28 end 29 30 --get breakable 31 self.breakable = false 32 local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+2) 33 if a > 127 then 34 self.breakable = true 35 end 36 37 --get coinblock 38 self.coinblock = false 39 local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+3) 40 if a > 127 then 41 self.coinblock = true 42 end 43 44 --get coin 45 self.coin = false 46 local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+4) 47 if a > 127 then 48 self.coin = true 49 end 50 51 self.portalable = true 52 local r, g, b, a = imgdata:getPixel(x*17-1, (y-1)*17+5) 53 if a > 127 then 54 self.portalable = false 55 end 56end