# How do I create a descending radius of action ?

Get help using Construct 2

### » Mon Jun 09, 2014 9:20 pm

Hello,

I am working on a Flight Control-like system where a planewould follow a line that has just been drawn

Plane.png

I wonder if it is possible to make this circle shrinking as the plane is moving forward ? And the circle would be equal to 0 when the plane has reached the end of the line.

Is it possible to do this with construct 2 ? How would you do this ?

regards and thanks for your help
Mogador
You do not have the required permissions to view the files attached to this post.
B
6
S
2
Posts: 34
Reputation: 579

### » Sat Jun 14, 2014 9:56 pm

Does anyone has an advice to give ?
B
6
S
2
Posts: 34
Reputation: 579

### » Sat Jun 14, 2014 11:58 pm

Yes, You would have to find the distance of the line drawn by the player and the distance traveled by the player, from the start of the line

Then you'd do;
CircleMaxSize - CircleMaxSize * (PlaneDistanceTravelled/SizeofLine)
B
43
S
18
G
17
Posts: 2,247
Reputation: 17,556

### » Sun Jun 15, 2014 3:32 am

Whiteclaws has the answer, though I like to use lerp to simplify the code. Same thing as Whiteclaws' answer, in a different format. Set the circle size to:
Code: Select all
`lerp(CircleMaxSize, 0, PlaneDistanceTraveled/SizeOfLine)`

Basically we are saying, start circle out at CircleMaxSize, end circle at 0, as PlaneDistanceTraveled/SizeOfLine goes from 0 to 1.
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

### » Sun Jul 06, 2014 10:23 pm

Thanks,

I understand it, but how do I get the distance of the line drawn by the player ?
I don't get it as it is a curve

Mogador
B
6
S
2
Posts: 34
Reputation: 579

### » Sun Jul 06, 2014 11:47 pm

you can get an approximate distance by picking all dashes associated with that plane (Dash Plane = Spitfire.UID) and multiplying the picked count by 20

the distance would then be Dash.PickedCount*20
B
6
S
2
Posts: 79
Reputation: 608

### » Mon Jul 07, 2014 2:19 pm

It works fine, thank you
B
6
S
2
Posts: 34
Reputation: 579

Return to How do I....?

### Who is online

Users browsing this forum: No registered users and 21 guests