home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-08-13 | 1.9 KB | 52 lines |
- 'This example sets up a single coloured starfield and demonstates how to
- 'change the direction of stars. Also, the example shows how easy it is to
- 'put your starfields on interrupt with the Every command. Maybe in the next
- 'version of Cool Stars! I'll add a command to allow stars to run under
- 'interrupt control without using AMOS Pro's Every command, providing enough
- 'people show interest in Cool Stars! by registering!!
- '
- 'This starfield is drawn 50 times/second, even if using a MC68000!
- '
- Screen Open 0,320,200,2,Lowres : Curs Off : Palette 0,$FFF
- Double Buffer : Autoback 0 : Hide
- Screen Open 1,640,8,2,Hires : Curs Off : Palette 0,$FFF
- '
- Screen 0 : Extension_17_001C 200,False : Rem Reserve 200 single coloured stars!
- '
- 'Set up initial positions of each star.
- '
- For I=1 To 200
- Extension_17_003C I,Rnd(319),Rnd(199),1+Rnd(5),0
- Next I
- '
- Every 1 Gosub STARS_INT : Screen 1
- Centre "These stars are running under interrupt control!"
- While COUNT<200 : Wend
- Cls 0 : Centre "Here we use 'Cstars X Rev', to make the stars fly to the left!"
- Every Off : Extension_17_00AC : Every On : While COUNT<400 : Wend
- Cls 0 : Centre "Now we'll make the stars fly upwards!"
- Every Off
- For I=1 To 200
- Extension_17_0078 I, Extension_17_0174(I) : Extension_17_005E I,0
- Next I
- Every On : While COUNT<600 : Wend
- Cls 0 : Centre "Here we use 'Cstars Y Rev', to make the stars fly downwards!"
- Every Off : Extension_17_00D2 : Every On : While COUNT<800 : Wend
- Cls 0 : Centre "Now the stars go all over the place! Any mouse key to exit!"
- Every Off
- For I=1 To 200
- Repeat
- Extension_17_005E I,-5+Rnd(10) : Extension_17_0078 I,-5+Rnd(10)
- Until Extension_17_0174(I)<>0 or Extension_17_0188(I)<>0
- Next I
- Every On
- Repeat : Until Mouse Key
- End
- '
- 'The interrupt routine to clear, draw and update the stars!
- '
- STARS_INT:
- Extension_17_01D8 : Extension_17_01EA : Extension_17_0248
- Screen Swap
- Every On : Inc COUNT
- Return