vidual relative sprites in the case of unified sprites; it is completely ignored, thus allowing the entire grouping to be scaled just by changing the scaling of the anchor3.

Batching

The standard SPRITE command normally has immediate effects to what is displayed on the screen. However, it is also possible to place NextBASIC into batching mode.

In this mode, SPRITE command has no immediate effect, but the changes specified are remembered. When all the required changes have been made using multiple SPRITE commands, they can all be applied to the screen at once, giving a more synchronised look to your game and fewer screen tears.

To control batching the following commands are available in the order one would use them:

SPRITE STOP

which enables batching mode and turns off the immediate sprite screen updates

SPRITE MOVE

This command sends all outstanding sprite changes to the hardware immediately (ergo displays all the animation effects and movement that was pending while in batching mode).

SPRITE MOVE INT

The same as above but waiting for the 50 Hz / 60 Hz interrupt to occur. This is useful in order to synchronise the sprite movement to the framerate (making for a smoother animation) and finally

SPRITE MOVE INT y

which works in the same way as SPRITE MOVE INT, except that changes are not sent to the hardware until after the TV scanline corresponding to sprite coordinate y. This avoids flicker by making sure that sprite changes do not happen on screen while the display is midway through displaying the current sprite(s). Finally

SPRITE RUN

disables batching mode and turns the immediate screen updates back on. This is also done by the SPRITE CLEAR command we saw earlier but without the destructive effects.

Automatic sprite movement

As we saw above, moving a sprite can be laborious. In order to reduce the amount of work a NextBASIC program needs to do to animate and move sprites, commands are provided to allow some or all of this work to be done automatically whenever a SPRITE MOVE command is issued. Any sprite can have automatic movement or animation applied to it, and the standard SPRITE command can still be used to perform any other changes when they are needed.

The main command used to set up automatic sprite movement is the SPRITE CONTINUE command:

SPRITE CONTINUE s, [x1 [TO x2]] [STEP xs] [RUN|STOP], [y1 [TO y2]] [STEP ys] [RUN|STOP], [p1 [TO p2]],[f], [r], [d]

Although looking somewhat daunting at first, SPRITE CONTINUE is quite easy to master regardless of its numerous options. As apparent by the brackets, each parameter (or sub-clause of a parameter) is optional. If not specified, the previous value will be retained.

Movement in the x-direction is specified with:

3 This scaling also applies to the relative x/y coordinate offsets


ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.