• 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!

solecting differnet groups of objects

1213brett

Member
hello. I have the fallowing code attached to my curser object. but when I drag the box over just one object both objects are always selected. I just want any and all object inside the drag box to be selected. Do you know how I could go about doing this? Any help would be appreciated thank you.

//in create event
drawing = false
selectionParent=Curser

//in left mouse pressed event
drawing = true
startX = mouse_x
startY = mouse_y

//in left mouse released event
drawing = false
endX = mouse_x
endY = mouse_y
with (selectionParent) {
collision_rectangle( other.startX,other.startY,other.endX,other.endY,EInf,false,true)
global.MAASolected=true
}
with (selectionParent) {
collision_rectangle( other.startX,other.startY,other.endX,other.endY,EKing,false,true)
global.EKSolected=true
}

//in draw event
if (drawing){
draw_rectangle(startX,startY,mouse_y,mouse_y,true)
}

//in step event
x=mouse_x
y=mouse_y
 

FrostyCat

Redemption Seeker
You forgot the if before collision_rectangle().

There is no such thing as a function or operator that is only for use with if. If you don't put the if in, it won't be added for you no matter how much you believe this myth. And if the result of that is syntactically valid code, too bad, you will be the one wasting time finding the problem instead of the compiler.
 

rIKmAN

Member
Why not ask the person who gave you that code in your other thread?

They already have knowledge of your problem and have taken time to try and help you so you should at least explain in there that you are having issues with the code that was posted instead of making another topic for the same problem.
 
Last edited:
Top