While iterating through the items, it uses this function to render each: love.graphics.draw(obj.image,obj.quad,x * drawsize,y * drawsize,0,drawsize / 32,drawsize / 32)
And there also is camera translation.
I'm not really good at this kind of thing so I've been cracking my head for two days now trying to realize how should I convert world touch coordinates into local image and quad coordinates. I made this function but the conversion isn't working:
Code: Select all
function overimage(image,quad,xx,yy)
local imgdata = image:getData()
local quadx,quady = quad:getViewport()
local localx = touch.x + camera.dx - xx
local localy = touch.y + camera.dy - yy
local r,g,b,a = imgdata:getPixel(localx,localy)
if touch.beingpressed then
if a > 50 then
return true
end
end
end