Page 1 of 1

Selecting objects

PostPosted: Fri May 09, 2008 4:46 pm
by 4erv'
How to create something to select objects like that one in the picture ( when i'm mooving the mouse, square gets bigger and bigger like in the OS (operating system).). :?:

Re: Selecting objects

PostPosted: Sat May 10, 2008 12:51 am
by DilloDude
Basically you can draw a rectangle on a canvas. When you click, store the mouse position, and set a variable. On draw, check the variable to see if you are clicking, and if so, (re)draw a rectangle from the click position to the current mouse position. On mouse button up, turn off the variable, and erase the rectangle. Then a good way is to loop through every object that can be selected, and if it's inside that rectangle, select it.

Re: Selecting objects

PostPosted: Sat May 10, 2008 4:04 am
by DST
I was experimenting with this....it would be nice if we could just call a collision from the rectangle itself.....
I'm always trying to use collide to determine events but there's so many instances where it doesn't work right.

In a puzzle game, i got all the blocks to fall and stop evenly with an array. Problem is...i couldn't use collide...cause they were perfectly stacked and there were no collisions to occur....:(

Re: Selecting objects

PostPosted: Sat Jun 21, 2008 1:01 am
by DST
Here it is! Selecting multiple objects in Ge....Just like you do in windows!

They don't deselect when you change the box size, just draw another one!
seltools.jpg

Re: Selecting objects

PostPosted: Sat Jun 21, 2008 11:07 am
by 4erv'
Thanks! :D

Re: Selecting objects

PostPosted: Sun Jun 22, 2008 5:09 am
by DST
I also found a way to fill the box in with a transparent color, and it worked great, at least....except for using 95% of a 3.6ghz cpu. So you'll have to settle for the empty box :D