Product specifications

;address which contains sprite
CALL VSETOT ;0 pattern number
LD C,A ;Write pattern number to VRAM
CALL VDOUTP ;updating previous pattern
RET ;Return to calling routine
This routine may animate a sprite too quickly or perhaps too slowly, in which case the
speed of animation can be altered by changing the values contained in ALCREV and
ALCFS0. A larger value will give a slower speed and a smaller value will give a faster
speed. ALCREV and ALCFS0 must always be greater than one prior to calling the
routine.
Sprite Impact Detection Routine (Assembler)
The VDP chip contains a sprite coincidence flag. It is bit 6 in the read only register
(See Appendix B). Each time any two sprites coincide this bit is set, but it is not really
much use because:
1. It does not tell you which two sprites have coincided.
2. It may not necessarily detect on the sprite shape itself because it senses on
all of the pixels within the whole sprite block. Even those which are
transparent.
3. It detects sprites which are not actually on the display screen if the X/Y
coord values will cause overlap.
What is needed is a routine that will solve all of these problems, and this is described
below.
The routine makes some assumptions:
1. That any non displayed sprites have X/Y coords of 0,192 respectively
(see section 4.2 ‘Setting up the sprite attribute table’)
2. That the routine is to check for impact relative to a particular sprite. In this
case sprite 0, the first sprite within the sprite attribute table.
3. The routine will make use of the VDP I/O routines described in section 1.1.
An important point to note is that this routine can be used equally well with 8 times 8
bit sprites and 16 times 16 bit sprites. The value of OFFSET in the routine COMTSB is
a key variable.
^(Illus 10 – Diagram of OFFSET range – SIDR)
As can be seen from the diagram above OFFSET narrows down the pixel area under
which sprite impact is said to have occurred relative to the top left hand corner of the
sprite. By using larger values of OFFSET it is possible to provide proximity testing
prior to sprite impact because the routines below will then be looking at an area which
is larger than the actual area of the sprite pattern.