alamboley/Citrus-Engine — pull request #42 by osro (2013-02-15 14:20:00+00:00)
Title: Path / Improvements for Nape's MovingPlatform

I added a Path class which is a set of points (MathVector) that can be used (example) with the MovingPlatform.

Demo :
https://dl.dropbox.com/u/1641946/CitrusEngine/index.html

Upper left platform
- Path's isPolygon = false // Platform follow the path to the end and then returns along the same way back.

Middle platform
- Path's isPolygon = true // follows the Path in a circle

Right platform
- does not have a Path to follow. It just uses "old" start and ending points and moves between them.

I'm not sure is the citrus.objects.common package suitable for the Path.
But yeah :D Feel free to change if you like.

And here is how I initialized the state for them.
```actionscript
override public function initialize():void
{
super.initialize();
var nape:Nape = new Nape("nape");
nape.visible = true;
add(nape);

var platform:Platform = new Platform("platform", { width: 640, height: 20, x: 320, y: 470 });
add(platform);

var testPath:Path = new Path("test");
testPath.add(200, 200);
testPath.add(200, 400);
testPath.add(400, 400);
testPath.add(400, 200);
testPath.isPolygon = true;

var movingPlatform:MovingPlatform = new MovingPlatform("test", { width: 200, height: 20, x: 320, y: 240, startX: 100, startY: 200, endX: 540, endY: 450, speed: 20, waitForPassangers: true, path: testPath });
add(movingPlatform);

var anotherPath:Path = new Path("test2");
anotherPath.add(0, 0);
anotherPath.add(100, 200);
anotherPath.add(200, 0);
anotherPath.isPolygon = false;

var anotherPlatform:MovingPlatform = new MovingPlatform("test2", { width: 100, height: 20, path: anotherPath, speed: 80 });
add(anotherPlatform);

var thirdPlatform:MovingPlatform = new MovingPlatform("test3", { width: 100, height: 20, x:500, y:20, startX: 500, startY: 10, endX: 500, endY: 400, speed: 200 });
add(thirdPlatform);

var crate:Crate = new Crate("testcrate", { width: 20, height: 20, x: 500, y: 0 });
add(crate);

var crate2:Crate = new Crate("testcrate2", { width: 20, height: 20, x: 360, y: 0 });
add(crate2);

var hero:Hero = new Hero("hero", { x: 320, y: 20, width: 45, height: 75 });
add(hero);
}
```