← Documentation Home

BodyVelocityX

Category: 2D Game Physics (Pro)

Back to System Functions


Signature

BodyVelocityX(body As Integer)

Returns

Double

Description

Returns the body's horizontal velocity in pixels per second.

Performance and behavior

Invalid handles return 0.

Pro feature: compiling code that uses this function requires a license with the GamePhysics feature enabled.

Example

If KeyDown(KEY_RIGHT) Then SetBodyVelocity player, 220, BodyVelocityY(player)