Constructor

@:value({ Gravity : 0, Friction : 0.95, Tension : 0.1, RetainVelocity : false })new(Sprite:FlxExtendedSprite, RetainVelocity:Bool = false, Tension:Float = 0.1, Friction:Float = 0.95, Gravity:Float = 0)

Adds a spring between the mouse and a FlxExtendedSprite.

Parameters:

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!)

Variables

friction:Float

The friction applied to the spring as it moves

gravity:Float

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

tension:Float

The tension of the spring, smaller numbers create springs closer to the mouse pointer

Methods

reset():Void

Resets the internal spring physics

update(elapsed:Float):Void

Updates the spring physics and repositions the sprite