Excalibur
Excalibur copied to clipboard
Add pathing action(s) to Actors
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.
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
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 });
This issue hasn't had any recent activity lately and is being marked as stale automatically.
Closing recommending implementing this with coroutines