How many times have you had a good
idea for a game but found that moving
large numbers of objects around the
screen has slowed everything down so
much that the whole thing is pointless?
Well, what you obviously need are some
sprites.
Sprites are picture elements that can
be made to move around the screen.
They are normally generated with the
aid of hardware but can also be formed
and moved by software. The Sprite-gen
program allows you to do just that in a
painless manner.
The cassette contains the sprite
generator program and two example
games that use ready-defined sprites.
Both games are listed in the 13-page
manual and I was impressed that such
effective games can be written in so few
statements.
The sprite generator itself is easy to
use. Sprites are defined on a 7 x 8 grid
and because the program uses mode 2
any of the BBC Micro's 16 colours may
be used. Larger objects can be defined
by linking a number of sprites in the user
program.
There are 32 sprites available
although numbers 0 to 7 are the main
ones. The rest are known as clones. A
clone normally takes on the design of its
associated sprite although this can be
altered.
An added degree of animation can
be included by careful use of the flashing
colours. The example called Chopper
Chase shows this admirably.
Any sprite can be simply placed in
any position by a line of Basic. It is
positioned by use of integer variables
assigned to that particular sprite. For
example, sprite 0 is allocated A% and
B%. Thus to position sprite 0 at
(640,512) you just key in:
100 A%=640:B%=512:
Z%=0:CALL&10A3
Z% contains the sprite number and
the CALL merely invokes the machine
code that displays the sprite. If A% or
B% is updated and sprite 0 displayed
again then the old image is deleted
automatically. A nice addition is that by
adding 256 to the sprite number that
sprite is removed from the screen.
On defining a sprite two images are
created, allowing smooth movement.
The second image can, however, be
defined to differ from the first allowing
another level of animation.
Sprite-gen is a very useful utility. The
examples are good to look at and fun
to play. DACC have even more
impressive demonstrations so it's very
versatile. A minor omission is that it
doesn't include a facility to detect when
one sprite hits another. But that is a
minor flaw in an otherwise impressive
package.