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

  1. 'This example sets up a single coloured starfield and demonstates how to 
  2. 'change the direction of stars.  Also, the example shows how easy it is to 
  3. 'put your starfields on interrupt with the Every command.  Maybe in the next 
  4. 'version of Cool Stars! I'll add a command to allow stars to run under 
  5. 'interrupt control without using AMOS Pro's Every command, providing enough  
  6. 'people show interest in Cool Stars! by registering!!
  7. '
  8. 'This starfield is drawn 50 times/second, even if using a MC68000! 
  9. '
  10. Screen Open 0,320,200,2,Lowres : Curs Off : Palette 0,$FFF
  11. Double Buffer : Autoback 0 : Hide 
  12. Screen Open 1,640,8,2,Hires : Curs Off : Palette 0,$FFF
  13. '
  14. Screen 0 : Extension_17_001C 200,False : Rem Reserve 200 single coloured stars! 
  15. '
  16. 'Set up initial positions of each star.
  17. '
  18. For I=1 To 200
  19.     Extension_17_003C I,Rnd(319),Rnd(199),1+Rnd(5),0
  20. Next I
  21. '
  22. Every 1 Gosub STARS_INT : Screen 1
  23. Centre "These stars are running under interrupt control!"
  24. While COUNT<200 : Wend 
  25. Cls 0 : Centre "Here we use 'Cstars X Rev', to make the stars fly to the left!"
  26. Every Off : Extension_17_00AC : Every On : While COUNT<400 : Wend 
  27. Cls 0 : Centre "Now we'll make the stars fly upwards!"
  28. Every Off 
  29. For I=1 To 200
  30.     Extension_17_0078 I, Extension_17_0174(I) : Extension_17_005E I,0
  31. Next I
  32. Every On : While COUNT<600 : Wend 
  33. Cls 0 : Centre "Here we use 'Cstars Y Rev', to make the stars fly downwards!"
  34. Every Off : Extension_17_00D2 : Every On : While COUNT<800 : Wend 
  35. Cls 0 : Centre "Now the stars go all over the place!  Any mouse key to exit!"
  36. Every Off 
  37. For I=1 To 200
  38.    Repeat 
  39.        Extension_17_005E I,-5+Rnd(10) : Extension_17_0078 I,-5+Rnd(10)
  40.    Until Extension_17_0174(I)<>0 or Extension_17_0188(I)<>0
  41. Next I
  42. Every On 
  43. Repeat : Until Mouse Key
  44. End 
  45. '
  46. 'The interrupt routine to clear, draw and update the stars!  
  47. '
  48. STARS_INT:
  49.  Extension_17_01D8 : Extension_17_01EA : Extension_17_0248 
  50. Screen Swap 
  51. Every On : Inc COUNT
  52. Return