[Features] The specified sprite is displayed on a screen.
[Format] SP_PUT n,(x,y), [,pt] [,Reverse-switch]
n: Sprite number. It can be used to 256 pieces.
x,y: Coordinates to display. The value including a decimal is OK.
pt: The pattern number defined by 'SP_DEF'.
Reverse switch: 0.(or omitted)no reverse 1.X-reverse 2.Y-reverse 3.XY-reverse
So that Sprite number is bigger, the priority of the indication becomes higher.
[e.g.] The example of sprite use.
140 sp_def 0,(0,0),16,16
150 sp_def 1,(16,0),16,16
160 sp_def 2,(32,0),16,16
170 sp_on 0,1:sp_on 1,1:sp_on 2,1
180 dim x(3)
190 for i=1 to 100
200 sp_put 0,(x(0),16),0 : x(0)=x(0)+1
210 sp_put 1,(x(1),48),1 : x(1)=x(1)+2
220 sp_put 2,(x(2),80),2 : x(2)=x(2)+3
*Speed up by the abbreviation.
If specifying only sprite number as 'sp_put 10' and omit the following,
it will reference directly to the address of variable specified before.
By describing by variable specification at first, and omitting at the time of loop,
it's possible to speed up in mass sprite.
for i=0 to ec
'In this example, referring to the value directly from address of 'cx(i),cy(i),cp(i)'
'There is use cases in the sample'acsamp.bas'.
[Features] Definition of pattern position in the Graphic buffer.
[Format] SP_DEF n,(x1,y1),x2,y2
Start point (x1,y1)
x2,y2 = sprite width.
n: The pattern number to define. It can be defined to 256 pieces.
[Features] Display of each sprite are controlled, by 'on'sw=1 or 'off'sw= 0.
[Format] SP_ON n,sw
n: Sprite number.
[Features] To make sprite move automatically by specified moving pattern.
[Format] SP_MOVE n,[pt],[d1],[d2],[d3],[d4]
The set-up Sprite continue moving every frame.
n: Sprite number
pt: moving pattern
pt=1 Now, moving pattern is only [No.1]straight-moving.
To move X-direction by 'd1'.
To move Y-direction by 'd2'.
The moving amount can be specified by a decimal unit.
In [d3][d4], the animation pattern of sprite is specified.
Let be base-point displayed sprite-pattern which defined by 'sp_def',
in Graphic buffer to rightward, by sprite's width unit,
to be specified by [d3] to how many pieces it shifts.
(Beforehand, it draw animation pattern to Graphic buffer as arranged in horizontal)
Animation pattern will loop in the specified number.
For example, if [d3]=4 is specified, it starts from the base point No.1,
and if it come to the 4th pattern, the next it return to No.1 pattern.
How many frames required to move to the next anime pattern, it is specified by [d4],
If specify pt=0, moving and animation will stop.
Information of current sprite's coordinates can be acquirable by 'sp_stat' function.
Since auto moving is performed in this command at every frame,
in (,i)mode, timing can not keep up and it may become different behavior from (,c)mode.
e.g. Sprite auto move & animation, swap sample
100 screen 1,1,1,0:cls 3
110 for i=0 to 15
120 if i>7 then j=7-(i-8) else j=i
150 get@(0,0),32*16,32,(0,0):cls 2
160 sp_def 1,(0,0),32,32
170 sp_def 2,(0,0),32,32
180 sp_on 1,1
190 sp_on 2,1
200 sp_move 1,1,1,0,16,8
210 sp_put 1,(32,100),1
220 sp_put 2,(32,200),2
230 while -1
240 vsync 256
250 sp_swap 1,2
270 print "Swap move sprite ";k+1
280 sp_put k+1,(32,sp_stat(k+1,1)),1
[Features] All the state is exchanged between two sprite.
[Format] SP_SWAP sp1,sp2
The sprite number for exchange is specified by 'sp1','sp2'.
The Data exchanged
XY coordinates, size-XY, pattern, display-ON/OFF state, margin size,
collision target & value of 'sp_hit()', 'sp_move'-moving pattern & data.
[Features] To specify the starting number of sprite display priority order.
[Format] SP_ORDER n
Usually sprite is displayed,
Number 0 is the most backward, Number 255 is the most forward. (Default n=0)
For example, if specifying 'sp_order 64',
display priority will be this.
[Backward] 64~255 0~63 [Forward]
[Features] To acquire various information of sprite.
n: Sprite number.
d: Get the type.
0: x position.
1: y position.
2: The width of the pattern size.
3: The height of the pattern size.
4: Pattern number.
5: Hide=0 Display=1
6: SP_MOVE: Moving pattern number.
7: SP_MOVE: Data1 (X moving amount)
8: SP_MOVE: Data2 (Y moving amount)
[Features] Wait until the screen drawing is updated regularly(1/60sec), and take the timing of synchronization.
[Format] VSYNC [n]
FPS(Frames Per Second) is set as 60 with this version.
This statement grasps the last updating, and check whether new updating is made,
if updated, it will progress to the next command.
When 'n' is specified, it becomes n/60-second interval.(default n=1)
By describing it in loop, movement of Sprite is kept by the constant speed.
120 sp_def 0,(0,0),32,32
130 cls 3 : sp_on 0,1
140 for i=1 to 300
150 x=x+1: y=100
160 sp_put 0,(x,y),0
170 vsync 1
190 x=0 : goto 140
[Features] It is investigated whether Sprite is inside of BG Graphics view range.
[Format] SP_OUT(Sprite number)
In the area of screen inner side,
it can be expanded by the specified amount of 'BG_GDSET' 3rd parameter.
Default = 1 pixcel widely for all directions.
(So as the Sprite that appeared in 'BG_GENE' not to disappear immediately)
if sp_out(1) then print"outside."
[Features] It perform a collision judgment between Sprite.
The candidate for a collision of each sprite is beforehand set up by 'SP_TARGET'.
The information on sprite overlapping when 'SP_CHECK' is performed can be read by 'SP_HIT'.
When making collision size smaller than the appearance of sprite,
the margin have to be specified by 'SP_MARGIN'.
[Features] The sprite No. of the overlaid sprite is returned. (Function)
n: The Sprite No. to cause it.(Range0-255)
m: (m-th) The Count number in order.
m=0: The number of the sprite which has collided is returned.
m=1-: Subsequently, Sprite No. of a target which has collided is returned.
Specification more than the number of collisions will return -1.
Undisplayed sprites are out of judgment.
(When origin is undisplayed, a collision number is 0 piece.)
When No.1 has collided with No.4 and No.6.
sp_hit(1,0) -> 2
sp_hit(1,1) -> 4
sp_hit(1,2) -> 6
sp_hit(1,3) -> -1
[Features] To specify the scope of collision of each sprite.
[Format] SP_TARGET n, start, end
n: Sprite No. to cause it.(0-255)
start-end: The range. (0-255)
The collision judging range of the specified sprite
is made even into 'end' position from 'start' position.
When no judgment, 'start' position is made into a bigger value than 'end' position.
[Features] The size of the margin portion which doesn't have a collision judging at sprite is specified.
[Format] SP_MARGIN n,m
n: Sprite No.(0-255)
m: The number of margin pixels.
If 0 is specified, it will become the same judgment size as display size.
0880 This is sprite size 4.
0880 '0' expresses the margin space.
0000 Margin size=1 (Area which doesn't collide)
[e.g.] Sample of sprite collision judging
110 get@(0,0),16,16,(0,0) :cls 3
120 sp_def 0,(0,0),16,16
140 sp_on 0,1:sp_on 1,1
150 sp_target 0,0,1
160 sp_margin 0,2
170 sp_put 1,(100,100),0
190 sp_put 0,(x,y),0
210 for i=1 to sp_hit(0,0)
220 print"Hit no";sp_hit(0,i)
240 if sp_hit(0,0)>0 then stop
260 goto 180
[Features] To write text in sprite buffer and display the text by sprite.
[Format] SP_PRINT pt,"string", x, y [,fontsize]
pt： Pattern number defined by 'SP_DEF'.
It's specified position of buffer to write the text in this frame.
"string"： Text string to be written to the sprite buffer.
If let it to chr$(12), it becomes the same function as 'CLS'.
(Clear all characters in the area)
x,y： Character coordinates to be written.
pt-specified area: upper-left (0,0)
To specify coordinates in character units.
fontsize: size of the character.(omissible)
It can also resize by 'font' command.
It have influence to displayable word count.
The size is rounded to multiple of 8 pixels.
The flow of display by 'SP_PRINT'.
To allocate a place to write text with 'SP_DEF',
and assign actual display with 'SP_PUT','SP_ON',
and specify display position,
text is actually written in the buffer by 'SP_PRINT',
and it will be displayed on the screen.
It's possible to use it like text display window by one sheet sprite.
Further, it is necessary to specify colors in advance.
To be used the same command as the text screen setting.
Command usage: color text-color, graphic-color
'text-color' is [SP_PRINT's textfont color],
'graphic-color' is [background fill color]
At first please set this:
Because text can be overwritten repeatedly,
the previous text will be cleared each time by this background color.
10 color col(15),0
20 sp_def 1,(128,128),160,96
30 sp_put 1,(32,32),1
40 sp_on 1,1
50 sp_print 1,"SC-12800",1,1
60 sp_print 1,"LEFT OOO",1,2