class flixel.addons.display.FlxMouseSpring

Available on all platforms

Instance Fields

var friction:Float

The friction applied to the spring as it moves * @default 0.95

var gravity:Float

The gravity controls how far "down" the spring hangs (use a negative value for it to hang up!) * @default 0

var tension:Float

The tension of the spring, smaller numbers create springs closer to the mouse pointer * @default 0.1

function new(Sprite:FlxExtendedSprite, ?RetainVelocity:Bool = false, ?Tension:Float = 0.1f, ?Friction:Float = 0.95f, ?Gravity:Float = 0):Void

Adds a spring between the mouse and a FlxExtendedSprite. * *

Sprite

The FlxExtendedSprite 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 gravity controls how far "down" the spring hangs (use a negative value for it to hang up!)

function reset():Void

Resets the internal spring physics

function update():Void

Updates the spring physics and repositions the sprite