Click or drag to resize
SpriteBaseLimitVelocity Method
If the velocity of the sprite is more than the specified maximum, normalize it so that it's going the same direction, but at no more that the specified maximum speed.

Namespace: (Default Namespace)
Assembly: Default (in Default.exe) Version: 1.0.0.0
Syntax
C#
public virtual void LimitVelocity(
	int Maximum
)

Parameters

Maximum
Type: SystemInt32
Specifies the maximum speed in pixels per frame
Remarks

The speed of the sprite is calculated with the distance formula, so a sprite moving 3 pixels horizontally and 4 pixels vertically, for example, is considered to be moving 5 pixels.

If the sprite is riding a platform, the maximum velocity is applied relative to the platform. For example, if the platform is moving rightward at 3 pixels per frame, and the sprite is moving rightward at 5 pixels per frame relative to the platform (8 pixels per frame in absolute terms), and the maximum is set to 4 pixels per frame, the sprite's LocalDX will be reduced to 4 rather than to 1

.
See Also