SpritePhysicsImpulse

Family: Sprite · One form

What it does

SpritePhysicsImpulse sets PhysicsImpulse on a Sprite object. It takes iSpriteIndex (an integer), x (a float), y (a float), vx (a float) and vy (a float), and returns nothing. iSpriteIndex is the id of a Sprite object, the one CreateSprite returned: it is how the call knows what to act on.

Syntax

SpritePhysicsImpulse(iSpriteIndex integer, x float, y float, vx float, vy float)

Parameters

NameType
iSpriteIndexinteger
xfloat
yfloat
vxfloat
vyfloat

Every form returns

nothing

Example · generated

image = LoadImage("assets/sprite.png", 1)sprite = CreateSprite(image)SpritePhysicsImpulse(sprite, 100.0, 120.0, 1.0, 1.0)DO  Sync()LOOP

LoadImage and CreateSprite are there to give the call something to act on; SpritePhysicsImpulse is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

135 commands in Sprite