[↑]
SmileBASIC4 Replica Reference
SPANIM
1. Set animation for sprites

SPANIM SpriteNumber,AnimationTarget,DataArray [,Loop]

・Error when used before SPSET.

Sprite animation common specifications

・The set animation is played automatically.
・Animation is an operation of setting a value and waiting for a specified time.
・The animation starts from the next frame after executing SPANIM.
・Accept up to 32 data for each target element.
・If a negative value is specified for time, linear interpolation is performed from the previous value (moves smoothly).

Arguments

SpriteNumber

Sprite number for setting animation: 0 to 4095

AnimationTarget

Numeric value or string that manages the element to be changed

0 "XY" XY Coordinates
1 "Z" Z Coordinate
2 "R" Rotation Angle
3 "S" Magnification XY
4 "C" Display Color
5 "V" Variable (value of sprite internal variable 7)
6 "UV" UV Coordinates (definition source image coordinates)
7 "I" Definition Number

・If you add "+" to the end of the string or add 8 to the value, it will be the relative value from the animation start point.
・If you add "." to the end of the string or add 16 to the number, the sprite will be deleted when the animation ends.

DataArray

1D numeric array that stores animation data

Loop

Loop count: (1 or more)

・If 0 is specified, an infinite loop is created.
・1, if not specified.

DataArray

・Anime data is prepared in the following order in the numerical array (up to 32).
・Time1, Item1,[Item2,] Time2,Item1,[Item2,]...

Example

DIM PANIM[6]
PANIM[0]=-60 'frame(-60=smooth)
PANIM[1]=200 'offset X,Y
PANIM[2]=100
PANIM[3]=-30 'frame
PANIM[4]=50 'offset
PANIM[5]=20
SPSET 0,0
SPANIM 0,"XY",PANIM
2. Set animation to sprite (specified with DATA command)

SPANIM SpriteNumber,AnimationTarget,"@LabelString"[,Loop]

・Error when used before SPSET.

Arguments

SpriteNumber

Sprite number for setting animation: 0 to 4095

AnimationTarget

Numeric value or string that manages the element to be changed

0 "XY" XY Coordinates
1 "Z" Z Coordinate
2 "R" Rotation Angle
3 "S" Magnification XY
4 "C" Display Color
5 "V" Variable (value of sprite internal variable 7)
6 "UV" UV Coordinates (definition source image coordinates)
7 "I" Definition Number

・If you add "+" to the end of the string or add 8 to the value, it will be the relative value from the animation start point.
・If you add "." to the end of the string or add 16 to the number, the sprite will be deleted when the animation ends.

@LabelString

・The first label of the DATA command that stores the animation data.
・@Label name is enclosed in "" and specified as a string (or character variable).

Loop

Loop count: (1 or more)

・If 0 is specified, an infinite loop is created.
・1, if not specified.

Data

Anime data is prepared in the following order in the DATA command

DATA NumberOfKeyFrames(UpTo32)
DATA Time1,Item1[,Item2]
DATA Time2,Item1[,Item 2]
:

Example

@MOVDATA
DATA 2 'counter
DATA -60,200,100 'frame,offset
DATA -30,50,20 'frame,offset
SPSET 0,0
SPANIM 0,"XY",@MOVDATA
3. Set animation for sprites (specify as direct argument)

SPANIM SpriteNumber,AnimationTarget,Time1,Item1[,Item2][,Time2,Item1[,Item2]]...[,Loop]

・Error when used before SPSET.

Arguments

SpriteNumber

Sprite number for setting animation: 0 to 4095

AnimationTarget

Numeric value or string that manages the element to be changed

0 "XY" XY Coordinates
1 "Z" Z Coordinate
2 "R" Rotation Angle
3 "S" Magnification XY
4 "C" Display Color
5 "V" Variable (value of sprite internal variable 7)
6 "UV" UV Coordinates (definition source image coordinates)
7 "I" Definition Number

・If you add "+" to the end of the string or add 8 to the value, it will be the relative value from the animation start point.
・If you add "." to the end of the string or add 16 to the number, the sprite will be deleted when the animation ends.

Time,Item

・Animation data itself (up to 32 as many as necessary).

Loop

Loop count: (1 or more)

・If 0 is specified, an infinite loop is created.
・1, if not specified.

Example

SPSET 0,0
SPANIM 0,"XY",-60,200,100,-30,50,20
4. Set animation to sprite (specified by animation definition number)

SPANIM SpriteNumber,AnimationDefinitionNumber

・Animation definitions defined with ANIMDEF can be specified.
・Error when used before SPSET.

Arguments

SpriteNumber

Sprite number for setting animation: 0 to 4095

AnimationDefinitionNumber

Definition number already defined by ANIMDEF command: 0 to 1023

Example

ANIMDEF 0,"XY",-60,100,0
SPSET 0,0
SPANIM 0,0
5. Clear sprite animation

SPANIM [SpriteNumber]

Argument

SpriteNumber

Sprite number for clearing animation: 0 to 4095

・An error will occur if a number that is not SPSET is specified.
・If not specified, clear all sprite animations.

Example

SPANIM 0
SPANIM
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
|