User Tools


reference:sprites

Sprites

SPSET SpriteNumber,DefinitionNumber[,DisplayFlag]

Create sprites (using definition templates)

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

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

Create sprite (specify image attribute etc. directly)

・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

SPSET(DefinitionNumber[,DisplayFlag])

Search for an available number, create a sprite, and return the number

・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)

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

Search for an available number, create a sprite, and return the number

・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)

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

Search for an available number, create a sprite, and return the number

・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)

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

Search for an available number, create a sprite, and return the number

・ 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)

SPCLR

Delete all sprites

・Sprite for graphic page (4095) is not deleted.

Example

SPCLR

SPCLR SpriteNumber

Delete the specified sprite

・If you do not delete it after use, there will be no sprite space that can be specified with SPSET.

Argument

SpriteNumber

Sprite number to delete: 0 to 4095

Example

SPCLR 56

SPCLR SpriteNumber1,SpriteNumber2

Delete sprite in specified range

Arguments

SpriteNumber1

Start number position of sprite range to delete: 0 to 4095

SpriteNumber2

End number position of sprite range to delete: 0 to 4095

Example

SPCLR 2,10

SPSHOW SpriteNumber
SPSHOW SpriteNumber,DisplayFlag

Display sprite

・Error when used before SPSET.

Arguments

SpriteNumber

Sprite number to display: 0 to 4095

DisplayFlag

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

Example

SPSHOW 43
SPSHOW 44, #TRUE

SPSHOW(SpriteNumber)

Get whether sprite is displayed

・Error when used before SPSET.

Argument

SpriteNumber

Sprite number to check: 0 to 4095

Return Value

Returns 1 if displayed, 0 if disappeared

Example

S = SPSHOW(43)

SPHIDE SpriteNumber
SPHIDE SpriteNumber,DisplayOffFlag

Hide sprite display

・Just hiding the display, it does not delete the sprite.
・Error when used before SPSET.

Arguments

SpriteNumber

Sprite number to hide display: 0 to 4095

DisplayOffFlag

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

Example

SPHIDE 43

SPHIDE(SpriteNumber)

Get whether sprite is off

・Error when used before SPSET.

Argument

SpriteNumber

Sprite number to check: 0 to 4095

Return Value

Returns 0 if displayed, 1 if disappeared

Example

H=SPHIDE(43)

SPHOME SpriteNumber,CoordinateX,CoordinateY

Specify the sprite's home coordinate (coordinate reference point)

・The home coordinates are used as reference points for SPOFS(Movement), SPROT(Rotation), and SPSCALE(Enlargement/Reduction).
・SPCOL (collision detection) uses the value of SPHOME as the default value when the starting point X and Y are not specified. For details, see the SPCOL description.
・Error when used before SPSET.

Arguments

SpriteNumber

Sprite number for setting the reference point: 0 to 4095

CoordinateX,Y

Relative coordinates with the upper left corner of the sprite as the origin (0,0)

・Depending on the hardware specifications, setting a Real value may shift the reference image by one pixel.

Example

SPHOME 34,16,16

SPHOME SpriteNumber OUT HX,HY

Get home position of sprite

・Error when used before SPSET.

Argument

SpriteNumber

Sprite number: 0 to 4095

Return Value

HX,HY

Home coordinates

Example

SPHOME 10 OUT HX,HY

SPOFS SpriteNumber,[X],[Y][,Z]

Move the sprite

・Error when used before SPSET.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

X,Y

Display coordinates of sprite to be set

・Depending on the hardware specifications, setting a Real value may shift the reference image by one pixel.

Z

Display priority: -4095 to 4095

・The smaller it is, the closer it is displayed.

Example

SPOFS 23,50,80
SPOFS 23,,,1000
SPOFS 23,150,180,0

SPOFS SpriteNumber[,CoordinateSystemFlag] OUT X,Y[,Z]

Get display coordinates of sprite

・Error when used before SPSET.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

CoordinateSystemFlag

If 1, it returns absolute sprite coordinates.

If 0, it returns the sprite's relative coordinates.

・Relative coordinates mean the coordinates set in SPOFS.
・Absolute coordinates return the display coordinates on the layer.
・Both will have different coordinates when using SPLINK.
・0, if not specified.

Return Value

X,Y

Sprite coordinates

Z

Display priority

Example

SPOFS 12 OUT X,Y,Z

SPROT SpriteNumber,Angle

Rotate the sprite

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Angle

Rotation angle: 0 to 360 (clockwise)

・Depending on the hardware specifications, the reference image may be shifted by 1 pixel depending on the angle.

Example

SPROT 23,45

SPROT(SpriteNumber)

Get sprite rotation angle

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

DR

Sprite angle

Example

DR=SPROT(23)

SPSCALE SpriteNumber,MagnificationX,MagnificationY

Change the sprite scale (display magnification)

・SPCOL is executed first for the collision detection considering the scale.
・Error when used before SPSET.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

MagnificationX,Y

0.5 (50%) to 1.0 (100%) to 2.0 (200%) and more

・Depending on the hardware specifications, the reference image may be shifted by 1 pixel depending on the setting value.

Example

SPSCALE 56,0.75, 0.75

SPSCALE SpriteNumber OUT SX,SY

Get sprite display magnification

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

SX,SY

Sprite magnification

Example

SPSCALE 45 OUT SX,SY

SPCOLOR SpriteNumber,ColorCode

Set the sprite display color

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

ColorCode

・The actual display color is the value obtained by multiplying the original pixel color by the color code.

Example

SPCOLOR 1,RGB(16, 255,0,0) 'A=16,R=255,G=0,B=0

SPCOLOR(SpriteNumber)

Get the sprite display color

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

ColorCode

Color code set for sprite

Example

C=SPCOLOR(1)

SPCHR SpriteNumber,DefinitionNumber

Change sprite character definition

・Error when used before SPSET.

Arguments

SpriteNumber

Sprite number whose definition is to be changed: 0 to 4095

DefinitionNumber

Template number registered with SPDEF command: 0 to 8191

Example

SPCHR 0,500

SPCHR SpriteNumber,[U],[V],[W],[H],[Attribute]

Change sprite character definition

・Arguments other than the sprite number can be omitted.
・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

U,V

The coordinates on the graphic page of the referenced image

W,H

Sprite size: 0 to 2048

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

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

SPCHR 5,64,64,16,16,0
SPCHR 6,,,32,32,1 'UV skip

SPCHR SpriteNumber OUT U,V[,W,H[,ATR]]

Get sprite character definition attributes

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

U,V

The coordinates on the graphic page of the referenced image

W,H

Sprite image size

ATR

Sprite attributes

Example

SPCHR 5 OUT U,V,W,H,ATR

SPCHR(SpriteNumber)

Get a sprite character definition number

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

DefinitionNumber

Character definition number of the specified sprite

Example

DEFNO=SPCHR(5)

SPPAGE SpriteNumber,GraphicPage

Set the reference graphic page of the specified sprite

Arguments

SpriteNumber

Target sprite number: 0 to 4095

GraphicPage

-1 to 5

・The default sprite page is 4.

Example

SPPAGE 100, 3

SPPAGE(SpriteNumber)

Get the reference graphic page of the specified sprite

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

Graphic page number: -1 to 5

Example

P=SPPAGE(100)

SPPAGE GraphicPage

Set the graphic page assigned to the sprite to be created

Argument

GraphicPage

-1 to 5 (GRP-1 to GRP5)

The initial sprite page is 4 (GRP4)

Example

SPPAGE 3

SPPAGE()

Get the graphic page assigned to the sprite to be created

Return Value

Graphic page number: -1 to 5

Example

P=SPPAGE()

SPLAYER SpriteNumber,LayerID

Set the layer to which the specified sprite belongs

Arguments

SpriteNumber

Target sprite number: 0 to 4095

LayerID

ID of the layer to which the sprite belongs: 0 to 7

Example

SPLAYER 100,3

SPLAYER(SpriteNumber)

Get the layer to which the specified sprite belongs

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

Layer ID

Example

P=SPLAYER(100)

SPLAYER LayerID

Set the layer to which the sprite to be created belongs

Argument

LayerID

0 to 7

・The initial layer ID is 0.

Example

SPLAYER 3

SPLAYER()

Get the layer to which the sprite to be created belongs

Return Value

Layer ID

Example

P=SPLAYER()

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

Create a character definition template for sprites

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

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

Create sprite character definition templates in batch from an array

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

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

Create sprite character definition templates in batch from DATA column

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

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

Get attribute on character definition template of sprite

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

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

Copy the sprite character definition template

・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,,,

SPDEF

Return the sprite character definition template to the initial state

Example

SPDEF

SPLINK SpriteNumber,LinkDestinationSpriteNumber[,LinkFlag]

Link a sprite to another sprite

・When linked, the coordinates will follow the link destination (parent).
・The display coordinates and display priority of the child are relative coordinates based on the parent.
・Error when used before SPSET.

Arguments

SpriteNumber

Link source (child) sprite number: 0 to 4095

LinkSpriteNumber

Link (parent) sprite number: 0 to 4095

・An error occurs if the descendant of the link source is specified.

LinkFlags

Combination of bit values that specify which link destination (parent) attribute is inherited

・Specify when you want to inherit attributes other than display coordinates and display priority.
・If bit0 is specified, descendants are deleted 1V after the parent has been SPCLR.
・0, if not specified.

bit0 1 Display ON / OFF and Erase Timing
bit1 2 Rotation
bit2 4 Scaling
bit3 8 Color
bit4 16 Layer ID

Example

SPLINK 15,4
SPLINK 2,0,3

SPLINK(SpriteNumber[,LinkType])

Get the link number of the specified number sprite

・Error when used before SPSET.

Arguments

SpriteNumber

Link source (child) sprite number: 0 to 4095

LinkType

Type of link destination and link flag to be obtained.

0 Parent
1 Child
2 Brother
3 LinkFlag

・Default is 0.

Return Value

Link number: 0 to 4095 (No link when -1)

Example

'Pick up every child of the sprite PARENT
CHILD=SPLINK( PARENT,1 ) 'The first child
WHILE CHILD!=-1
CHILD=SPLINK( CHILD, 2 ) 'Get brothers in order
WEND

SPUNLINK SpriteNumber

Unlink sprites

・Error when used before SPSET.

Argument

SpriteNumber

Sprite number to release link: 0 to 4095

Example

SPUNLINK 15

SPANIM SpriteNumber,AnimationTarget,DataArray [,Loop]

Set animation for sprites

・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

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

Set animation to sprite (specified with DATA command)

・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

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

Set animation for sprites (specify as direct argument)

・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

SPANIM SpriteNumber,AnimationDefinitionNumber

Set animation to sprite (specified by animation definition number)

・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

SPANIM [SpriteNumber]

Clear sprite animation

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

SPSTOP [SpriteNumber]

Stop sprite animation

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

・If not specified, all sprite animations are stopped.

Example

SPSTOP

SPSTART [SpriteNumber]

Resume sprite animation

・An error if used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

・If not specified, start animation of all sprites.

Example

SPSTART

SPCHK(SpriteNumber)

Get animation state of sprite

・Error when used before SPSET.

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

b00 XY Coordinates 1 #CHKXY
b01 Z Coordinate 2 #CHKZ
b02 Rotation 4 #CHKR
b03 XY Magnification 8 #CHKS
b04 Display Color 16 #CHKC
b05 Variable 32 #CHKV
b06 UV Coordinates 64 #CHKUV
b07 Definition Number 128 #CHKI

Target assignment for each bit (when all are 0, animation is stopped)

Example

ST=SPCHK(5)
'|b00|#CHKXY|
'|b01|#CHKZ|
'|b02|#CHKR|
'|b03|#CHKS|
'|b04|#CHKC|
'|b05|#CHKV|
'|b06|#CHKUV|
'|b07|#CHKI|

SPVAR SpriteNumber,VariableKey,Value

Set sprite variables

・All sprites have special variables called sprite variables.
・Sprite variables are cleared when program execution starts or when SPSET or SPCLR is called.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

VariableKey

The name of the sprite variable

・A string or Int can be given as a name.

Value

Value to be registered in internal variable

・Numerical values or strings can be registered.

Example

SPVAR 0,7,1
SPVAR 0,"NAME","VALUE" 

SPVAR(SpriteNumber,VariableKey)

Read sprite variables

Arguments

SpriteNumber

Target sprite number: 0 to 4095

VariableKey

The name of the sprite variable: string or Int can be named.

Return Value

Value registered with SPVAR

If no value is registered with SPVAR, the Int 0 is returned.

Example

V=SPVAR(54,0)

SPVAR SpriteNumber[,VariableKey]

Delete sprite variables

Arguments

SpriteNumber

Target sprite number: 0 to 4095

VariableKey

The name of the sprite variable to delete

・A string or Int can be given as a name.
・If not specified, all sprite variables of the specified sprite are deleted.

Example

SPVAR 0,7
SPVAR 0,"NAME" 

SPCOL SpriteNumber[,ScaleSupport]

Set sprite collision detection attribute

・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

SPCOL SpriteNumber,[ScaleSupport],Mask

Set sprite collision detection attribute (with mask specification)

・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

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

Set sprite collision detection attribute (with range specification)

・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

SPCOL SpriteNumber OUT ScaleSupport[,Mask]

Get sprite collision detection attribute (scale support and 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

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

Get sprite collision detection attributes (all)

・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

SPCOLVEC SpriteNumber[,MovementAmountX,MovementAmountY]

Set the movement speed for sprite collision detection

・Error when used before SPSET.

Arguments

Sprite number

Target sprite number: 0 to 4095

MovementAmountX,MovementAmountY

・If not specified, it is automatically calculated as follows.
・Running SPANIM XY with linear interpolation: distance moved from the previous frame.

・Otherwise: 0,0

Example

SPCOLVEC 93

SPHITSP(SpriteNumber[,StartID,EndID])

Return sprite collision detection result

・Call SPCOL in advance.

Argument

SpriteNumber

Sprite number to judge: 0 to 4095

StartID,EndID

Sprite range to detect (0 to 4095)

Return Value

Collision sprite number (-1 if no collision)

Example

H=SPHITSP(0)

SPHITSP(SpriteNumber,OpponentSpriteNumber)

Return sprite collision detection result with specified sprite

・Call SPCOL in advance.

Argument

SpriteNumber

Sprite number to detect: 0 to 4095

OpponentSpriteNumber

Opponent sprite number: 0 to 4095

Return Value

0=No Collision, 1=Collision

Example

H=SPHITSP(0,34)

SPHITSP()

Return the sprite collision detection result from the previously set information

・If there are multiple collision destinations in SPHITSP with arguments, all collision destinations can be retrieved by calling again with the arguments omitted.
・Call SPCOL in advance.
・Call SPHITSP without omitting arguments in advance.

Return Value

Collision sprite number (-1 if no collision)

Example

H=SPHITSP(0)
WHILE H>=0
 H=SPHITSP()
WEND

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

Return collision detection result of moving rectangle and all sprites

・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)

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

Return collision detection result of specified sprite and rectangle

・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)

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

Return the result of collision detection between a sprite in the specified range and a rectangle

・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)

SPHITRC()

Return the sprite collision detection result from the previously set information

・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

SPHITINFO()

Get the detailed information on collision detection results (collision time)

Return Value

Collision Time

・Collision time: Real between 0 and 1
・Coordinates at the time of detection + velocity x collision time coincides with the collision coordinates.

Example

TM=SPHITINFO()

SPHITINFO OUT TM,X1,Y1,X2,Y2

Get the detailed information of collision detection results (collision time and coordinates)

Return Value

TM

・Collision time: Real between 0 and 1
・Coordinates at the time of detection + velocity x collision time coincides with the collision coordinates.

X1,Y1

Coordinate of object 1 at the time of collision

X2,Y2

Coordinate of object 2 at the time of collision

Example

SPHITINFO OUT TM,X1,Y1,X2,Y2

SPHITINFO OUT TM,X1,Y1,VX1,VY1,X2,Y2,VX2,VY2

Get the detailed information of collision detection results (collision time, coordinates and velocity)

Return Value

Collision time

・Collision time: Real between 0 and 1
・Coordinates at the time of detection + velocity x collision time coincides with the collision coordinates.

X1,Y1

Coordinate of object 1 at the time of collision

VX1,VY1

Object 1 velocity at impact

X2,Y2

Coordinate of object 2 at the time of collision

VX2,VY2

Object 2 velocity at impact

Example

SPHITINFO OUT TM,X1,Y1,VX1,VY1,X2,Y2,VX2,VY2

SPFUNC SpriteNumber, "@Label"
SPFUNC SpriteNumber,"UserDefinedCommandName"

Assign callback processing for each sprite

・Commands for advanced users who need callback processing.
・You can specify either the label you want to jump with GOSUB or the name of the DEF command you want to execute.
・Callback processing of all sprites is executed at once by CALL SPRITE.
・At the callback destination, the number can be acquired with the CALLIDX () function.

Arguments

SpriteNumber

Target sprite number: 0 to 4095

@Label

Label of the processing destination to be called

UserDefinedCommandName

The name of the user-defined command to be called

Example

SPFUNC 0,"@PROG" 
SPFUNC 1,"USERDEF" 

SPFUNC SpriteNumber

Clear callback processing assigned to sprite

Argument

SpriteNumber

Sprite number to clear: 0 to 4095

Example

SPFUNC 0

SPUSED(SpriteNumber)

Check if specified sprite is used

Argument

SpriteNumber

Target sprite number: 0 to 4095

Return Value

0=Free, 1=in use

Example

S=SPUSED(4)

reference/sprites.txt · Last modified: 2020/08/24 12:17 (external edit)

Page Tools