playMaker

Author Topic: Drag sprite with mouse/touch along a curved (iTween?) path  (Read 2777 times)

joel.carlson

  • Junior Playmaker
  • **
  • Posts: 63
    • Salvation's Story
Drag sprite with mouse/touch along a curved (iTween?) path
« 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
Check out Noah's Elephant in the Room, Bible ABCs for Kids, Bible Coloring for Kids, and Noah's Bunny Problem at
Salvations Story

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15501
  • Official Playmaker Support
Re: Drag sprite with mouse/touch along a curved (iTween?) path
« Reply #1 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

joel.carlson

  • Junior Playmaker
  • **
  • Posts: 63
    • Salvation's Story
Re: Drag sprite with mouse/touch along a curved (iTween?) path
« Reply #2 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

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.
Check out Noah's Elephant in the Room, Bible ABCs for Kids, Bible Coloring for Kids, and Noah's Bunny Problem at
Salvations Story

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15501
  • Official Playmaker Support
Re: Drag sprite with mouse/touch along a curved (iTween?) path
« Reply #3 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


joel.carlson

  • Junior Playmaker
  • **
  • Posts: 63
    • Salvation's Story
Re: Drag sprite with mouse/touch along a curved (iTween?) path
« Reply #4 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
Check out Noah's Elephant in the Room, Bible ABCs for Kids, Bible Coloring for Kids, and Noah's Bunny Problem at
Salvations Story