Drag sprite back to parent sprite

Hello Devs,

I’m trying (and failing) to create a Fly capture game.
visualise the concept

The player is always in the center of the screen. Mouse press (hold) will activate the capture (like a frog’s tongue).
If it collides with fly… drag it back to the mouth (black square). THIS IS WHERE I’M SUCK!!! I’d like the fly to move under the black square then delete.

I cannot figure out how to achieve his… I run into so many problems. I use STICK plugin to achieve the contact.

Thanks,
Rob

Can you post the events? It seems to be related to the point on the fly where it’s being dragged. To reach the center the point would have to be in the center of the fly object. There seems to be a lag like it’s being dragged by a rope. If you stop pulling the rope, it will never reach the center.

You can snap the drag point to the center of the fly object or continue to move the fly toward the center through a secondary action like a tween. Sort of like dragging it into a blackhole. Either through distance or collision or just automatically when the first action is done.

When you stick the object to the beam it being dragged behind the beam. The beam collides with the other object and gets deleted before the object being dragged reaches the target location.

You could continue to move the object if it’s a certain distance away as a sub event that deletes the beam or you could delete all of the objects that are stuck to the beam before deleting the beam.

Something like

I was surprised it didn’t need a for each object for the fly. But it worked for me.

If you wanted to you could tween it the rest of the way or instead of deleting the object, you could change the animation or scale or opacity so it didn’t just vanish. You could then delete it after the animation ended or check the box in the tween that deletes (destroys) the object when the tween has ended.

This would be a tween position, you can adjust the time. Make sure the destroy when done is checked. You might need to use a for each object if all of the object don’t move. But I don’t think so.

Thanks @Keith_1357 for all your help.

1 Like