How do I drag an object along a path?

0 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • This is fairly straightforward but I don't see how to do it. I have a small graphic object that I want the user to be able to mouse drag along a linear path. There are several points on the path where I want another image or text to appear, then disappear. So...imagine I have an image of a dog, the user would mouse drag the dog along a linear path... when the dog is near a fire hydrant some text or an image appears, when the dog is near an image of a doghouse another image/text appears, etc. How can I do this?

    My dog image is set to drag/drop along both axis, yet I cannot move it at all, it is locked. How can I unlock it and create a linear path along with the dog can be moved?

    Thanks

    RonM

  • You will have to do a lot of math and use parametric equations to make the path and have the scroll factor to be the parameterizing factor.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • OK...that sound pretty ominous... but thank you!

    RonM

  • It is not too bad if you can find an easy equation online that looks like what you want.

    Just do an image Google search for "equation graphs", find one that looks kind of like what you want and figure out what it is called.

    Then search for "<equation name> parameterization"

    So long as you don't have to go into polar space, you should be able to do it easily enough.

    http://en.wikipedia.org/wiki/Parametric_equation

  • I was just playing around with this yesterday. C2 has no built in path tool, so you have to go at it with raw math.

    Here's what I have so far. I'll warn you, it's quite crude:

    https://www.dropbox.com/s/cv2gume289gl2 ... .capx?dl=0

    I'm sure I could smooth the paths out with a little more work; the main problem is that, with lots of paths, this would become a nightmare to make sense of in layout view. Add a few more paths and it starts to look like your level is sprouting warts.

    Thankfully, I don't need this in any of my current projects. I think I'll wait for a proper path plugin.

  • Thanks for these suggestions, however this looks like extensive programming for a minor result. What I want is a thermometer where the user drags the temperature up or down a straight line and sees the resulting effect of heat or cold. Just a straight line, I don't need any curves.

  • ,,,,,,,,,,,,

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)