[i]VGAME [i]"3333333333333333399999999999999339333339933333933333333993333333333333399333333333333333333333333333333333333333333333333300333333333333330033333333333333333333333333333333333333333339933333333333333993333333393333399333339339999999999999933333333333333333" [i]STOP THE VIRUS 2020 V.5.2 Begin //ANIMATION VARS FOR GAME SETUP 162->BALLX 8->RADIUS 4->VECTOR 20->HEIGHT 0->CYCLES //OTHER 0->SCORE 0->STARTED //"PRESS ENTER" TEXT POS 2->X //create or open high score score appvar if there isn't one CloseAll Open("VGAMEHI","r+")->APP If APP=0 Open("VGAMEHI","w+"->APP Call ENCRYPT Write("Good for you to be enterprising and try to cheat a highscore! However, unless you are lucky youre high score will be reset if you attempt this :)",145,1,APP End //GET 3, 3 byte numbers from appvar data, store them into HSCORE, CHECKONE, and CHECKTWO Seek(0,0,APP Read(L2,3,1,APP ***{L2}->HSCORE Read(L3,3,1,APP ***{L3}->CHECKONE Read(L4,3,1,APP ***{L4}->CHECKTWO //check if real high score If CHECKONE!=(HSCORE*47)+243 or CHECKTWO!=(HSCORE*182)+79 0->HSCORE Call ENCRYPT ZeroScreen SetTextFGColor(224 PrintStringXY("NICE TRY, BUDDY! YOUR HIGHSCORE IS NOW RESET.",1,50 Pause 2000 End [i]TEXT BOUNCING X DIRECTION 2->DIR [i]SELECTED MENU OPTION 30->SELECTED Lbl HOMESCREEN getKey->K [i]MOVE CUSOR KEYPRESSES [i]DOWN If K=4 SELECTED-20->SELECTED End [i]UP If K=1 SELECTED+20->SELECTED End [i]WRAP MENU If SELECTED<30 70->SELECTED End If SELECTED>70 30->SELECTED End [i]SELECT OPTION KEYPRESSES If K=9 or K=54 If SELECTED=30 SetTextScale(1,1 SetTextFGColor(192 1->STARTED Goto SETUP End If SELECTED=50 Goto HELP End If SELECTED=70 Goto X End End [i]PREP SCRN SetDraw(1 FillScreen(0 [i]PREP TXT SetTextFGColor(5 SetTextScale(3,3 PrintStringXY("STOP THE VIRUS",10,1 SetTextXY(115,35 PrintInt(2020,4 [i]DISPLAY HSCORE SetTextScale(1,1 SetTextFGColor(224 PrintStringXY("HIGH:",137,90 SetTextXY(177,90 PrintInt(HSCORE,1 [i]MENU LINES SetColor(26 Line_NoClip(110,96+SELECTED,210,96+SELECTED Line_NoClip(110,110+SELECTED,210,110+SELECTED [i]MENU TEXT SetTextFGColor(5 If STARTED>0 PrintStringXY("RESUME",137,130 Else PrintStringXY("PLAY",145,130 End PrintStringXY("HELP",145,150 PrintStringXY("QUIT",145,170 //BOUNCING TEXT SetTextFGColor(26 SetTextScale(2,2 PrintStringXY("PRESS ENTER",X,220 SetTextScale(1,1 SetTextFGColor(26 PrintStringXY("V.5.1 By Randomguy",100,70 [i]TEXT BOUNCING MOVEMENT If X<2 2->DIR End If X=150 ~2->DIR End X+DIR->X SwapDraw Goto HOMESCREEN //draws and animates graphics for main game loop Lbl SETUP SwapDraw SetDraw(1 ZeroScreen //MAIN RECTS SetColor(26 //RECT AROUND EDGE OF SCREEN Rectangle_NoClip(1,1,319,239 //LEFT RECT Rectangle_NoClip(1,82,15,100 //RIGHT RECT Rectangle_NoClip(305,82,15,100 //VERTICAL RECTS CONNECTED TO THE SPIKES Rectangle_NoClip(150,15,20,HEIGHT+4 Rectangle_NoClip(150,245-HEIGHT,20,HEIGHT-5 //bottom spike SetColor(192 FillTriangle_NoClip(150,245-HEIGHT,170,245-HEIGHT,160,235-HEIGHT //TOP spike FillTriangle_NoClip(150,17+HEIGHT,170,17+HEIGHT,160,27+HEIGHT //CLOSE SPIKES If CYCLES>15 HEIGHT+1->HEIGHT 0->CYCLES End SetTextScale(1,1 SetTextFGColor(224 PrintStringXY("DEDICATED TO THE END OF 2020",60,5 SetColor(26 HorizLine_NoClip(1,15,319 //DISPLAY SCORES SetTextFGColor(26 PrintStringXY("HIGH:",45,20 PrintStringXY("SCORE:",215,20 SetTextFGColor(224 SetTextXY(85,20 PrintInt(HSCORE,2 SetTextXY(263,20 PrintInt(SCORE,2 getKey->K If K>0 Goto KEY End SetColor(3 FillCircle_NoClip(BALLX,132,RADIUS SetTextFGColor(0 SetTextXY(BALLX-7,129 PrintInt(19,2 //moving ball coordinates If BALLX>296 ~4->VECTOR End If BALLX<24 4->VECTOR End BALLX+VECTOR->BALLX //player dies if spikes touch ball If HEIGHT>95 and BALLX>=158 and BALLX<=162 Goto SCORING End //record number of loops to use in moving the spikes CYCLES+1->CYCLES Goto SETUP //examine keypressed, I made this label so that I wouldn't have to have all this code in the main loop because it would slow down the game considerably Lbl KEY //pause with 2nd If K=54 SetColor(192 SetTextScale(1,1 FillRectangle(120,37,80,25 SetColor(26 Rectangle(120,37,80,25 SetTextFGColor(0 PrintStringXY("PAUSED",136,46 SwapDraw //use L for keypressed because K is already used Repeat L>0 getKey->L End //clear quits, all other keys go back to game If L=15 Goto X Else Goto SETUP End End //quit with clear If K=15 Goto X End //mode pauses game and goes back to the homescreen If K=55 Goto HOMESCREEN End //if other key is pressed, then go to scoring Goto SCORING Lbl SCORING SetTextScale(2,2 //lose if spikes touch ball, even if ball is in center of screen If HEIGHT>95 and BALLX>=158 and BALLX<=162 SetTextFGColor(192 PrintStringXY("YOU LOST",110,120 0->SCORE End //win if ball is in center of screen and not touching spikes If BALLX>=158 and BALLX<=165 and HEIGHT<95 SetTextFGColor(26 PrintStringXY("YOU WON",110,120 SCORE+1->SCORE 20->HEIGHT Else SetTextFGColor(192 PrintStringXY("YOU LOST",110,120 If SCORE>HSCORE Call ENCRYPT End 0->SCORE 20->HEIGHT End SwapDraw //WAIT FOR KEYPRESS OR AUTOMATICALLY EXIT after certain length of time 0->A Repeat K>0 getKey->K A+1->A If A>500000 Goto X End End //clear force quits, otherwise go to setup If K=15 Goto X Else 20->HEIGHT Goto SETUP End //text describing controls, objective, and credits Lbl HELP SetDraw(1 ZeroScreen SetTextFGColor(224 SetTextScale(1,1 PrintStringXY("CONTROLS:",130,20 SetTextFGColor(26 PrintStringXY("ARROWS TO NAVIGATE MENU",83,35 PrintStringXY("2nd OR ENTER TO SELECT",88,50 PrintStringXY("CLEAR TO FORCE QUIT",98,65 PrintStringXY("MODE TO RETURN TO MENU",89,80 PrintStringXY("PRESS ANY OTHER KEY TO STOP THE BALL",40,95 SetTextFGColor(224 PrintStringXY("OBJECTIVE",130,115 SetTextFGColor(26 PrintStringXY("THE GOAL OF THIS GAME IS TO STOP THE BOUNCING",1,130 PrintStringXY("BALL (VIRUS) DIRECTLY BETWEEN THE SPIKES",16,145 PrintStringXY("BEFORE THEY CLAMP TOGETHER. HAVE FUN!",31,160 SetTextFGColor(224 PrintStringXY("CREDITS",138,175 SetTextFGColor(26 PrintStringXY("PT, FOR CREATING ICE",93,190 PrintStringXY("FREDERIC, FOR HELP WITH APPVARS",50,205 PrintStringXY("JACOBLY, FOR HELP WITH POINTERS",50,220 SwapDraw //wait for keypress Repeat K>0 getKey->K End //clear force quits If K=15 Goto X Else Goto HOMESCREEN //apply various functions to the highscore and write the results to the appvar as a sort of low level encryption Lbl ENCRYPT SCORE->HSCORE Seek(0,0,APP Write(^^oHSCORE,3,1,APP (HSCORE*47)+243->A Write(^^oA,3,1,APP (HSCORE*182)+79->A Write(^^oA,3,1,APP //return to scoring Return //archive appvar, return to normal graphics mode, and exit game Lbl X SetArchiveStatus(1,APP det(1