home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
351-375
/
apd375
/
progs
/
starfield.amos
/
starfield.amosSourceCode
Wrap
AMOS Source Code
|
1992-05-23
|
5KB
|
147 lines
'DATE: 02/02/92
'TIME: 22:48
'NAME: STARFIELD.AMOS
'CODE: UNCLE SIME
'NOTE: I BECAME VERY DEPRESSED BY THE EXAMPLES OF STARFIELDS THAT
' HAVE BEEN ON THIS AND OTHER AMOS PROG DISKS, SO I PUT THIS
' TOGETHER. IF YOU REALLY WANT THIS ROUTINE TO HUM THEN DUMP
' AMAL AND UPDATE THE STARS COORDINATES MANUALLY!
'THOUGHT FOR THE DAY: If You Can't Get Out Of It..Get Into It!
' Simple little procedure this one. If you want help drop a note to
' the address below. INCLUDE POSTAGE OR YOU WILL NOT GET A REPLY!
' The Address: Uncle Simes
' The Warehouse
' 118 Hiltingbury Rd,
' Chandlers Ford,
' Eastleigh,
' Hants.
' SO5 1NT
' * DATA SECTION - VARIABLES ETC *
' 1] Set the correct disk / directory path
' 2] Kill the system environment
' 3] Declare a 1D array called STARS$ with 28 elements
Dir$="SIMES_PROGS1:"
Close Workbench
Close Editor
Screen Close 0
Randomize Timer
Dim STARS$(27)
' * modULE LEVEL CODE*
' 1] Initialise the system
' 2] Do the do
' 4] End of prog
'
INITIALISE
MAIN
End
' * PROCEDURE LEVEL CODE *
Procedure MAIN
' The main procedure. First make the screen visible. Next display a
' rainbow by calling GROUND_RBOW procedure. Now animate the stars
' by succesive calls to the synchro command (AMOS manual page 202).
' Finally delete the rainbow, erase the sprite bank and close the
' work screen and return to module level code.
Screen Show 0
Autoback 1
GROUND_RBOW
Repeat
Synchro
Wait 1
Until Mouse Key=1
Rainbow Del
Erase 1
Screen Close 0
Dreg(0)=Execall(-138)
End Proc
Procedure INITIALISE
' This procedure initialises the system. Does the following......
' 1] Turn off synchro (AMOS manual page 202) this allows us to use
' more than 16 separate amal programs at once
' 2] Load the sprite bank
' 3] Set the sprite buffer (AMOS manual page 151)
' 4] Open screen and position it and set colours
' 5] call procedure stars to set amal strings
Dreg(0)=Execall(-132)
Synchro Off
Load Dir$+"SPRITES/STAR_SPRITE.ABK"
Set Sprite Buffer 16
Screen Open 0,320,70,2,Lowres
Screen Hide 0
SET_SCREEN
Double Buffer
Screen Display 0,128,170,320,70
For LOP=1 To 31
Colour LOP,$FFF
Next LOP
STARS
End Proc
Procedure STARS
Shared STARS$()
' CREDIT WHERE CREDIT IS DUE!
' ---------------------------
' The initial code that I used to create the starfield was done by Nick of
' Hanissis V in their 2nd demo. I changed the routine beacuse despite the
' claim that it was "The fastest, smoothest, multi layer, paralax,
' starfield ever done in AMOS!" IT DIDN'T WORK PROPERLY (grin, grin).
' If you have the demo grab the procedure STARFIELD and run it
' independantly and you will find that the stars start to vanish afer
' it has been running for a while, ok they do come back but it tends to
' spoil the effect a bit....... Hi Nick what happened to Hanissis V?
' This is the procedure that sets up the amal strings for each of the
' 28 stars (28 because we are going from 0 to 27). First I use a For
' loop to give each sprite (numbered from 8 to 35) an initial random
' starting position. The second For loop is then used to assign each
' sprite a speed, and an animation channel. Each sprite is then set to
' run the amal string and voila! NB: note the shared statement at the
' start of the procedure, this allows us to access the star array
' declared at the beginning of the program.
For STARS=0 To 27
Sprite STARS+8,128+Rnd(420),170+Rnd(70),1
Next STARS
For LOP=0 To 27
Read STAR_SPEED
Channel LOP+8 To Sprite LOP+8
STARS$(LOP)="Begin: Jump Loop; Main: Let X=1; Loop: Let X=X+"+Str$(STAR_SPEED)+"Pause;"
STARS$(LOP)=STARS$(LOP)+"If X<430 Jump Loop;Pause; Jump Main;"
Amal LOP+8,STARS$(LOP)
Wait Vbl
Next LOP
Data 4,5,6,8
Data 4,5,6,8
Data 4,5,6,8
Data 4,5,6,8
Data 4,5,6,8
Data 4,5,6,8
Data 4,5,6,8
Amal On
End Proc
Procedure SET_SCREEN
' Its that fimilar set the screen proc again
Flash Off
Curs Off
Hide On
Cls 0
End Proc
Procedure GROUND_RBOW
' Yeh old rainbow. Created using Spages rainbow warrior prog.
Set Rainbow 0,0,76,"","",""
Rainbow 0,0,241,76
Colour Back 0
Restore RDATA
For C=0 To 75
Read CVA
Rain(0,C)=CVA
Next C
View
RDATA:
Data $0,$6,$6,$6,$6,$7,$7,$7
Data $7,$8,$8,$8,$8,$9,$9,$9
Data $9,$A,$A,$A,$A,$B,$B,$B
Data $B,$11C,$11C,$11C,$11C,$22D,$22D,$22D
Data $22D,$33E,$33E,$33E,$44F,$44F,$44F,$44F
Data $55F,$55F,$55F,$55F,$66F,$66F,$66F,$66F
Data $77F,$77F,$77F,$77F,$88F,$88F,$88F,$88F
Data $99F,$99F,$99F,$99F,$AAF,$AAF,$AAF,$AAF
Data $BBF,$BBF,$BBF,$BBF,$CCF,$CCF,$CCF,$CCF
Data $DDF,$DDF,$DDF,$DDF,$EEF,$0,$0,$0
End Proc