Selecting objects

Game Editor comments and discussion.

Selecting objects

Postby 4erv' » Fri May 09, 2008 4:46 pm

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).). :?:
Attachments
exmpl.jpg
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Selecting objects

Postby DilloDude » Sat May 10, 2008 12:51 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: Selecting objects

Postby DST » Sat May 10, 2008 4:04 am

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....:(
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Selecting objects

Postby DST » Sat Jun 21, 2008 1:01 am

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
Attachments
selection.zip
(130.27 KiB) Downloaded 148 times
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Selecting objects

Postby 4erv' » Sat Jun 21, 2008 11:07 am

Thanks! :D
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Selecting objects

Postby DST » Sun Jun 22, 2008 5:09 am

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
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron