Stick a sprite to another sprite

Hi,

I have read posts here were there have been issues with sticking objects/sprites together.

On applying the various solutions I cannot get one sprite to stick to the other.

This may be because I have two behaviors against the sprite that I want to attach to another, once is the stick behaviour and the other is the drag and drop.

The idea is if this sprite is dragged and dropped over the other as long as a condition is met (E.g. they are both the same colour for example) then they would stick.

Please would a full example of how to use this behaviour be provided ?

Thanks

TimCS

Have you followed these instructions?

And taken note of this one?

Thanks MrMen - the sticker logic is different here as I want the objects only to stick together when they overlap and I have used the sticker behaviour but where I cannot get it to work is when I use the drag drop behaviour and then when the object is dragged and released over the other - as long as they match in some way e.g. colour (like the two are red) they will stick together

Can you screen snip the events that deal with the drag & drop, colour checking and sticking of objects?

You know I think I have gotten around this instead of using stick - when the two objects collide - I set the dragging object to match the x and y of the other object and disable the dragging behaviour instead

If that works for you. However, the sticker extension is a lot simpler - you won’t have to manually keep track of what you’re stuck to and updating it all the time. The sticker extension requires one action, and no monitoring of position.

I think I was using the stick behav for the thought that once the object overlapped another it would stick to it would be overkill as I can set the image to match the size and position of the other image and then disable the drag behav - I think the issue has been that while the drag behav is active it seems to override the stick behav stopping it from “sticking” to the object