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 >
Text File  |  1997-06-30  |  3KB  |  47 lines

  1. <PICLOAD>SPACE_2.DAJ
  2.  
  3.                          SPACE INVADERS TUTORIAL PT 1B 
  4.                              --------------------- 
  5.                                 BY CHRIS SWINSON 
  6.  
  7. In bank 1 there is one sprite.  This sprite is just a small block  of colour 0. 
  8. Colour  0 is said to be see through.  So drawing a  sprite in colour 0  on  the 
  9. screen will not be seen.  If the sprite  was drawn in colour 1 and colour 1 was 
  10. white  ( $777 ) the sprite  will be seen as a block of white.  I had to  use  a 
  11. blank sprite as  the move command will not work unless it sees a sprite in  the  
  12. sprite bank. Not practical but for now it does the job.
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. Notice that during the game no such block is present.  If the  sprite was drawn 
  20. in white then you would see a block of white  been moved around the top left of 
  21. the  screen,  Which is a bit  silly having a block of white been moved  on  the 
  22. screen.  So I  hear you ask what has the invisible sprite got do do with moving  
  23. the aliens.  
  24.  
  25. The  aliens follow sprite 1.  The sprite moves slowly to the right  then  moves 
  26. down a bit then moves back to the left.  Alien 1 ( top  left of the screen ) is 
  27. right  next to the sprite.  If the sprite  was as position 16-16 then  alien  1 
  28. would be at that same  position.  Alien 2 is the next one to the right of alien 
  29. 1.   Alien  2 adds 32 to the x position of alien 1.  This makes the   alien  32 
  30. pixels  away from alien 1.  Alien 3 adds 32 to the x  position of alien  2.  So 
  31. alien 1 would be 16 alien 2 would be  16+32 and alien 3 would be  16+32+32.  So 
  32. as alien 1 moves the  others have to follow.  Each alien is 32 pixels away from 
  33. the one  to its left.  The same thing happens to the Y position of the  aliens. 
  34. But instead of adding to the X pos it adds to the Y pos.
  35.  
  36. There is many ways to detect a collision between the lazer and  the alien.  One 
  37. example  is  to use the Collide instruction.  But  this can only  be  used  for 
  38. sprites. As you can only have 16  sprites any way it would not make a very good 
  39. game.  Another way  would be to use the Zone command. But this is still not the  
  40. answer. The Zone command needs to be re-drawn lots of times  every second which 
  41. takes  up  a lot of CPU time.  Also you have to  check the zone  many  times  a 
  42. second  else the lazer shot will fly  past the alien without killing  it.  This 
  43. would be unreliable and  slow down the game too much.   
  44.  
  45. <PICSHOWD>000,000,272,187,048                      
  46.  
  47.