I am creating an application that should work like this: there sprites with drag drop behavior. And the screen there sprties the square, where to place the sprites with drag drop, when put in the right sprite wanted to lock them with drag drop on the screen
on drop
if sprite1 overlaps sprite2
sprite1 set position to spirte2
sprite1 set drag&drop disabled
I need the lock happens when a sprite is on top of another
Develop games in your browser. Powerful, performant & highly capable.
so just use the condition: isOverlapping
or you can check the distance between them
if distance(sprite1.x,sprite1.y,spirte2.x,spirte2.y) < 20