'ProgramMode:RUN ' Triangle Field CPC#26 v0.9 ' for C.Basic ' (c) 2020 sentaro21 ' '#CBINT '#_Mat _1 RefrshCtrl 1 Wait 0 ClrMat {5,5}->Dim Mat S:' Hi-Score data "TRYFLDFX"->Str 1 Gosub L:' Load Hi-Score 0->A~Z 0->a~z 128/2->G:' X center 20->H:' Y canter 9->N N->Dim D:' Y distance N->Dim R:' X distance N->Dim C:' type 3->Dim X 3->Dim Y 9->Dim A 9->Dim B 1->m:' gate mode 1->n:' machine mode '--Start ScreenG 0->S:' score 100->R ' 1->O:' demo 1->J Gosub F:' field select Gosub P:' gate select Gosub M:' machine select Gosub I:' gate init B6->D:' damage -1500->A6:' view angle Ticks->t '---main game loop Lbl 1 _ClrVram _Rectangle -13,H,141,H+1,0,0,1,,(-)Theta,G,H For 1->I To N D[I]>1=>Goto 2 E+50->D[I] (RanInt#(1,W)-L)/2->R[I] d-50->d d<1000=>1000->d Lbl 2 D[I]->A R[I]->B B-x->a G+((a-d)/A->u G+(((a-d)-U)/A->p H+((y+(16000+A6))/A->v v-(V/A->q p->X1:v->Y1 u->X2:v->Y2 u->X3:q->Y3 A_Polygon &Mat X,&Mat Y,3,1,,(-)Theta,G,H G+((a+d)/A->u G+(((a+d)+U)/A->p p->X1 u->X2 u->X3 A_Polygon &Mat X,&Mat Y,3,1,,(-)Theta,G,H R/20->r If (O=0) And ((A<=(r+3)) And (T<=(-)2000)) x-B->a Abs aS+(((R/10)*(9000-d))/2000)->SGoto 4 Abs a>(d+e)=>S-((Abs a-(d+e))/400->SGoto 4 Abs (a-(d+e))->b If bw w<=0=>5->w R-w->R:R<(-)100=>(-)100->R D-w->D 60->c Goto 3 IfEnd Abs (a+(d+e))->c If cw w<=0=>5->w R-w->R:R<(-)100=>(-)100->R D-w->D 60->c IfEnd Lbl 4 S>S[m,n]=>S->S[m,n] IfEnd Lbl 3 A-r->D[I] ' A<1_=>_E+A_->_D[I] Next If O=0 KeyRow(8)->A KeyRow(7)->B y>A6=>A&(-)3->A IfEnd R+B4->R 'R>0_=>_R-0(O=0)_->_R R>B3=>B3->R F/50->Theta Theta>15=>15->Theta Theta<-15=>-15->Theta x+F->x If (A&7+B&7)=0 F>0=>F-B7->F F<0=>F+B7->F IfEnd y+T->y y<((-)10000+A6)=>((-)10000+A6)->y T>(-)2000=>T-200->T Text 1,1,"Hi-Score:"+ToStr(S[m,n]),O: Text 1,84,"Score:"+ToStr(S),O: If D<0 Text 7,8,"Sheild",O: Text 13,8,"Damage",O: w>400=>Red w>1000=>1000->w w=>_Rectangle 33,9,33+(w/15),10,0,0,1 _DispVram TicksWait 128 0->D 50->R 0->Theta 0->F 30->O:'game over IfEnd If O=0 A&4=>F>(-)B1=>F-B2->F B&2=>FF+B2->F If B&64 If D>10 1500->T D-10->D IfEnd IfEnd A&32=>R<1000=>R+B4->R A&64=>R>20=>R-B5->R Text 7,8,"Sheild",O: _Rectangle 33,7,33+(D/15),8,0,0,1 Text 13,8,"Damage",O: w>400=>Red w>1000=>1000->w w=>_Rectangle 33,13,33+(w/15),14,0,0,1 D<=0=>_DispVramTicksWait 128 c-2->c c<0=>w-(w>0)->w ElseIf O=2 Text 7,53,"Ready" TicksWait 128 Text 7,53," GoChar!Char!Char! " TicksWait 64 0->O Else 1400->f Text 8,26," Trinangle Field v0.91",O: If O>5 Text 14,26,"---Game Over ---",O: O=30=>_DispVramTicksWait 128 IfEnd Text 23,1,"[SHIFT]:Brake",O: Text 29,1,"[OPTN]:Accel",O: Text 37,26,"Level select[_#E692_][_#E693_]:"+ToStr(m),O: Text 43,26,"Gate select[_#E690_][_#E691_]:"+ToStr(n),O: Text 52,10," Hit [F1] key to Start",O: Text 58,10," Hit [F3] key to Save Hi-Score",O: Getkey->A O>5=>0->A If A<>k If A=79 Gosub F Gosub M Gosub P Gosub I 2->O B6->D A3->d 0->x 0->S 0->R (-)2000->T 1800->f 0->w Ran#3 ElseIf A=28 m+(m<5)->m Gosub M Gosub F ElseIf A=37 m-(m>1)->m Gosub M Gosub F ElseIf A=27 n+(n<5)->n Gosub P ElseIf A=38 n-(n>1)->n Gosub P ElseIf A=39 A6>(-)2500=>A6-500->A6 ElseIf A=29 A6<5000=>A6+500->A6 ElseIf A=59 Gosub S:' Save Hi-Score ElseIf A=47 Gosub S:' Save Hi-Score Screen.T Stop IfEnd A->k IfEnd O-(O>5)->O IfEnd If Ticks-t<128 Isz Else ->s Ticks->t 0-> IfEnd Green Text 58,0,Sprintf("%2d",s),O: _DispVram TicksWait (-)4 Goto 1 ' ' intialize Lbl I U/2->e 12000->Z:(-)Z->y 20->P:40->Q 2000->E Intg (V/2->K Intg (W/2->L 1->I I*(E/N)->D[I] 0->R[I] For 2->I To N I*(E/N)->D[I] R[I-1]+RanInt#(1,A5)-A5/2->R[I] Next 1->J 0->Theta 0-> Return ' intialize field Lbl F Return ' intialize gate Lbl P Switch n Case 1 4000->A1:' gate width 8000->A2:' gate height 8000->A3:' gate holizontal interval Break Case 2 6000->A1:' gate width 8000->A2:' gate height 8000->A3:' gate holizontal interval Break Case 3 9000->A1:' gate width 8000->A2:' gate height 8000->A3:' gate holizontal interval Break Case 4 13500->A1:' gate width 8000->A2:' gate height 8000->A3:' gate holizontal interval Break Case 5 13500->A1:' gate width 8000->A2:' gate height 4000->A3:' gate holizontal interval Break SwitchEnd 32000->A4:' rand 10000->A5:' rand2 A1->U:' gate width A2->V:' gate height A3->d:' gate H interval A4->W A4/2->L Return ' ' machine nintialize Lbl M Switch m Case 1 1000->B1:' handling1 125->B2:' handling2 60->B7:' handling3 200->B3:' Maxspeed 5->B4:' accell 10->B5:' brake 750->B6:' strong Break Case 2 1500->B1:' handling1 180->B2:' handling2 50->B7:' handling3 300->B3:' Maxspeed 7->B4:' accell 15->B5:' brake 1000->B6:' strong Break Case 3 2000->B1:' handling1 200->B2:' handling2 50->B7:' handling3 350->B3:' Maxspeed 8->B4:' accell 17->B5:' brake 1000->B6:' strong Break Case 4 2000->B1:' handling1 250->B2:' handling2 70->B7:' handling3 400->B3:' Maxspeed 9->B4:' accell 20->B5:' brake 1000->B6:' strong Break Case 5 2000->B1:' handling1 300->B2:' handling2 80->B7:' handling3 500->B3:' Maxspeed 10->B4:' accell 25->B5:' brake 1000->B6:' strong Break SwitchEnd B1/2->B1 B2/2->B2 B7/2->B7 Return ' ' Load Hi-Score Lbl L If IsExist(Str 1) Load(Str 1)->Mat S IfEnd Return ' Save Hi-Score Lbl S Save Str 1,Mat S Return