SpritePhysicsMass

Family: Sprite · 2 forms

What it does

SpritePhysicsMass takes iSpriteIndex (an integer), and answers a float. That is the first of 2 forms. iSpriteIndex is the id of a Sprite object, the one CreateSprite returned: it is how the call knows what to act on.

Syntax

1
SpritePhysicsMass(iSpriteIndex integer) → float
2
SpritePhysicsMass(iSpriteIndex integer, mass float)

Parameters

NameTypeIn forms
iSpriteIndexintegerall
massfloat2

What each form returns

1SpritePhysicsMass(sprite)float
2SpritePhysicsMass(sprite, 1.0)nothing

Example · generated

Form 1, the command hands back the id

image = LoadImage("assets/sprite.png", 1)sprite = CreateSprite(image)DO  Print(SpritePhysicsMass(sprite))  Sync()LOOP

Form 2, you choose the id yourself

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

LoadImage and CreateSprite are there to give the call something to act on; SpritePhysicsMass 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