Parabolic movement between 2 points

1 favourites
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • [Sprite] Set Angle Toward (sprite.xend, sprite.yend)

    Hey thanks for the response,

    This isn't quite what I meant. This way would make the sprite constantly look at it's target.

    What I wanted it to do would be to face in the direction that it's moving, so if it's moving up, it would face up, and so on.

    One way I was thinking would be to just do it manually, since the timing is fixed.

    But if you wanted to alter the flight time, it would be nice to just have a formula that corrected the rotation automatically.

    I'm guessing it would require some calculation with the flight time variable in order to get accurate rotation. "Rotate at (math related to flight time)" or something.

  • > [Sprite] Set Angle Toward (sprite.xend, sprite.yend)

    This will end up with the sprite always pointing towards the initial touch point.

    Instead, add two instance variables to the sprite, xLast and yLast, and whilst the sprite is moving use

    [Sprite] Set angle to(self.xLast,self.yLast,self.X,self.Y)

    [Sprite] Set xLast to self.X

    [Sprite] Set yLast to self.Y

    Hey thanks for the response,

    I tried what you wrote, and it's giving me a syntax error with the first comma when setting the angle.

    It says: "Expression appears to end before here, are you missing something?"

  • Just realised I missed out a crucial "angle" in my reply - should work now! :-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [Sprite] Set angle to angle(self.xLast,self.yLast,self.X,self.Y)

  • mekonbekon That works perfectly!

    Thanks so much for the help!

    I think I even understand how it works, that's really cool!

  • You're welcome :-)

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