xamarincocossharp

CocosSharp move sprite over an arc


I'm working on a game in Xamarin. I have a plane that I want to fly from one side of an arc to the other while rotating the plane so the plane stays parallel to the arc.

Any suggestions?

enter image description here

Update

I was able to get this to work using a combination of CCBezierTo and CCRotateTo.


Solution

  • As I mentioned in my update I was able to accomplish this by using a combination of CCBezier and CCRotateTo.

            var duration = 5.0f;
            mysprite.RunActionAsync(new CCBezierTo(duration, new CCBezierConfig()
            {
                ControlPoint1 = new CCPoint(180, 200),
                ControlPoint2 = new CCPoint(650, 600),
                EndPosition = new CCPoint(1130, 200)
            }));
    
            mysprite.RunActionAsync(new CCRotateTo(duration, 90));
    

    The ControlPoint2 is the top of the arc.