Bezier Implementation

RedEvo

  • Posts: 325
Hi,
reading OpelFL documents I've found an implementation of Bezier using path.
This feature permit to move an object from point A to point C pass through point B using a smooth curve.

I've trying an implementation in Actor using tween features and tested it without collision and seems has no issue.
It's pretty and can be implemented in a future Stencyl version.

My implementation:
Code: [Select]
public function bezierTo(x:Float, y:Float, checkPointX:Float,checkPointY:Float,strength:Float,duration:Float = 1, easing:Dynamic = null) {
tweenLoc.x = getX(false);
tweenLoc.y = getY(false);

if(easing == null)
{
easing = Linear.easeNone;
}

activePositionTweens++;
var path = new MotionPath().bezier(x, y, checkPointX, checkPointY ,strength);
Actuate.motionPath(tweenLoc, duration, { x:path.x, y:path.y }, false ).ease(easing).onComplete(onTweenPositionComplete);
}
Actuate.motionPath use tween inside. This make me confidend about Actor features used in this implementation, like in Actor.moveTo method.

Let me know if you import this feature in Stencyl, so I didn't modify Actor class code to any Stencyl update.
Thanks, David.
Launching RedemptionTCG Android Alpha. If you are interested contact us at info@redevogames.com

yoplalala

  • *
  • Posts: 1530
Cool ! I'll try this one of these days.

1MrPaul1

  • *
  • Posts: 1268
great! it got to be implemented