Smooth movement following path ?

Get help using Construct 2

Post » Tue Feb 09, 2016 7:26 pm

Hi.
I'd like to design some simple but custom enemies move patterns in a shoot'em up.
I first thought about using custom movements with math formulas which don't really belong to my brain, or mixing different behaviors like bullet/sine, but it doesn't really fit my needs.

The idea would be to create X points which will be smoothly followed by an enemy (curved paths and so on).
On the last point reached, two options I could choose (with a variable for example). The enemy continues in the same direction it has when it reaches the last point, or it enters in a loop and cycle through all the points continuously.

This kind of plugin behavior-splinepath_t67833 (I also saw a similar behavior by r0j0hound, without a custom behavior) is a very good start on the paper, but there are two issues:
I can't decide how fast the sprite will "turn"
The sprites has to spend the same time between two points regardless how far they are from each other. I need my enemies to have a constant speed.

Any idea how to do this ? I'm quite sure this is not very complicated, but far beyond my math skills (which are actually absents).
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Tue Feb 09, 2016 9:26 pm

A path through paths is going to require some kind of math.

That spline path behavior and that example you mentioned both satisfy your second requirement to spend the same time between any two points.

To control the shape in between the points you could use a different spline such as bezier. You can use the qarp() or cubic() expressions to hide most of the math, although you'll still need some math to keep the paths continuous form one pair of points to another.

https://dl.dropboxusercontent.com/u/542 ... _path.capx
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Fri Jan 20, 2017 1:20 am

@R0J0hound - is there a way to make the middle 2 points not have handles to adjust their angle? I think it would just be a regular bezier curve instead of a cubic one for the middle 2?
B
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » Fri Jan 20, 2017 9:56 pm

@justifun
You could just calculate the control points automatically.

Here's an example of an expirement with that
https://www.dropbox.com/s/gzu9sb0xd9y1s ... .capx?dl=0
Last edited by R0J0hound on Fri Mar 24, 2017 7:42 pm, edited 1 time in total.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Thu Mar 23, 2017 5:46 pm

R0J0hound wrote:@justifun
You could just calculate the control points automatically.

Here's an example of an expirement with that
https://dl.dropboxusercontent.com/u/542 ... urved.capx


Could you please share the file again?
B
18
S
4
Posts: 52
Reputation: 1,096

Post » Fri Mar 24, 2017 7:43 pm

link fixed
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Fri Mar 24, 2017 10:49 pm

R0J0hound wrote:link fixed

thanks
B
18
S
4
Posts: 52
Reputation: 1,096


Return to How do I....?

Who is online

Users browsing this forum: rayolf and 17 guests