4

In my LigGdx based game, I wish to move my Sprite in an elliptical path to reach the destination. I do not find any support in Universal tween engine. Sample of route example is shown below.

enter image description here

Questions :

  1. Is there is any methods in UniversalTween Engine to have a elliptical path ?

  2. Also let me know what is waypoints in UniversalTween Engine ?

Thanks in Advance !

alizelzele
  • 892
  • 2
  • 19
  • 34
iappmaker
  • 2,945
  • 9
  • 35
  • 76
  • 2
    Why do you want to use universal tween engine for that? Have a look at: https://github.com/libgdx/libgdx/wiki/Path-interface-%26-Splines – Xoppa May 18 '15 at 16:53

2 Answers2

4

The Universal Tween Engine now supports curves - Default is CatmullRom which would definitely be able to provide the smooth movement you want.

It's a little tricky to get your head around at first but not that bad once you get used to it.

Universal Tween Engine

Details of update that added curves

Phil Anderson
  • 3,146
  • 13
  • 24
0

Well I have searched up this question for you and discovered you many people have already asked this question, and none of them got an answer, yet. So I will try to answer as best as I can. I believe that my method is not the best. But if your application is not time or performance sensitive, then this method may work.

Now this comes to a math problem. You know that the screen is make out of pixels and there is no point making it overly detailed because it isn't possible. So you can do this:

enter image description here

They grey line being your intended line, and the green line being your actual drawn line. If you move objects using the tween engine along the green path and switch path when hitting the red dots. You could mimic an elliptical movement. However, you need to use math and calculate your path. You could set the coordinates of your path as a constant for every screen size, or you could calculate it every time.

Overall, the more points you calculate, the more elliptical the movement will be.

Anyways if you look at this website, it teaches you how to tween. You can use Tween.to(...); to help you tween to the points.

Hope this helped you

Fish
  • 1,689
  • 1
  • 18
  • 28