Reset object position if drop object in wrong position

Hi everyone,

I’m building drag and drop objects game. When you drag then drop object A to object B, object A will place above object B, if you drop object A somewhere else on the screen, object A will return to its position. However, I can’t do that.

Could someone please helo me.

Your B.X() + 10 and B.Y() + 10 is one specific pixel/position. Chances of hitting that are remote. Instead, you want to test if B has the mouse over it.

try to use the event:
CONDITIONS: The cursor/tap is on an object (object B); the mouse button released (example left); Object A collision with Object B; trigger once.
ACTION: Place Object A on the position you want.
And another (the case that Object A doesn’t collision with Object B) event…
CONDITION: the mouse button released (example left); Object A is not collision with Object B (do this condition like an INVERSE condition); trigger once.
ACTION: Place Objet A on position X,Y (the start place).

Thanks for your advice. @MrMen and @Points. I’ve fought the solutions now. I’m following @MrMen instruction to improve the code (Compare ClickedImageName). Thank you two a lot.