How do I drag an object along a path?

Get help using Construct 2

Post » Mon Dec 15, 2014 8:29 pm

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
B
6
S
2
Posts: 33
Reputation: 512

Post » Mon Dec 15, 2014 11:57 pm

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.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Tue Dec 16, 2014 12:02 am

OK...that sound pretty ominous... but thank you!
RonM
B
6
S
2
Posts: 33
Reputation: 512

Post » Tue Dec 16, 2014 12:05 am

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
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Tue Dec 16, 2014 12:11 am

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.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Dec 18, 2014 6:13 pm

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.
B
6
S
2
Posts: 33
Reputation: 512

Post » Thu Dec 18, 2014 6:58 pm

,,,,,,,,,,,,
You do not have the required permissions to view the files attached to this post.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072


Return to How do I....?

Who is online

Users browsing this forum: Coren8r, dop2000, Yahoo [Bot] and 9 guests