'ProgramMode:RUN ' Triangle Field CPC#26 v0.91 ' for C.Basic ' (c) 2020 sentaro21 ' '#CBINT '#_Mat _1 RefrshCtrl 1 Wait 0 ClrMat {5,5}->Dim Mat S:' Hi-Score data "TRYFIELD"->Str 1 Gosub L:' Load Hi-Score 0->A~Z 0->a~z 384/2->G:' X center 60->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 Back-Color @Black 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 0-> '---main game loop Lbl 1 _ClrVram RGB(#C2)_Rectangle -40,H,423,-75,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 RGB(#C3) 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/100->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 BatteryStatus White Text -24,18,"Hi-Score:"+ToStr(S[m,n]),O: White Text -24,220,"Score:"+ToStr(S),O: If D<0 White Text 4,30,"Sheild",O,MB: White Text 22,30,"Damage",O,MB: Yellow :w>400=>Red w>1000=>1000->w w=>_Rectangle 100,26,100+(w/5),29,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 White Text 4,30,"Sheild",O,MB: Green If D<150 Red D<0=>0->D ElseIf D<400 Yellow IfEnd _Rectangle 100,8,100+(D/5),11,0,0,1 White Text 22,30,"Damage",O,MB: Yellow :w>400=>Red w>1000=>1000->w w=>_Rectangle 100,26,100+(w/5),29,0,0,1 D<=0=>_DispVramTicksWait 128 c-2->c c<0=>w-(w>0)->w ElseIf O=2 Back-Color #C2 Yellow Text 20,160,"Ready" TicksWait 128 White Text 20,160," GoChar!Char!Char! " TicksWait 64 Back-Color #C1 0->O Else 1400->f White Text 4,80," Trinangle Field v0.91",O: If O>5 White Text 34,80,"---Game Over ---",O: O=30=>_DispVramTicksWait 128 IfEnd White Text 64,00,"[SHIFT]:Brake",O,MB: White Text 80,00,"[OPTN]:Accel",O,MB: White Text 100,78,"Level select[_#E692_][_#E693_]:"+ToStr(m),O: White Text 120,78,"Gate select[_#E690_][_#E691_]:"+ToStr(n),O: White Text 150,60," Hit [F1] key to Start",O: White Text 174,60," 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 Back-Color White Black 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 180,0,Sprintf("%2dfps",s),O,M: _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 Switch m Case 1 +RGB(0,140,0)->C1:' field col +RGB(0,192,192)->C2:' upper col +RGB(255,255,255)->C3:' gate col Break Case 2 +RGB(0,128,0)->C1:' field col +RGB(0,160,192)->C2:' upper col +RGB(255,255,255)->C3:' gate col Break Case 3 +RGB(0,96,0)->C1:' field col +RGB(0,132,180)->C2:' upper col +RGB(255,255,255)->C3:' gate col Break Case 4 +RGB(0,64,0)->C1:' field col +RGB(0,100,160)->C2:' upper col +RGB(255,255,255)->C3:' gate col Break Case 5 +RGB(0,32,0)->C1:' field col +RGB(0,100,150)->C2:' upper col +RGB(255,255,255)->C3:' gate col Break SwitchEnd Back-Color RGB(#C1) 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*4/3->B1 B2*4/3->B2 B7*4/3->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