Click or drag to resize
SpriteBaseAccelerateByInputs Method
Accelerate this sprite according to which directional inputs are on/pressed.

Namespace: (Default Namespace)
Assembly: Default (in Default.exe) Version: 1.0.0.0
Syntax
C#
public virtual void AccelerateByInputs(
	int Acceleration,
	int Max,
	bool HorizontalOnly
)

Parameters

Acceleration
Type: SystemInt32
Specifies how much effect any input can have on acceleration in tenths of a pixel per frame per frame
Max
Type: SystemInt32
Specifies the maximum speed to which the sprite can accelerate along any particular axis in pixels per frame
HorizontalOnly
Type: SystemBoolean
If this is true, only horizontal acceleration will be applied. (Often times in platform games, a sprite can move horizontally, but in order to move vertically, must jump.)
Remarks
If the sprite's LocalDX or LocalDY properties are set (if the sprite is riding another sprite) this will affect the local velocity and affect dx and/or dy only indirectly.
Examples
The following example would accelerate a sprite horizontally at 1 pixel per frame per frame up to a maximum of 5 pixels per frame.
AccelerateByInputs(10, 5, true)
See Also