SpriteHitTest

Family: Sprite · One form

What it does

SpriteHitTest takes spriteID (an integer), x (a float) and y (a float), and answers an integer. spriteID is the id of a Sprite object, the one CreateSprite returned: it is how the call knows what to act on.

Syntax

SpriteHitTest(spriteID integer, x float, y float) → integer

Parameters

NameType
spriteIDinteger
xfloat
yfloat

Every form returns

integer

Example · generated

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

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