MeBoingus
Member
Hi all!
I'm busy working on a simple editing program that allows the user to move and rotate sprites. Long story short, I'm drawing a box around these sprites using the following code:
And it's working a treat. My problem is that I now need to detect when this new, rotated rectangle is clicked.
Due to the way everything's being drawn, any of the 'position_meeting' or 'place_meeting'-style functions are out of the question, as the object that's drawing the sprite (it's actually drawing ALL of the sprites that can be altered, but I've simplified this code down to basic, built-in variables) doesn't have any form of collision mask, and simply cannot.
Any idea how I could detect if the mouse is within this specific area?
I'm busy working on a simple editing program that allows the user to move and rotate sprites. Long story short, I'm drawing a box around these sprites using the following code:
GML:
var _left = -sprite_xoffset;
var _top = -sprite_yoffset;
var _right = sprite_width + _left;
var _bottom = sprite_height + _top;
var _c = dcos(image_angle);
var _s = dsin(image_angle);
var _x0 = x + _left * _c + _top * _s;
var _y0 = y + _left * -_s + _top * _c;
var _x1 = x + _right * _c + _top * _s;
var _y1 = y + _right * -_s + _top * _c;
var _x2 = x + _right * _c + _bottom * _s;
var _y2 = y + _right * -_s + _bottom * _c;
var _x3 = x + _left * _c + _bottom * _s;
var _y3 = y + _left * -_s + _bottom * _c;
draw_line_color(_x0, _y0, _x1, _y1, c_lime, c_lime);
draw_line_color(_x1, _y1, _x2, _y2, c_lime, c_lime);
draw_line_color(_x2, _y2, _x3, _y3, c_lime, c_lime);
draw_line_color(_x3, _y3, _x0, _y0, c_lime, c_lime);
And it's working a treat. My problem is that I now need to detect when this new, rotated rectangle is clicked.
Due to the way everything's being drawn, any of the 'position_meeting' or 'place_meeting'-style functions are out of the question, as the object that's drawing the sprite (it's actually drawing ALL of the sprites that can be altered, but I've simplified this code down to basic, built-in variables) doesn't have any form of collision mask, and simply cannot.
Any idea how I could detect if the mouse is within this specific area?