I have been working on a simplistic RTS, but I have been having trouble with Box Selection. (Drag to select multiple units.) I wrote this code:
Code:
if (mouse_left == on) && (mouse_moving)
{
boxX=mouse_pos.x;
boxY=mouse_pos.y;
mouse_map = Mouse_Box;
while(mouse_left == on)
{
draw_line(vector(BoxX, BoxY, 0), NULL, 90);
draw_line(vector(BoxX, mouse_pos.Y, 0), vector(140,131,131), 90);
draw_line(vector(mouse_pos.x, mouse_pos.y, 0), vector(140,131,131), 90);
draw_line(vector(mouse_pos.x, BoxY, 0), vector(140,131,131), 90);
draw_line(vector(BoxX, BoxY, 0), vector(140,131,131), 90);
wait(1);
}
}
It works fine, and the box looks good, but I don't know how to select the units inside of it. Does anyone know how to do this? (I thought about using C_scan, or creating a block to go collide with my units, but really i'm stumped...)