home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 5 / amigaformatcd05.iso / readerstuff / richard_thompson / cool_stars! / examples / parallax.amos / parallax.amosSourceCode
Encoding:
AMOS Source Code  |  1996-08-13  |  1.0 KB  |  30 lines

  1. 'This example demonstrates how you can set up a multicoloured starfield. 
  2. 'In this example, stars that are flying faster are given brighter colours. 
  3. 'Stars which are flying slower are given darker colours.  This gives a 
  4. 'rather cool parallax effect!  This example requires the registered version
  5. 'of Cool Stars! to run!  
  6. '
  7. 'This starfield is drawn 50 times/second, even if using a MC68000! 
  8. '
  9. Screen Open 0,320,150,4,Lowres : Flash Off : Curs Off : Cls 0
  10. Palette 0,$FFF,$BBB,$777 : Screen Display 0,,75,,
  11. Double Buffer : Autoback 0 : Hide 
  12. '
  13.  Extension_17_001C 130,True : Rem Reserve 130 multicoloured stars! 
  14. '
  15. 'Set up initial positions of each star.
  16. '
  17. For I=1 To 130
  18.    SPD=1+Rnd(4)
  19.     Extension_17_003C I,Rnd(319),Rnd(149),SPD,0
  20.    If SPD=1 or SPD=2 : Extension_17_0092 I,3 : End If 
  21.    If SPD=3 or SPD=4 : Extension_17_0092 I,2 : End If 
  22.    If SPD=5 : Extension_17_0092 I,1 : End If 
  23. Next I
  24. '
  25. 'A simple loop to clear, draw and update the stars!
  26. '
  27. Repeat 
  28.     Extension_17_01D8 : Extension_17_01EA : Extension_17_0248 
  29.    Screen Swap : Wait Vbl 
  30. Until Mouse Key