home *** CD-ROM | disk | FTP | other *** search
- SPRITE PATH DEFINER
-
- This month's STOS feature is devoted to Phil Lawson's
- utility for creating sprite paths to include in your own
- mega-blasting arcade games.
-
- Well, I've promised it for long enough, so now here it is. If you recall the
- articles from a couple of months back, you'll remember we discovered how to
- control the sprites by using an array, holding the X and Y coordinates of every
- position the sprite goes though.
-
- The Sprite Path Definer, (SPD), does a similar thing, except the actual
- starting position is the only real coordinate present. All the rest are offsets
- from the previous position. For example:
-
- Start pos = 100,100
- If next values are 2 and 4, the actual coordinates will be 102 and 104. If the
- next two were 4 and -3, the coordinates would be (102+4,104-3) 106 and 101.
-
- The reason for this small alteration in storing the sprite positions is that it
- drastically reduces the amount of space needed to save the data on disk. I'm
- not going to start explaining the workings of 16-bit arithmetic, so you'll just
- have to believe me on this one. Anyway, enough of the waffle, let's get down to
- business.
-
- The easiest way for you to understand what each option does is for me to
- explain them in turn, so here goes.
-
- MENU 1
- ¯¯¯¯ ¯
-
- LOAD - Loads a previously saved set of sprite paths
-
- SAVE - Once you've created the sprite paths, it would be a shame if you
- were not able to save them.
-
- UNUSED - There are two of these, mainly because I designed the screen and then
- couldn't think of anything else to include. No doubt you'll have your own ideas
- of what these should be used for, so I've left them for you to alter the
- program and do with them what you will. (STOS owners only).
-
- SET X and SET Y - Several options require one or two parameters to be set. For
- example, if you wished to copy only a section of a path to the end of another
- one, you would set the X and Y values to the start and finish number of the
- section to copy, and then use the COPY X/Y TO END option.
-
- Each of the nine paths has its own unique X and Y values, which are
- automatically displayed whenever you select a new path. To increase the number,
- position the pointer over the required option and press the right mouse button.
- To decrease it press the left button.
-
- Notice that under each of the nine paths, selected by clicking in one of the
- boxes, is a 3-digit number. This is the number of coordinates that each path
- currently contains. This will range from 0, (meaning empty), to 999.
-
- When trying to set the X and Y values, the numbers will whizz round pretty
- quickly. To allow a bit of "fine-tuning" to select a specific number, press the
- S key. To get things going at full speed again press F.
-
- RESET - This will reset everything to zero, including speed, x and y values and
- the contents of all the paths. Since selecting this by mistake would be very
- upsetting, especially after several hours work, both mouse buttons have to be
- pressed before the reset is performed.
-
- SELECT SPRITE - There's no point in defining paths if you cannot use your own
- sprites, therefore this option will allow you to choose one of the sprites
- currently stored in the sprite-bank.
-
- LOAD SPRITES - Quite obvious really. When the program is fully running, a lot
- of memory is taken up. Therefore try and keep the sprite banks to a minimum.
- One way of doing this is to create a second file containing only the main
- sprites you intend to use in the your game.
-
- LOAD BKGND .PI1 - Since most arcade games contain some form of terrain that the
- sprites are to pass over, it would be nice to make sure they're going where
- they're supposed to. This option will load a standard Degas PI1 picture, and
- can then be used to check on the movement of the sprite.
-
- LOAD BKGND .MBK - Exactly the same as the above option, except it will load a
- screen that has been compacted with the STOS accessory, COMPACT.ACB. If you're
- not intending to use the game in STOS, this option can be disabled. See STOS /
- OTHER.
-
- DELETE ONE PATH - Does just what it says. The current sprite path will be
- deleted. Take care though, once it's gone there's no way of getting it back
- again. To change the current path, position the pointer over one of the nine
- boxes at the top of the screen and press the left mouse button. The selected
- path number will be shown at the far right of the screen.
-
- DELETE ALL PATHS - Go on, try and guess what this one does.
-
- MENU 2 - Displays the second set of options available.
-
- BACKWARDS - If selected, the PLAY commands will result in the sprite going
- backwards. Can be used to give the illusion of two paths being defined by one
- set of data. Just have one type of sprite going forwards, and another going
- backwards. With a little work and thought, this can produce really amazing
- effects.
-
- FORWARDS - The normal way of moving a sprite. See BACKWARDS
-
- STOS / OTHER. Since the main program has been compiled, it follows that anyone
- can use it to define their own sprite paths. In this case, they may not have
- access to sprite banks and compressed picture screen. By selecting the other
- option they can turn off the STOS only options.
-
- PLAY - Use this option to check the movement of a sprite along a previously
- defined path. Before using, seek the PLAY OPTIONS in menu 2.
-
- PLAY & PLOT - Just like PLAY, except each point the sprite passes through is
- plotted on the screen.
-
- SPEED - To closely check what the sprite is doing, change the value of speed.
- As with SET X and SET Y, this is achieved with the left and right mouse
- buttons. The speed value can range from 0 (fast) to 100 (zzzzz).
-
- QUIT - Back to the desktop. As with RESET, this need both mouse buttons to be
- pressed at the same time.
-
- MENU 2
- ¯¯¯¯ ¯
-
- DELETE 1 to X - Deletes the whole of the current path from the first position
- to the Xth position. All the ones from X onwards are moved down to fill the
- gap.
-
- DELETE X to END - Deletes everything from the Xth position to the end of the
- current path.
-
- KEEP X - Y - Everything apart from the data between X and Y is deleted.
-
- PLAY OPTIONS
-
- UNTIL MOUSEKEY - Will play the whole path until a mousekey is pressed or the
- end of the path is reached.
-
- FROM X to Y - Plays between X and Y only.
-
- UNTIL X VALUE - Plays from the beginning, (or end if BACKWARDS is selected)
- until the X value is reached.
-
- With all these play options, once the sprite has finished moving, the current X
- and Y coordinates of the sprite are displayed, along with the position number.
- By setting the SET X and SET Y values to numbers slightly lower and higher
- respectively, you can now examine the area of the path around where the sprite
- was stopped.
-
-
- BACKGROUND OPTIONS
-
- BACKGROUND ON - If a background picture has been loaded, it will be displayed.
-
- BACKGROUND OFF - Surprise, surprise. This option will stop any loaded pictures
- from being displayed.
-
- MENU 1 - Takes you back to the first set of options.
-
- COPY OPTIONS
-
- 1 to X - Will copy the first X amount of data from the current path to the path
- you next click on, which will be totally overwritten by the new data
-
- X to Y - Copies the data between X and Y from the current path to the one you
- next click. This option will also overwrite the original data held in the
- selected path.
-
- X/Y to END - Copies the data between X and Y to the end of the next selected
- path. This option is best used to produce complicated paths by joining together
- many smaller ones.
-
-
- Your best chance of becoming famliar with SPD is to actually play around with
- it, but some extra information may be of use later on.
-
- 1) When saving the path data to a file, the following format is used:
-
- The first four bytes are 11, 22, 33 and 44. This is used to identify a sprite
- path file when loading it back into SPD. The next byte is how many positions
- are defined in this path.
-
- The next four bytes are the actual starting position of the sprite, in hi-lo
- order. For instance, if these were 01, 04, 00 and 95, the start position can be
- found by:
-
- x = (01 * 256) + 04 = 260
- y = (00 * 256) + 95 = 95
-
-
- The remainder is taken up with the offset values for each of the sprite
- positions defined within this path. Note, if an offset value is greater than
- 127, treat it as a negative number. The way to calculate negatives is:
-
- if num > 127 then num = 256 - num
-
-
- All the above information, apart from the 11,22,33 and 44, is repeated for the
- whole nine paths. If any of these is empty, the "how many" value will be zero.
-
- To start using the program, first load your sprites. Non-STOS users will have
- to make do with the three I've included as part of the program. These are 8 by
- 8, 16 by 16 and 32 by 32 pixels respectively.
-
- You will now have to select which sprite to use. After choosing the SELECT
- SPRITE option, pressing the right mouse button will display the next sprite in
- the bank, while pressing the left button will display the previous one. To
- select a particualr sprite, make sure it is shown on the screen and press the
- return key.
-
- To define the path, click once on the DEFINE PATH option and the screen will
- clear. If a background picture has been loaded, and not turned off, it will now
- be displayed. The mouse pointer now changes into the image of the selected
- sprite and can be moved around the screen. To define a point press the left
- mouse button. Note, you cannot define another point in the same place as the
- last one.
-
- The top of the screen will show the current X and Y coordinates of the sprite
- along with how many points have been defined. Since trying to define a
- previously defined path would result in the original data being lost, you will
- have to press both mouse buttons at the same time when selecting the DEFINE
- option if the current path already contains data.
-
- Since large numbers are treated as being negative, don't try to move the sprite
- in large jumps across the screen. Around 10 pixels is most a sprite should move
- from one place to another, otherwise it will seem "jerky". When you've finished
- defining the path, press the right mouse button.
-
- Nine paths may not seem like very many, but few games have more. If you do need
- some extra ones though, try creating small ones and joining them together with
- the COPY X/Y to END option. It would be a simple matter to separate these when
- you load them into the game.
-
- ===========================================================================
-
- If any STOS users require the original Basic program, to either study or adapt
- to their own specific needs, please send a cheque for £2.00 (to cover postage,
- packing, cost of blank disc and wear & tear on a worn & torn disc drive), to:
-
- PHIL LAWSON
- 7, Eaglescliffe Close
- New Marske
- Redcar
- Cleveland
- TS11 8BB
-
- Please, do not include any other correspondance for the STOS column, since this
- must be addressed to the magazine. (We've got to keep those editors busy).
-