how do i get somthing to follow a line

Get help using Construct 2

Post » Thu Dec 08, 2011 9:10 am

like a tower defence game how do i get it to stay on the tracks im not very good with the sline thing
B
3
S
1
G
1
Posts: 23
Reputation: 857

Post » Fri Dec 09, 2011 1:10 pm

Can you give us some details? The more the better. Best would be to upload your example and describe exactly how you want it to behave.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Fri Dec 09, 2011 1:57 pm

What you want is a spline path generation and follow on spline path algorithm. A recommended spline type is the Catmul-Rom Spline (hermite type). Though i don't have the slightest idea how to implement it in construct :( . If C2 had support on editor of path creation it would be quite easy. One more thing to todo-list i fear
B
58
S
13
G
10
Posts: 632
Reputation: 12,515

Post » Fri Dec 09, 2011 3:41 pm

nah! there's a simple way, just use waypoints
unless you want to make some funky curvy path you will probably just have straight paths and turns.

So you just have to now when and where to turn.
You place some sprites with an instance variable called direction
Sprite.direction equal either 0,90,180 or -90

you probably have an entry point for your ennemies and a starting direction, you make them move in this direction and when they overlap the sprite you just change the angle of movement to the angle of Sprite.direction.Yann2011-12-09 15:43:07
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Dec 09, 2011 4:04 pm

Yeah for simple paths waypoints is sufficient. It'll depend on the level of complexity that @jos101 wants. Most types of tower defence games follow rectangular paths so way points would be enough. But for it wouldn't work for a autorama type racing game for example.
B
58
S
13
G
10
Posts: 632
Reputation: 12,515


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests