[↑]
SmileBASIC4 Replica Reference
SPCOL
1. Set sprite collision detection attribute

SPCOL SpriteNumber[,ScaleSupport]

・Be sure to call before using SPHIT command.
・Error when used before SPSET.
・If start point X and start point Y are not specified in SPCOL, then the information of SPHOME is used as start point X and start point Y. Even if SPHOME is changed afterwards, start point X and start point Y are not followed.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

ScaleSupport

When 1 is specified, the size of the collision detection changes according to the scale change in SPSCALE or SPANIM.

If 0 is specified, the size of collision detection will not change even if the scale is changed.

・0, if not specified.

Example

SPCOL 3,1
2. Set sprite collision detection attribute (with mask specification)

SPCOL SpriteNumber,[ScaleSupport],Mask

・Be sure to call before using SPHIT command.
・Error when used before SPSET.
・If start point X and start point Y are not specified in SPCOL, then the information of SPHOME is used as start point X and start point Y. Even if SPHOME is changed afterwards, start point X and start point Y are not followed.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

ScaleSupport

When 1 is specified, the size of the collision detection changes according to the scale change in SPSCALE or SPANIM.

If 0 is specified, the size of collision detection will not change even if the scale is changed.

・0, if not specified.

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.

Example

SPCOL 3,1,31
SPCOL 3,,31
3. Set sprite collision detection attribute (with range specification)

SPCOL SpriteNumber,StartPointX,StartPointY,Width,Height[,ScaleSupport]
SPCOL SpriteNumber,StartPointX,StartPointY,Width,Height,[ScaleSupport],Mask

・Be sure to call before using SPHIT commands.
・Error when used before SPSET.
・When the starting point X and Y are specified in SPCOL, the information of SPHOME is not used at all.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

StartPointX,Y

・Start point coordinates of detection area: X, Y (-32768 to 32767).
・Relative coordinates with the top left of the sprite as the origin (0,0).

Width,Height

Detection area width and height: W, H (1 to 65535)

ScaleSupport

When 1 is specified, the size of the collision detection changes according to the scale change in SPSCALE or SPANIM.

If 0 is specified, the size of collision detection will not change even if the scale is changed.

・0, if not specified.

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.

Example

SPCOL 3,0,0,32,32,1,255
SPCOL 3,0,0,32,32,,255
4. Get sprite collision detection attribute (scale support and mask)

SPCOL SpriteNumber OUT ScaleSupport[,Mask]

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

ScaleSupport

Scale support flag set in sprite

Mask

Collision mask value set for sprite

Example

SPCOL 3 OUT SC,MSK
5. Get sprite collision detection attributes (all)

SPCOL SpriteNumber OUT StartPointX,StartPointY,Width,Height[,ScaleSupport[,Mask]]

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

StartPointX,Y

Collision detection area start point coordinates

Width,Height

Collision detection area width and height

ScaleSupport

Scale support flag set in sprite

Mask

Collision detection mask value

Example

SPCOL 3 OUT X,Y,W,H,SC,MSK
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
|