Create a path within which move something

Hello guys

I hope you can help me about this problem.

I have an object that can be dragged. My goal is to make it move inside my path if the player drag the object above the limit of the path he loose.

My problem is how to create the path.

I ve uploaded the image of the path I would like to create.

http://imgur.com/9q2sbvC

I hope someone can help me.

Is anyone able to answer this question?

  1. Make the object draggable (see the DragMe sample that comes with Corona SDK)

  2. Add an enterFrame handler and inside it, check if the object is outside the path

Yes I know how to do move the object… the problem is to create the path itself.

You can just create some rectangles. 3 rectangles, in your example above. The rectangles can be visible, or not, depending on what you want to show to the user. Then in an enterFrame handler, check if the object being moved is inside one of the rectangles. You can check that simply by looking at the x/y position of the object and the x/y position and size of the rectangles.

Is anyone able to answer this question?

  1. Make the object draggable (see the DragMe sample that comes with Corona SDK)

  2. Add an enterFrame handler and inside it, check if the object is outside the path

Yes I know how to do move the object… the problem is to create the path itself.

You can just create some rectangles. 3 rectangles, in your example above. The rectangles can be visible, or not, depending on what you want to show to the user. Then in an enterFrame handler, check if the object being moved is inside one of the rectangles. You can check that simply by looking at the x/y position of the object and the x/y position and size of the rectangles.