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

  1. 'This example shows how you can use Cstars Bclear and Cstars Bdraw to
  2. 'make stars fly through graphics without corrupting them.  Here, I've
  3. 'used some circles as the graphic but remember that the graphic can be 
  4. '-*ANYTHING*-, a logo, scrolltext, high score table or whatever! 
  5. '
  6. 'This starfield is drawn 50 times/second, even if using a MC68000! 
  7. '
  8. Screen Open 0,320,200,16,Lowres : Flash Off : Curs Off : Cls 0 : Palette 0,$FFF
  9. Hide 
  10. '  
  11. 'Calculate palette!
  12. '
  13. For I=2 To 15
  14.    Colour I,256*I+16*I+I
  15. Next I
  16. '
  17. 'Draw some circles!
  18. '
  19. For I=1 To 50
  20.    Ink I mod 16
  21.    Circle 160,100,I
  22. Next I
  23. '
  24. Double Buffer : Autoback 0
  25. '
  26.  Extension_17_001C 200,False : Rem Reserve 200 single coloured stars! 
  27. '
  28. 'Set up initial positions of each star.
  29. '
  30. For I=1 To 200
  31.    Repeat 
  32.        Extension_17_003C I,Rnd(319),Rnd(199),-5+Rnd(10),-5+Rnd(10)
  33.    Until Extension_17_0174(I)<>0 or Extension_17_0188(I)<>0
  34. Next I
  35. '
  36. 'A simple loop to clear, draw and update the stars!
  37. '
  38. Repeat 
  39.     Extension_17_020E : Extension_17_0222 : Extension_17_0248 
  40.    Screen Swap : Wait Vbl 
  41. Until Mouse Key