Legacy GM Building sprites in a selection box


I was wondering if anyone can help me. I am doing a tycoon type game where the player Will be able to build a floor using sprites. I would like it so that the floor sprites would be built by using a selection box that the player would create themselves by holding down a mouse button and dragging the cursor over and area drawing a transparent box and upon releasing the button, the area that the selection box occupied is now filled in with the selected floor sprites.
I have done the selection box and wanted to try the variable draw_sprite_tile to draw in the floor sprites but I believe that would fill the entire screen.
Can anyone offer a suggestion?


Could be done in a number of ways. Using a control object, you could set a variable to true inside a Global Mouse Pressed event. Set it to false when the given key is released using a Global Mouse Released event and create the tile that you had earlier selected. To align the selection box to a grid, you could have done this:

if (draw_m) {
   draw_sprite(spr_Selection, 0, mouse_x & ~31, mouse_y & ~31);
That would have aligned it to a grid of size 32x32. To align to a grid of different size, you could use the general formulae mouse_x & ~(w-1) and mouse_y & ~(h-1). For instance, to align to a grid of size 64x32, you would have used mouse_x & ~63 and mouse_y & ~31 instead.