Constructor
new(sprite:FlxSprite, retainVelocity:Bool = false, tension:Float = 0.1, friction:Float = 0.95, gravity:Float = 0.0, ?offset:FlxPoint)
Adds a spring between the mouse and a FlxSprite
Parameters:
sprite | The FlxSprite to which this spring is attached |
---|---|
retainVelocity | True to retain the velocity of the spring when the mouse is released, or false to clear it |
tension | The tension of the spring, smaller numbers create springs closer to the mouse pointer |
friction | The friction applied to the spring as it moves |
gravity | The constant downward force on the sprite (A negative value pulls up!) |
offset | The anchor point of the sprite, relative to its position, If null, the sprite's origin is used. Note: A copy of the passed in point is used. |
Variables
offset:FlxPoint
The anchor point of the sprite, relative to its position, If null, the sprite's origin is used
retainVelocity:Bool
Whether to retain the velocity of the spring when the mouse is released. If false, it's cleared on release