Some of the FlxVelocity functions, working with nape.

Static methods

@:value({ Speed : 100 })staticinlinemoveTowardsMouse(Source:FlxNapeSprite, Speed:Float = 100):Void

Move the given FlxNapeSprite towards the mouse pointer coordinates at a steady velocity Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms. The source object doesn't stop moving automatically should it ever reach the destination coordinates.

Parameters:

Source

The FlxNapeSprite to move

Speed

The speed it will move, in pixels per second (default is 100 pixels/sec)

@:value({ Speed : 100 })staticinlinemoveTowardsObject(Source:FlxNapeSprite, Dest:FlxSprite, Speed:Float = 100):Void

Sets the source FlxNapeSprite x/y velocity so it will move directly towards the destination FlxSprite at the speed given (in pixels per second) Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms. The source object doesn't stop moving automatically should it ever reach the destination coordinates.

Parameters:

Source

The FlxNapeSprite on which the velocity will be set

Dest

The FlxSprite where the source object will move to

Speed

The speed it will move, in pixels per second (default is 100 pixels/sec)

@:value({ Speed : 100 })staticinlinemoveTowardsPoint(Source:FlxNapeSprite, Target:FlxPoint, Speed:Float = 100):Void

Sets the x/y velocity on the source FlxNapeSprite so it will move towards the target coordinates at the speed given (in pixels per second) Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms. The source object doesn't stop moving automatically should it ever reach the destination coordinates.

Parameters:

Source

The FlxNapeSprite to move

Target

The FlxPoint coordinates to move the source FlxSprite towards

Speed

The speed it will move, in pixels per second (default is 100 pixels/sec)

@:value({ Speed : 100 })staticinlinemoveTowardsTouch(Source:FlxNapeSprite, Touch:FlxTouch, Speed:Float = 100):Void

Move the given FlxNapeSprite towards a FlxTouch point at a steady velocity Timings are approximate due to the way Flash timers work, and irrespective of SWF frame rate. Allow for a variance of +- 50ms. The source object doesn't stop moving automatically should it ever reach the destination coordinates.

Parameters:

Source

The FlxNapeSprite to move

Touch

The FlxTouch where the source object will move to

Speed

The speed it will move, in pixels per second (default is 100 pixels/sec)

staticinlinestopVelocity(Source:FlxNapeSprite):Void

Stops a FlxNapeSprite from moving by setting its velocity to 0, 0.

Parameters:

Source

The FlxNapeSprite to stop