Hello everybody!
General quadrilateral:
_rect = display.newRect( display.contentCenterX, display.contentCenterY, 300, 300 );
_rect.halfW = _rect.width / 2;
_rect.halfH = _rect.height / 2;
_rect.l = _rect.x - _rect.halfW;
_rect.r = _rect.x + _rect.halfW;
_rect.t = _rect.y - _rect.halfH;
_rect.b = _rect.y + _rect.halfH;
if mX > _rect.l and mY < _rect.r and mY > rect.b and mY < rect.t then
print( “hit” );
end
But if triangle or polygon or non rule rectangle, How to achieve code?
Thank you!