How do I create a descending radius of action ?

0 favourites
  • 7 posts
From the Asset Store
Background Story generation templates. See the Arcade demo.
  • Hello,

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

    [attachment=1:ujwf5ltq][/attachment:ujwf5ltq]

    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

  • Does anyone has an advice to give ?

  • 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)

  • 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:

    lerp(CircleMaxSize, 0, PlaneDistanceTraveled/SizeOfLine)[/code:2et1ixuy]
    
    Basically we are saying, start circle out at CircleMaxSize, end circle at 0, as PlaneDistanceTraveled/SizeOfLine goes from 0 to 1.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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

  • It works fine, thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)