Follow path behavior

Discussion and feedback on Construct 2

Post » Fri Dec 23, 2011 11:22 am

Ok... R0J0hound wins and laughs at clunky puny attempt. Good work.
B
12
S
2
G
5
Posts: 20
Reputation: 4,032

Post » Fri Dec 23, 2011 1:35 pm

R0J0hound... O_o
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Jan 27, 2012 3:42 pm

Wow that really nice R0J0hound!!

Sorry for my dumb question, but how did you do it that the two instance variables "rate" and "offset" are created with the value <varies>?
I wanted to try your formula in my project but I have to give the instance variables a value, and then it doesnt work. :)

Thx!
B
6
S
1
G
2
Posts: 17
Reputation: 1,341

Post » Mon Jan 30, 2012 4:25 am

The value <varies> basically just informs you that all the instances of that object don't have the same value. As a default when adding the variables you can set "rate" to 1 and "offset" to 0.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Mon Jan 30, 2012 4:24 pm

Thanks for your fast reply!
I'll give it a try, and if my game ever comes to life I will give you credit of course. :)
B
6
S
1
G
2
Posts: 17
Reputation: 1,341

Post » Mon Jan 30, 2012 8:23 pm

The sprites seem to spend a constant time between points. This means they speed up dramatically if the points a far apart and slow right down if the the points are close. Any way of altering the spline formula to account for this and get a constant speed?
B
12
S
2
G
5
Posts: 20
Reputation: 4,032

Post » Mon Jan 30, 2012 11:48 pm

The simplest way I have found is to decompose the spline path into a polyline and move along that line.

Here I made it calculate the polyline as needed.
http://dl.dropbox.com/u/5426011/examples%209/catmullrom_constant_speed.capx

Note: It only works with positive speeds atm.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Tue Jan 31, 2012 8:32 pm

That's definitely constant. Great work - but... question... you've got a blank sub-event, is that needed? and I can't work out why the arrows are jerky. FPS seems fine.
B
12
S
2
G
5
Posts: 20
Reputation: 4,032

Post » Tue Jan 31, 2012 8:57 pm

The blank event is just an artifact of converting my first example you can safely move the actions to the event above.

I was noticing the jerky motion as well and found that if you remove "stop loop" from event 6 they move much smoother.

It also goes smoother if you add a smaller value to "t" in event 5, of course you will have to increase the number in the "repeat" condition since the Sprite will be moving over more line segments.R0J0hound2012-01-31 21:02:45
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Mon Feb 13, 2012 5:55 pm

Oh my god... this is serious o_O

Great work man.
B
203
S
37
G
13
Posts: 136
Reputation: 29,523

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: NetOne, Zonacas and 4 guests