Legacy GM Collision with whole object

D

Dzoksi

Guest
HI everbody,
how to set that collision is true only if whole object "cover" another object, not just part?
It is dragable game, I drag an object and drop it above another, and I want to detect collision only if whole object is on another one, not just part. Thank you my GM friends :)
 
D

Dzoksi

Guest
Same size or one is larger than the other?
I making dragable puzzle, having 8 object that need to drop on one larger (equal surface as all 8), but at the end of "puzzling" when I have just one object left to drop and I drop it partly over another (one of the 8), it also detects collision with that one larger.So I want that collision with large object detect only if whole surface of it is "covered".
I'm sorry if my answer is confused :)
 
D

Dzoksi

Guest
Look up rectangle_in_rectangle() in the manual.
Thank you, I resolved with "if" and "with". But now, I have another question ( sorry :) ). When I drop one of those 8 objects on one of other 7, sometimes, it returns object that I drop, on start position ( it should be that way), but sometimes it returns object that is under, object which is below. It's like there are objects with "authority", and why is that? Code for every of 8 object is same, difference is just in the shape of sprite.

Edit: I have one controll object, parent of other 8. As I see, "authority" is guided by hierarchy of child objects. The first one has bigger "authority". How to neutral that?
 
Last edited by a moderator:
D

Dzoksi

Guest
"Edit: I have one controll object, parent of other 8. As I see, "authority" is guided by hierarchy of child objects. The first one has bigger "authority". How to neutral that?"

Ok, actually it is depends of resource tree order. Is there any way to set order equal for every object? Or some other way?
 

TheouAegis

Member
Nope. What is the code for handling returning an object to the starting point?

I would make sure the object that gets returned to the starting position is the one that is selected. That might mean you need to check if there is a contradiction before deselecting the object.
 
D

Dzoksi

Guest
Nope. What is the code for handling returning an object to the starting point?

I would make sure the object that gets returned to the starting position is the one that is selected. That might mean you need to check if there is a contradiction before deselecting the object.
Collision Event with object obj_random(parent object):
if left mouse button is not pressed
if at position (x,y) there is object obj_random
jump to position (xstart,ystart)

For testing, I made two objects with same code (without parent, just those two objects) and still the same. If I change their order in resource tree, than the other object have priorithy. Can I set object_index, so when some object is picked up, others have minor priorithy? If you understand what I want to say, I'm bit confusing :)
 

TheouAegis

Member
Do you see how you only checked for if the mouse was no longer pressed? You need to also check to make sure that the object is selected. Just as you check the piece was selected before moving it, you need to check if it's selected before returning it to the start position.
 
Top