Draknek/FlashPunk — pull request #80 by BlckKnght (2012-04-30 06:02:11+00:00)
Title: Motion tween update

This commit updates the Motion tween type to have an "object" property. Any object assigned to that property will have its x and y properties automatically updated by the Tween when it moves. The object may be of any type as long as it allows assignment to "x" and "y", so instances of the Entity, Graphics and Point classes are all valid.

The change should be perfectly backwards compatible, as you can still get the values directly from the Tween's x and y properties. Providing an object is optional, and the Motion tween will still run without it. All Motion sub-classes (including user made ones) should continue to work without any changes.

See this forum thread for the inspiration for this change. Really that post was just the straw the broke the camel's back, as the obnoxiousness of Motion tweens had been bothering me for quite a while.

Further opportunities for improvement:
- The object might be added as an optional parameter in the constructor or setMotion() method.
- The CircularMotion subclass might be able to assign its _angle property to certain kinds of target objects (Images and maybe Entities with an Image set as its graphic).