'ProgramMode:RUN ' Triangle Field CPC#26 v0.95 ' for C.Basic ' (c) 2020 sentaro21 ' '#CBINT '#_Mat _1 RefrshCtrl 1 Wait 0 ClrMat {10,100}->Dim Mat S:' Hi-Score data For 1->m To 10 For 1->n To 50 9999->S[m,n] Next Next Gosub L:' Load Hi-Score Plot/Line-Color White 0->A~Z 0->a~z 384/2->G:' X center 60->H:' Y canter 0->M:'game Mode 0:Lap 1:Score 9->N N->Dim D:' Y distance N->Dim R:' X distance N->Dim W:' Gate width 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 (-)10000+A6->A7 Ticks->t 0-> ' '---main game loop Lbl 1 _ClrVram RGB(#C2)_Rectangle -40,H,400,-90,0,0,1,,(-)Theta,G,H RGB(#C3) F/100->Theta For 1->I To N D[I]>1=>Goto 2 E+50->D[I] d-25->d d<1000=>1000->d Isz z z>=120=>1->z p=>(RanInt#((-)L,L)/2->R[I] Goto 2 z<14=>(List 2[z]*(A3/70))->R[I] Goto 2 z<17=>0->R[I] Goto 2 z<27=>(List 1[z-16]*(d/95))->R[I] Goto 2 z<30=>0->R[I] Goto 2 z<48=>(List 3[z-29]*(A3/30))->R[I] Goto 2 z<61=>0->R[I] Goto 2 z=61=>RanInt#((-)d,d)->h z<74=>((-)List 2[z-60]*(A3/70))->R[I] Goto 2 z<77=>0->R[I] Goto 2 z<87=>((-)List 1[z-76]*(d/95))->R[I] Goto 2 z<90=>b->R[I] Goto 2 z<108=>((-)List 3[z-89]*(A3/30))->R[I] Goto 2 0->R[I] Lbl 2 D[I]->A R[I]->B R/20->r R<10=>Goto 3 A>(r+1)=>Goto 3 T>(-)2000=>Goto 3 O=>Goto 5 x-B->a d+U->c Switch M Case 0 Abs aS-1->S Goto 5 Abs a>c=>Goto 5 Break Case 1 Abs aS+(((R/10)*(9000-d))/(2000+(500*(p>0->S Goto 5 Abs a>c=>S-((Abs a-c)/(50-(25*(p>0->S Goto 5 SwitchEnd Abs (a-c->b bGoto 4 Abs (a+c->b b>=U=>Goto 5 Lbl 4 w+((R*b)/U->w w<=0=>0->w w>500=>500->w R-w->R:R<(-)100=>(-)100->R M=>D-w->D D<=0=>(-)1->D Lbl 3 A->b B-x->a G+((a-d)/b->u u-(U/b->X1 u->X2:u->X3 H+((y+(16000+A6))/b->v v-(V/b->Y3 v->Y1:v->Y2 A_Polygon &Mat X,&Mat Y,3,1,,(-)Theta,G,H G+((a+d)/b->u u+(U/b->X1 u->X2:u->X3 A_Polygon &Mat X,&Mat Y,3,1,,(-)Theta,G,H Lbl 5 A-r->D[I] Next g=0=>R>B3=>R-(B4*2->R R+B4->R R>B8=>B8->R F>0=>F-B7->F F<0=>F+B7->F Abs F>=B7=>x+F->x y+T->y yA7->y T>(-)2000=>T-200->T BatteryStatus M=0=>Text -24,18,Sprintf("Best-Lap %d",%S[m,j),O: M=0=>Text -24,252,Sprintf("Lap %d",%C),O: O=0=>M=0=>Text 0,180,Sprintf("%d",%S),O: M=>Text -24,18,Sprintf("Hi-Score %d",%S[m,j]),O: M=>Text -24,240,Sprintf("Score %d",%S),O: If O=0 D/10->a M=>O=0=>Green _Rectangle 192-a,8,192+a,11,0,0,1 w/4->a a=>Red _Rectangle 192-a,26,192+a,29,0,0,1 (R-B3)/3->a a>3=>Cyan _Rectangle 192-a,20,192+a,23,0,0,1 If M S>S[m,j]=>S->S[m,j] If D<0 _DispVram TicksWait 128 0->D 50->R 0->Theta 0->F 30->O:'game over IfEnd Else If (S=0) Or (R<=B7 _DispVram M=>TicksWait 64 TicksWait 64 0->D 50->R 0->Theta 0->F 30->O:'game over S=0=>CC->S[m,j] IfEnd IfEnd KeyRow(8)->A KeyRow(7)->B y>A6=>A&(-)3->A If A&4 F-B2->F R>B3=>R-(B4*2->R ElseIf B&2 F+B2->F R>B3=>R-(B4*2->R IfEnd F<(-)B1=>(-)B1->F F>B1=>B1->F If B&64 If D>10 1500->T D-10->D IfEnd IfEnd A&32=>1->g If A&64 R-B5->R R<0=>(-)1->D 0->g IfEnd ElseIf O=2 Back-Color #C2 Yellow Text 14,164,"Ready" M=0=>Yellow Text 100,110,"Target Lap "+ToStr(B9),O TicksWait 128 Text 14,164,"Go Char!Char!Char! " TicksWait 64 Back-Color #C1 0->O Else 1400->f x>0=>x-100->x x<0=>x+100->x White Text 4,88,"Triangle Field v0.95",O: If O>5 If M=0 And S=0 And C<=B9 Green Text 34,88,"****CongratulationChar!****",O: Else Text 34,100,"--- Game Over ---",O: IfEnd O=30=>_DispVramTicksWait 128 IfEnd Text 64,00,"[SHIFT]:Brake",O,MB: Text 80,00,"[OPTN]:Turbo",O,MB: Text 100,78,Sprintf("Level select[_#E692_][_#E693_]:%d",m),O: Text 120,78,Sprintf("Gate select[_#E690_][_#E691_]:%d",n),O: p=0=>Text 120,278,"Fixed",O: p=>Text 120,278,Sprintf("Random%d",p),O: Text 150,60," Hit [F1] key to Start",O: Text 174,60," Hit [F3] key to Save Hi-Score",O: Getkey->A O>15=>0->A If A<>k Switch A Case 79:'F1 Gosub F Gosub M Gosub P Gosub I 2->O Break Case 28:'UP If m<=2 m+1->m Else M=>S[m,j]>=10000=>m+(m<5)->m M=0=>S[m,j]<=B9=>m+(m<5)->m IfEnd Gosub M Gosub F Break Case 37:'DW m-(m>1)->m Gosub M Gosub F R>B3=>B3->R Break Case 27:'RIGHT n+(n<5)->n Gosub P Break Case 38:'LEFT n-(n>1)->n Gosub P Break Case 39:'F5 A6>(-)2500=>A6-500->A6 Break Case 29:'F6 A6<5000=>A6+500->A6 Break Case 48:'MENU 1-M->M 0->S Break Case 59:'F3 Gosub S:' Save Hi-Score Break Case 47:'EXIT Back-Color White Black If PopUpWin(10,"EXIT?") Gosub S:' Save Hi-Score Screen.T Stop IfEnd Break Case 71:0->p:Break Case 72:1->p:Break Case 62:2->p:Break Case 52:3->p:Break Case 73:4->p:Break Case 63:5->p:Break Case 53:6->p:Break Case 74:7->p:Break Case 64:8->p:Break Case 54:9->p:Break SwitchEnd Back-Color RGB(#C1) IfEnd A->k n+(5*p)+(50*M)->j IfEnd O-(O>5)->O (-)10000+A6->A7 IfEnd w-(2*(w>0->w w<0=>0->w O=0=>Isz C If Ticks-t<=128 Isz Else ->s Ticks->t 0-> IfEnd Green Text 180,0,Sprintf("%d",s),O,M: _DispVram KeyRow(8) KeyRow(7) TicksWait (-)4 Goto 1 '---main game loop end ' ' initialize Lbl I 20->Dim List 1 20->Dim List 2 20->Dim List 3 12000->Z:(-)Z->y 20->P:40->Q 2400->E Intg (V/2->K Intg (W/2->L For 1->I To N I*(E/N)->D[I] 0->R[I] A3->W[I] Next Deg 0->A For 1->I To Dim List 1 #cos A%*100->B% B->List 1[I] A+180->A Next 0->A For 1->I To Dim List 2 #sin A%*100->B% B->List 2[I] A+90->A Next 10->A For 1->I To Dim List 3 #sin A%*100->B% B->List 3[I] A+40->A Next 1->J 0->Theta 0-> B6->D A3->d 0->x 0->S B7->R (-)2000->T 1800->f 0->w 0->q 1->h 0->z 0->C M=0=>60->S n+(5*p)+(50*M)->j 1->g Switch p Case 1:Ran#17:Break Case 2:Ran#2:Break Case 3:Ran#19:Break Case 4:Ran#24:Break Case 5:Ran#25:Break Case 6:Ran#34:Break Case 7:Ran#13:Break Case 8:Ran#8:Break Default :Ran#12:Break SwitchEnd Return ' initialize field Lbl F Switch m Case 1 +HSL(120,255,72)->C1:' field col +HSL(180,255,104)->C2:' upper col Break Case 2 +HSL(120,255,64)->C1:' field col +HSL(180,255,100)->C2:' upper col Break Case 3 +HSL(120,255,56)->C1:' field col +HSL(180,255,96)->C2:' upper col Break Case 4 +HSL(120,255,48)->C1:' field col +HSL(180,255,92)->C2:' upper col Break Case 5 +HSL(120,255,40)->C1:' field col +HSL(180,255,88)->C2:' upper col Break Case 6 +HSL(120,255,32)->C1:' field col +HSL(180,255,84)->C2:' upper col Break Case 7 +HSL(120,255,16)->C1:' field col +HSL(180,255,80)->C2:' upper col Break SwitchEnd +RGB(255,255,255)->C3:' gate col +HSV(179,255,252)->C4 Back-Color RGB(#C1) Return ' initialize 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 5000->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 initialize Lbl M Switch m Case 1 1200->B1:' handling1 160->B2:' handling2 40->B7:' handling3 200->B3:' Maxspeed 5->B4:' accell 10->B5:' brake 750->B6:' shield 1300->B9:' p=>1280->B9 Break Case 2 1500->B1:' handling1 200->B2:' handling2 50->B7:' handling3 266->B3:' Maxspeed 7->B4:' accell 15->B5:' brake 1000->B6:' shield 1000->B9:' p=>985->B9 Break Case 3 2000->B1:' handling1 256->B2:' handling2 64->B7:' handling3 332->B3:' Maxspeed 8->B4:' accell 15->B5:' brake 1000->B6:' shield 800->B9:' p=>770->B9 Break Case 4 2000->B1:' handling1 320->B2:' handling2 80->B7:' handling3 400->B3:' Maxspeed 10->B4:' accell 18->B5:' brake 1000->B6:' shield 675->B9:' p=>640->B9 Break Case 5 2000->B1:' handling1 400->B2:' handling2 100->B7:' handling3 500->B3:' Maxspeed 12->B4:' accell 20->B5:' brake 1000->B6:' shield 560->B9:' p=>520->B9 Break SwitchEnd B3*135/100->B8 Return ' ' Load Hi-Score Lbl L "TriField"->Str 1 If IsExist(Str 1) Load(Str 1)->Mat S IfEnd Return ' Save Hi-Score Lbl S Save Str 1,Mat S Return