M
MUZZY
Guest
is it possible to make a rectangle with the draw_rectangle function, that will be solid(like an instance)?
thanks!
thanks!
Last edited by a moderator:
an instanceWhat do you mean by solid? As in coloured in? Or that other instances can collide with it?
i'm sorry, i was unclear. i ment solid, like an instance. a thing you can collide withYes, just set the last argument to false.
For the record, you should always check the manual for these sorts of things - it will show you what all the arguments for each function do, and give you some code samples.
if (point_in_rectangle(obj_player.x, obj_player.y, 200, 200, 400, 450))
{
// ...
}
Welcome~
Please provide more information on what you are trying to do. As a rough idea, you want to check for collisions with an instance. If it is so, you can use point_in_rectangle() and give it the parameters that you used in the draw_rectangle() call. For instance, if you drew a rectangle between (200, 200) and (400, 450), you may do this:
Again we can't give an accurate response unless enough information is provided.Code:if (point_in_rectangle(obj_player.x, obj_player.y, 200, 200, 400, 450)) { // ... }
// The size of the drawn rectangle
size_x = 512;
size_y = 64;
// Ideally, you'll either want to create a constant for the '32' value, or use 'sprite_get_width/height' to dynamically obtain the value, but this is just an example
image_xscale = size_x / 32;
image_yscale = size_y / 32;
draw_rectangle(x, y, x + size_x, y + size_y, false);