In this tutorial I shall take you step by step
through the commands explaining in detail how to use
them. Although Top Notch have given a fair idea of how
to use the extensions new commands there are still a few of
you who need that extra bit of help....
This month we shall have a look at the new SPRITE commands...
BOB SCR,ADR,IMAGE,X,Y,0
BOB X1,Y1,X2,Y2,0,1
JOEY SCR,ADR,IMAGE,COLOUR,X,Y,0
JOEY X1,Y1,X2,Y2,0,0,1
H=B HEIGHT (ADR,IMAGE)
W=W HEIGHT (ADR,IMAGE)
SCRbob SCR,ADR,IMAGE,X,Y,0
is the screen to place the BOB on. Note that unlike SPRITE which is only displayed on the physic or logic screen, a BOB can be displayed on either the BACK screen, the PHYSIC screen, or even the LOGIC screen. It can also be placed in a memory bank.ADR
is the memory bank where the BOB's are held. Unlike sprites that can only be accessed from bank one, BOB's can be loaded into any bank. Note that we need to use the START command to tell STOS which bank the BOB's are in. So if the BOB's were loaded into bank 5, the varible ADR would be 'start(5)' and not '5' as we use with commands like 'screen copy'.IMAGE
is the number of the BOB to display on screen which ranges from nought to the number of bobs in the bank. It's important to remember that when you convert your sprites to bobs, the image numbers are moved back by one place. So the first sprite would become BOB 0, the second would become BOB 1, and so on.......X,Y
are simply the X and Y co-ordinates of the BOB. Note that unlike sprites, the hot spot for a bob is best being put in the top left hand corner. So the BOB is placed on the co-ordinates of the hot spot.0
The last number (nought) does'nt do anything yet, it's just there for future purposes so you can leave it at nought.This command is a new version of the LIMIT SPRITE command, only it limits a BOB to a certain part of the screen. To limit the bob means to set up an area on screen where the bob is to be visible, if it moves outside this area then it will vanish. Try this routine...bob X1,Y1,X2,Y2,0,1
This routine will draw a box on screen and move the BOB to the right by steps of two pixels. Note that when the bob moves out of the box it starts to vanish. This could be used to great effect in games. As you can see, the co-ordinates of the box are the same as those of the limiting version of BOB meaning keep the bob between these co-ordinates.10 key off : hide : curs off : mode 0 20 load"bob.mbk",5 25 A=palt(start(5) 30 box 50,50 to 150,150 40 bob 50,50,150,150,0,1 50 logic=back 60 XB=60 : YB=60 70 repeat 80 XB=XB+2 90 bob logic,start(5),0,XB,YB,0 100 wait 5 110 screen swap : wait vbl 120 until XB=170 130 goto 60
joey SCR,ADR,IMAGE,X,Y,COLOUR,0The parameters of this command are the same as the BOB command, with the extra parameter called COLOUR. This is the number of the colour in the present palette that the joey is...for example, if the joey was white, and white was colour number ten in the palette then COLOUR would be ten. For unknown reasons, colour fifteen is the fastest.
joey X1,Y1,X2,Y2,0,0,1This version of the command limits the joey to a certain part of the screen. It just the same as the BOB version only the two noughts are reserved for future use.
W=b width (ADR,IMAGE)These commands return the size of a bob, in pixels.
H=B height(ADR,IMAGE)
EXAMPLE:-
This command would be useful in finding out the size of a bob so we can calulate if it will fit on a certain part of the screen.10 key off : curs off : hide : mode 0 20 load"bob.mbk",5 30 W=b width(start(5),0) 40 H=b height(start(5),0) 50 print"This bob is ";W;" pixels across" 60 print"This bob is ";H;" pixels down" 70 print"Total size is ";W;"X";H
Well thats the end of the first part of this tutorial and I hope I've managed to make the SPRITE commands more clearer to you. Next month we shall have a look at the Mapping commands.
Till next month..........DEANO