[↑]
SmileBASIC4 Replica Reference
SPHITRC
1. Return collision detection result of moving rectangle and all sprites

SPHITRC(StartPointX,StartPointY,Width,Height[,[Mask],MovementAmountX,MovementAmountY])

・Call SPCOL in advance.

Arguments

StartPointX,Y

Upper left coordinate of the rectangle to be detected

Width,Height

Width and height of the source rectangle

Mask

0 to &HFFFFFFFF(32bit)

・When the collision is detected, compare each other's bit of AND and if it is 0, it is regarded as not colliding.
・If not specifiied, it's &HFFFFFFFF.

MovementAmountX,Y

Movement amount of the rectangle of the detecting source

Return Value

Collision sprite number (-1 if no collision)

Example

H=SPHITRC(0,0,16,16)
2. Return collision detection result of specified sprite and rectangle

SPHITRC(SpriteNumber,StartPointX,StartPointY,Width,Height[,[Mask],MovementAmountX,MovementAmountY])

・Call SPCOL in advance.

Arguments

SpriteNumber

Collision opponent sprite number: 0 to 4095

StartPointX,StartPointY

Upper left coordinate of the rectangle to be detected

Width,Height

Width and height of the source rectangle

Mask

0 to &HFFFFFFFF(32bit)

・When the collision is detected, compare each other's bit of AND and if it is 0, it is regarded as not colliding.
・If not specifiied, it's &HFFFFFFFF.

MovementAmountX,Y

Movement amount of the rectangle of the detecting source

Return Value

0=No Collision, 1=Collision

Example

H=SPHITRC(1,0,0,16,16)
3. Return the result of collision detection between a sprite in the specified range and a rectangle

SPHITRC(StartID,EndID,StartPointX,StartPointY,Width,Height[,[Mask],MovementAmountX,MovementAmountY])

・Call SPCOL in advance.

Arguments

StartID,EndID

Sprite range to detect (0 to 4095)

StartPointX,Y

Upper left coordinate of the rectangle to be detected

Width,Height

Width and height of the detecting rectangle

Mask

0 to &HFFFFFFFF(32bit)

・When the collision is detected, compare each other's bit of AND and if it is 0, it is regarded as not colliding.
・If not specifiied, it's &HFFFFFFFF.

MovementAmountX,Y

Movement amount of the rectangle of the detecting source

Return Value

Collision sprite number (-1 if no collision)

Example

H=SPHITRC(0,0,16,16)
4. Return the sprite collision detection result from the previously set information

SPHITRC()

・If there are multiple collision destinations in SPHITRC with arguments, you can retrieve all collision destinations by omitting the arguments and calling again.
・Call SPCOL in advance.

Return Value

Collision sprite number (-1 if no collision)

Example

H=SPHITRC(0,0,16,16)
WHILE (H >= 0)
 H=SPHITRC()
WEND
About this site
Our site is an unofficial manual site of programming software "SmileBASIC" for NintendoSwitch™.
I acquire the content of the site from the official reference site of the SmileBoom Co.Ltd. that is the development and sales cause of the software in real time (a minimum period of 24 hours update) and display it. For automatic update, contents may become improper.
Please confirm the correct content in an official site.

June 3, 2020
by mim
OK
|