• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Multi-select help

I

izark

Guest
Hello!!
I hope you can help me with this one..

I want to select a group of objects:
I draw a rectangle on the screen with the cursor. All objects touching that rectangle (or inside it) are selected.
Then I can drag and drop the entire group and they are deselected after being dropped.
I can do the drag and drop thing with an object, the problem is groups of objects.

I am not looking for all the code, but a method and useful functions for this. Thank you!!
 

M. Idrees

Member
I think you have to use this [ collision_rectangle(x1,y1,x2,y2,obj,prec,notme); ] in all the objects that you want to select.
Remember to make the rectangle x1,y1,x2,y1 to global variables so then all the objects will find that where the rectangle is drawn.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Yep, collision_rectangle would be ideal. You would use a "with" to have all objects check themselves to see if they fall within the rectangle and if they do then their ID is added to a ds_list or something. You can then parse the ds_list for moving/manipulating those objects.
 
I

izark

Guest
I think you have to use this [ collision_rectangle(x1,y1,x2,y2,obj,prec,notme); ] in all the objects that you want to select.
Remember to make the rectangle x1,y1,x2,y1 to global variables so then all the objects will find that where the rectangle is drawn.
Yep, collision_rectangle would be ideal. You would use a "with" to have all objects check themselves to see if they fall within the rectangle and if they do then their ID is added to a ds_list or something. You can then parse the ds_list for moving/manipulating those objects.
Thank you for both answers, this is very helpful, I think it is clear now.
I parse then the ds_list and run a similar code to the code for dragging and dropping one
object preserving their relative distance.
 
Top