home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-02-26 | 3.3 KB | 90 lines |
- Rem ------------------------------------------------------------------------
- Rem -- Astro Smash Coding: Eric Askilsrud (Redlense@u.washington.edu) --
- Rem -- A <10k program written with Amos 1.3, Jun 1992 --
- Rem - See accompanying file for tutorial on this game's creation. --
- Rem ------------------------------------------------------------------------
- Dim XDIR#(1),YDIR#(1),X#(1),Y#(1),LK(1),I(1),AX#(16),AY#(16)
- Default
- Flash Off : Hide : Curs Off : Paper 0 : Degree
- For ANGLE=0 To 15
- AX#(ANGLE+1)=0.5*Sin(ANGLE*22.5)
- AY#(ANGLE+1)=-0.5*Cos(ANGLE*22.5)
- Next
- Make Mask
- While QUIT=0
- TYPE=0 : For Z=0 To 1 : XDIR#(Z)=0.0 : YDIR#(Z)=0.0 : Next
- X#(1)=10.0 : Y#(1)=10.0 : I(1)=7 : X#(0)=300.0 : Y#(0)=180.0 : I(0)=15
- INGAME=0 : Cls
- Locate ,2 : Centre "Astro Smash"
- Locate ,4 : Centre "(Written in Amos 1.3)"
- Locate ,8 : Centre "1) Reflective Walls "
- Locate ,10 : Centre "2) Warp Space"
- Locate ,13 : Centre "Q) Quit"
- While TYPE=0 : A$=Inkey$ : If A$="1" Then TYPE=1
- If A$="2" Then TYPE=2
- If Upper$(A$)="Q"
- Erase 1
- Run "Autoexec.Amos"
- End
- End If
- Wend
- Cls : If TYPE=1 Then Box 0,0 To 319,199
- While INGAME=0
- For P=0 To 1
- K=Joy(P)
- If K>15 Then K=K-16 : XDIR#(P)=XDIR#(P)+AX#(I(P)) : YDIR#(P)=YDIR#(P)+AY#(I(P)) : Gosub CHSPEED
- If K=8 Then If Chanan(P)=0 Then I(P)=I(P)+1 : Gosub CHLOOP : Amal P*4,"A2,("+Str$(I(P))+",1)" : Amal On P*4
- If K=4 Then If Chanan(P)=0 Then I(P)=I(P)-1 : Gosub CHLOOP : Amal P*4,"A2,("+Str$(I(P))+",1)" : Amal On P*4
- If K=1 and LK(P)<>K Then Gosub BULLET
- On TYPE Gosub BOUNCE,WARP
- X#(P)=XDIR#(P)+X#(P) : Y#(P)=YDIR#(P)+Y#(P)
- Sprite P*4,X Hard(X#(P)),Y Hard(Y#(P)),I(P)
- Gosub CHECKBULLS
- LK(P)=K
- If Sprite Col(P*4)<>0 Then Boom : Sprite P*4,X Hard(X#(P)),Y Hard(Y#(P)),18 : INGAME=1 : Amal Off
- Next
- Wait Vbl
- Wend
- For Z=0 To 1
- If Sprite Col(Z*4)<>0 Then Sprite Z*4,X Hard(X#(Z)),Y Hard(Y#(Z)),18
- Next
- Sprite Update : Wait Vbl : Locate ,11 : Centre "Game Over" : Wait 40 : While Joy(1)<16 : Wend
- For Z=0 To 7 : Sprite Off Z : Next : Sprite Update
- Wend
- End
- CHLOOP:
- If I(P)>16 Then I(P)=1
- If I(P)<1 Then I(P)=16
- Return
- CHSPEED:
- If XDIR#(P)>4.0 Then XDIR#(P)=4.0
- If XDIR#(P)<-4.0 Then XDIR#(P)=-4.0
- If YDIR#(P)>4.0 Then YDIR#(P)=4.0
- If YDIR#(P)<-4.0 Then YDIR#(P)=-4.0
- Return
- BOUNCE:
- If X#(P)>304.0 Then X#=304.0 : XDIR#(P)=0.0-XDIR#(P) : Bell 1
- If X#(P)<-3.0 Then X#=-3.0 : XDIR#(P)=0.0-XDIR#(P) : Bell 1
- If Y#(P)>184.0 Then Y#=184.0 : YDIR#(P)=0.0-YDIR#(P) : Bell 1
- If Y#(P)<-2.0 Then Y#=-2.0 : YDIR#(P)=0.0-YDIR#(P) : Bell 1
- Return
- WARP:
- If X#(P)>304.0 Then X#(P)=0.0
- If X#(P)<0.0 Then X#(P)=304.0
- If Y#(P)>184.0 Then Y#(P)=0.0
- If Y#(P)<0.0 Then Y#(P)=184.0
- Return
- BULLET:
- Q=0
- If P=0 Then For Z=1 To 3 : If Chanmv(Z)=0 Then Q=Z : Next
- If P=1 Then For Z=5 To 7 : If Chanmv(Z)=0 Then Q=Z : Next
- If Q=0 Then Return
- Shoot
- Sprite Q,X Hard(X#(P)+7)+30*AX#(I(P)),Y Hard(Y#(P)+8)+30*AY#(I(P)),17
- Amal Q,"M "+Str$(Int(300*AX#(I(P))))+","+Str$(Int(300*AY#(I(P))))+",50" : Amal On Q
- Return
- CHECKBULLS:
- For Z=1 To 7
- If Z<>4 and Chanmv(Z)=0 Then Sprite Off Z
- Next
- Return