Excalibur icon indicating copy to clipboard operation
Excalibur copied to clipboard

Add pathing action(s) to Actors

Open kamranayub opened this issue 10 years ago • 3 comments

We did basic moveTo/rotateTo actions for LD29 to create basic pathing for Actors, but we should flesh it out to allow passing in an array of points to move on.

It should probably just be an action itself so you can chain them or splice in other actions during path movement.

kamranayub avatar Apr 29 '14 17:04 kamranayub

I'm picturing something like this:

var points: ex.Point[] = [...]; // some list of points
var pathConfiguration = new ex.PathConfiguration(); // default path configuration if nothing changed
pathConfiguration.speed = 20;// Specifiy path speed in pixels/sec
pathConfiguration.rotateToNextSegment = true;
pathConfiguration.angularSpeed = Math.PI/5;// Specify angular velocity in radians/sec
pathConfiguration.loop = true; // Will join the end of the path to the beginning creating a loop

actor.followPath(points, pathConfiguration) // execute action

eonarheim avatar Apr 29 '14 17:04 eonarheim

Yes, that seems pretty easy to use. I should also be able to pass in no options and it should use some intelligent defaults.

We could also make it an interface. This compiles fine. However, you don't get intellisense or statement completion/parameters for properties.

interface IOptions {

    /**
     * Speed!
     */
    speed: number;
}

function something(options: IOptions) {
    // do something
}

something({ speed: 20, foo: true });

kamranayub avatar Apr 29 '14 18:04 kamranayub

This issue hasn't had any recent activity lately and is being marked as stale automatically.

github-actions[bot] avatar Jul 03 '21 00:07 github-actions[bot]

Closing recommending implementing this with coroutines

eonarheim avatar Apr 25 '24 14:04 eonarheim