[↑]
SmileBASIC4 Replica Reference
SPDEF
1. Create a character definition template for sprites

SPDEF DefinitionNumber,U,V[,W,H[,OriginX,OriginY]][,Attribute]

Arguments

DefinitionNumber

Template definition number: 0 to 8191

U,V

The coordinates on the graphic page of the referenced image

W,H

Sprite size

・If not specified, both W and H are 16.

OriginX,Y

Sprite coordinate reference point

・If not specified, X and Y are 0.

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.

Example

SPDEF 0,192,352,32,32,16,16,1
2. Create sprite character definition templates in batch from an array

SPDEF NumericArray[,DefinitionNumberOffset[,UOffset,VOffset]]

Arguments

NumericArray

Numeric array that stores sprite template data

・There are seven elements: U, V, W, H, origin X, origin Y, and attribute.
・The number of elements must be a multiple of 7.
・"A number of elements divided by 7" sprite templates will be defined in order from 0.

DefinitionNumberOffset

Specify the definition start number: 0 to 8191

U,VOffset

It is added for the definition position adjustment of the image (each 0 to 4095)

Example

SPDEF SRCDATA
SPDEF SRCDATA 256,0,256
3. Create sprite character definition templates in batch from DATA column

SPDEF "@LabelString"[,DefinitionNumberOffset[,UOffset,VOffset]]

Arguments

@LabelString

DATA command label enumerating sprite template data

・@Label name must be enclosed in "" or specified with a string variable.
・The top data is the number of sprites to be defined, and then enumerate the data of each sprite (7 data per piece)
・The one data includes 7 items which are U, V, W, H, origin X, origin Y, and attribute.

DefinitionNumberOffset

Specify the definition start number: 0 to 8191

U,VOffset

It is added for the definition position adjustment of the image (each 0 to 4095)

Example

SPDEF "@SRCDATA" 
SPDEF "@SRCDATA",256,0,256
4. Get attribute on character definition template of sprite

SPDEF DefinitionNumber OUT U,V[,W,H[,HX,HY]][,A]

Argument

DefinitionNumber

Template definition number: 0 to 8191

Return Value

U,V

The coordinates on the graphic page of the referenced image

W,H

Sprite definition image size

HX,HY

Reference point coordinates of sprite definition

A

Sprite definition attributes

Example

SPDEF 2 OUT U,V,ATR
5. Copy the sprite character definition template

SPDEF DefinitionNumber,SourceDefinitionNumber,[U],[V],[W],[H],[OriginX],[OriginY],[Attribute]

・Elements that do not need to be copied can be omitted (separator ',' comma is required).
・The argument part is used for adjustment after copying.

Arguments

DefinitionNumber

Template definition number: 0 to 8191

SourceDefinitionNumber

Definition number that becomes the copy source: 0 to 8191

U,V

The coordinates on the graphic page of the referenced image

W,H

The size of the sprite to define

・If not specified, both W and H are 16.

OriginX,Y

Sprite coordinate reference point

・If not specified, X and Y are 0.

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.

Example

SPDEF 0,255,192,352,32,32,16,16,1
SPDEF 1,255,,,32,32,,,
6. Return the sprite character definition template to the initial state

SPDEF

Example

SPDEF
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
|