home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
ST_PLUS
/
STP18.MSA
/
STP_INVAD_1B.STP
< prev
next >
Wrap
Text File
|
1997-06-30
|
3KB
|
47 lines
<PICLOAD>SPACE_2.DAJ
SPACE INVADERS TUTORIAL PT 1B
---------------------
BY CHRIS SWINSON
In bank 1 there is one sprite. This sprite is just a small block of colour 0.
Colour 0 is said to be see through. So drawing a sprite in colour 0 on the
screen will not be seen. If the sprite was drawn in colour 1 and colour 1 was
white ( $777 ) the sprite will be seen as a block of white. I had to use a
blank sprite as the move command will not work unless it sees a sprite in the
sprite bank. Not practical but for now it does the job.
Notice that during the game no such block is present. If the sprite was drawn
in white then you would see a block of white been moved around the top left of
the screen, Which is a bit silly having a block of white been moved on the
screen. So I hear you ask what has the invisible sprite got do do with moving
the aliens.
The aliens follow sprite 1. The sprite moves slowly to the right then moves
down a bit then moves back to the left. Alien 1 ( top left of the screen ) is
right next to the sprite. If the sprite was as position 16-16 then alien 1
would be at that same position. Alien 2 is the next one to the right of alien
1. Alien 2 adds 32 to the x position of alien 1. This makes the alien 32
pixels away from alien 1. Alien 3 adds 32 to the x position of alien 2. So
alien 1 would be 16 alien 2 would be 16+32 and alien 3 would be 16+32+32. So
as alien 1 moves the others have to follow. Each alien is 32 pixels away from
the one to its left. The same thing happens to the Y position of the aliens.
But instead of adding to the X pos it adds to the Y pos.
There is many ways to detect a collision between the lazer and the alien. One
example is to use the Collide instruction. But this can only be used for
sprites. As you can only have 16 sprites any way it would not make a very good
game. Another way would be to use the Zone command. But this is still not the
answer. The Zone command needs to be re-drawn lots of times every second which
takes up a lot of CPU time. Also you have to check the zone many times a
second else the lazer shot will fly past the alien without killing it. This
would be unreliable and slow down the game too much.
<PICSHOWD>000,000,272,187,048