Page 1 of 1

idea for selecting things

PostPosted: Wed Feb 24, 2010 7:24 pm
by Superbeni
I had an idea, but I don´t know if this is possible: Drawing a square and scale it to the cursor, if the mouse button is released, it´s easy to check the selected things with collision.
Would this work in a way like this? :?:

(I would also like to know how to scale, could somone make a little demo? :mrgreen: )

Re: idea for selecting things

PostPosted: Wed Feb 24, 2010 8:16 pm
by Hblade
It might, give it a shot :D

Re: idea for selecting things

PostPosted: Thu Feb 25, 2010 10:30 am
by 4erv'
Look here. Maybe it is what you need :D

Re: idea for selecting things

PostPosted: Thu Feb 25, 2010 11:22 am
by thunderios
I thought collisions take a lot of memory. Instead, I would have used the coordinates of what you want to select to see if it's within the box.

Re: idea for selecting things

PostPosted: Thu Feb 25, 2010 9:55 pm
by DST
Background>MouseButtonDown>Left>
Code: Select all
    draw=1;       
    xprev=xmouse;
    yprev=ymouse;


Canvas>Draw Actor>
Code: Select all
    erase(255,255,255,1);
    if(draw==1){
    setpen(0, 100, 255, 0, 1);
    moveto(xmouse, ymouse);
    lineto(xprev, ymouse);
    lineto(xprev, yprev);
    lineto(xmouse, yprev);
    lineto(xmouse, ymouse);
           }


Background>MouseButtonUp>left>
Code: Select all
    if(draw==1){
    CreateTimer("unit", "1", 100);
    draw=0;
    }


Unit>Timer>1>
Code: Select all
    if(x<max(xprev, xmouse) && x>min(xprev, xmouse) && y<max(yprev, ymouse) && y>min(yprev, ymouse)){
    selected=1;
    }

Re: idea for selecting things

PostPosted: Fri Feb 26, 2010 1:11 pm
by Bee-Ant
DST, Isn't this supposed to select multiple object inside the square ???