[↑]
SmileBASIC4 Replica Reference
SPSET
1. Create sprites (using definition templates)

SPSET SpriteNumber,DefinitionNumber[,DisplayFlag]

SPSET common elements

・A sprite can be used by SPSET.
・All attributes such as rotation is initialized by executing SPSET.
・The sprite variables are cleared.
・When using SPHIT collision detection, call SPCOL after SPSET.

Arguments

SpriteNumber

Sprite number to create: 0 to 4095

DefinitionNumber

Definition number of template defined by SPDEF: 0 to 8191

DisplayFlag

Specify whether to display the created sprite

・Display with 1 and do not display with 0.
・1, if not specified.

Example

SPSET 1,500
2. Create sprite (specify image attribute etc. directly)

SPSET SpriteNumber,U,V,W,H[,Attribute[,DisplayFlag]]

・Used when setting independently without using SPDEF value.

Arguments

SpriteNumber

Sprite number to create: 0 to 4095

U,V

The coordinates on the graphic page of the referenced image

W,H

Sprite size: 0 to 2048

Attributes

b00 ↑ Rotation by 90 degrees (specified by 2 bits of b00 and b01)
b01 ↓ #A_ROT0, #A_ROT90, #A_ROT0180, #A_ROT270
b02 Horizontal Reverse (0=OFF, 1=ON), #A_REVH
b03 Vertical Reverse (0=OFF, 1=ON), #A_REVV
b04 Additive Composite (0=OFF, 1=ON), #A_ADD

・0, if not specified.

DisplayFlag

Specify whether to display the created sprite

・Display with 1 and do not display with 0.
・1, if not specified.

Example

SPSET 54,0,0,32,32,1,0
3. Search for an available number, create a sprite, and return the number

SPSET(DefinitionNumber[,DisplayFlag])

・Search for space in the entire sprite.

Arguments

DefinitionNumber

Definition number of the template defined by SPDEF: 0 to 8191

DisplayFlag

Specify whether to display the created sprite

・Display with 1 and do not display with 0.
・1, if not specified.

Return Value

SpriteNumber

Generated sprite number: 0 to 4095

・When there is no space and cannot be generated, -1 is returned.

Example

IX=SPSET(500)
4. Search for an available number, create a sprite, and return the number

SPSET(U,V,W,H,Attribute[,DisplayFlag])

・Search for space in the entire sprite.

Arguments

U,V

The coordinates on the graphic page of the referenced image

W,H

Sprite size: 0 to 2048

Attributes

b00 ↑ Rotation by 90 degrees (specified by 2 bits of b00 and b01)
b01 ↓ #A_ROT0, #A_ROT90, #A_ROT0180, #A_ROT270
b02 Horizontal Reverse (0=OFF, 1=ON), #A_REVH
b03 Vertical Reverse (0=OFF, 1=ON), #A_REVV
b04 Additive Composite (0=OFF, 1=ON), #A_ADD

DisplayFlag

Specify whether to display the created sprite

・Display with 1 and do not display with 0.
・1, if not specified.

Return Value

SpriteNumber

Generated sprite number: 0 to 4095

・When there is no space and cannot be generated, -1 is returned.

Example

IX=SPSET(0,0,32,32,1)
5. Search for an available number, create a sprite, and return the number

SPSET(StartNumber,EndNumber,DefinitionNumber[,DisplayFlag])

・Search for available space within the specified range.

Arguments

StartNumber,EndNumber

Search range (0 to 4095)

・If the starting number is increased, the available numbers are searched in descending order.

DefinitionNumber

Definition number of template defined by SPDEF: 0 to 8191

DisplayFlag

Specify whether to display the created sprite

・Display with 1 and do not display with 0.
・1, if not specified.

Return Value

SpriteNumber

Generated sprite number: 0 to 4095

・When there is no space and cannot be generated, -1 is returned.

Example

IX=SPSET(100,120, 500)
6. Search for an available number, create a sprite, and return the number

SPSET(StartNumber,EndNumber,U,V,W,H,Attribute[,DisplayFlag])

・ Search for available space within the specified range.

Arguments

StartNumber,End Number

Search range (0 to 4095)

・If the starting number is increased, the available numbers are searched in descending order.

U,V

The coordinates on the graphic page of the referenced image

W,H

Sprite size: 0 to 2048

Attributes

b00 ↑ Rotation by 90 degrees (specified by 2 bits of b00 and b01)
b01 ↓ #A_ROT0, #A_ROT90, #A_ROT0180, #A_ROT270
b02 Horizontal Reverse (0=OFF, 1=ON), #A_REVH
b03 Vertical Reverse (0=OFF, 1=ON), #A_REVV
b04 Additive Composite (0=OFF, 1=ON), #A_ADD

DisplayFlag

Specify whether to display the created sprite

・Display with 1 and do not display with 0.
・1, if not specified.

Return Value

SpriteNumber

Generated sprite number: 0 to 4095

・When there is no space and cannot be generated, -1 is returned.

Example

IX=SPSET(100,120, 0,0,32,32,1)
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
|