do hitbox=class() hitbox.width=0 hitbox.height=0 function round(num)--to nearest int return math.floor(num+0.5) end function hitbox:init(width, height) self.width=width self.height=height self:rst() end function hitbox:test(x, y, targX, targY)--x, y is top left if targX~=nil and targY~=nil then targX=round(targX-x) targY=round(targY-y) if targX>=0 and targX=0 and targY=0 and x=0 and ypoints[j][2] then local tmp={points[i][1], points[i][2]} points[i][1]=points[j][1] points[i][2]=points[j][2] points[j][1]=tmp[1] points[j][2]=tmp[2] elseif points[i][2]==points[j][2] then if points[i][1]>points[j][1] then local tmp={points[i][1], points[i][2]} points[i][1]=points[j][1] points[i][2]=points[j][2] points[j][1]=tmp[1] points[j][2]=tmp[2] end end end end if points[1][2]==points[2][2] then--two points are smaller coords. increment y local xSlope1=(points[3][1]-points[1][1])/(points[3][2]-points[1][2]) local xSlope2=(points[3][1]-points[2][1])/(points[3][2]-points[2][2]) local startX=points[1][1] local endX=points[2][1] if endX