Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: joel.carlson on January 16, 2014, 04:24:46 PM

Title: Drag sprite with mouse/touch along a curved (iTween?) path
Post by: joel.carlson on January 16, 2014, 04:24:46 PM
I'm creating an ABCs game and this one has me scratching my head. I've gone through a ton of tutorials, but I'm just not grasping it. Here's what I'm hoping to do.

Say I'm using a capital 'A'.
-generate a little object for the player to move at the base of the 'A',
-push it along a constrained iTween path to the other side of the 'A' in an upsidedown v shape
-move to the second path
-drag the object across the second path to complete the 'A'.

I'm pretty sure I can handle everything but creating the mouse/touch action that drags the object along that path!

Thanks so much for your help! I've been scratching my head so much, I think I'm going bald in that spot! :P
Title: Re: Drag sprite with mouse/touch along a curved (iTween?) path
Post by: jeanfabre on January 24, 2014, 08:06:36 AM
Hi,

 I am not sure I understand, do you have a video showing this somewhere on another game or else?

bye,

 Jean
Title: Re: Drag sprite with mouse/touch along a curved (iTween?) path
Post by: joel.carlson on February 11, 2014, 06:30:36 PM
Hey there, Jean! Thanks so much for the response! I'm still trying to figure this problem out!

Here's an example. http://www.youtube.com/watch?v=ZYWiaNQ1o-w#t=25 (http://www.youtube.com/watch?v=ZYWiaNQ1o-w#t=25)

The object (airplane) appears, then the player can drag the object across the line. Once the object reaches the end of the line, it'll trigger another event.

I just can't figure out how to drag an object that's bound to a path.
Title: Re: Drag sprite with mouse/touch along a curved (iTween?) path
Post by: jeanfabre on February 12, 2014, 03:44:12 AM
Hi,

 If it's just a straight line, then that's ok-ish.

Unfortunatly, the forum search is down, so I can't link to posts on that topic, but basically, that would be the following:

 you use 3dplanedrag custom action to define your mouse point on a specific plane, and then express that point in your path transform. then you kill the x and y values, you are left with z with is the distance from the start.

 going this way will give you a linear constraint for positioning as well as a sense of distance from the start.

 To detect that an object reaches the end of the line, use a collider.

 NOW, another solution is to use physics joints. If you use physics 2d, you can even use the sliding joint and you are good to go! I would experiment with this first actually. 3d physics have configurable joints and they can do sliding constraints too.

bye,

 Jean

Title: Re: Drag sprite with mouse/touch along a curved (iTween?) path
Post by: joel.carlson on February 12, 2014, 11:45:01 AM
Hey there, Jean. Thanks for the reply! They'll be quite a few curves (such as when drawing 'o'), so I'll start looking into physics joints!

Thanks!
Joel