class flixel.addons.nape.FlxNapeVelocity
Available on all platforms
Some of the FlxVelocity functions, working with nape.
Class Fields
static function moveTowardsMouse(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. *
Source | The FlxNapeSprite to move * |
Speed | The speed it will move, in pixels per second (default is 100 pixels/sec) |
static function moveTowardsObject(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. *
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) |
static function moveTowardsPoint(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. *
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) |
static function moveTowardsTouch(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. *
Source | The FlxNapeSprite to move * |
Speed | The speed it will move, in pixels per second (default is 100 pixels/sec) |
static function stopVelocity(Source:FlxNapeSprite):Void
Stops a FlxNapeSprite from moving by setting its velocity to 0, 0. *
Source | The FlxNapeSprite to stop |