
American Embassy School Grade 12 student Ricky developed the “Fly Escape” game in Terrapin Logo. Fly Escape turns the Logo turtle into a fly that needs to make its way through a maze of ever changing flypaper. Guide the fly using the keyboard and see how long you can avoid the trap.
For his project, Ricky describes the Fly Escape project and how he developed and tested it.
Game Description In Fly Escape, you have to keep the fly that is your character alive for as long as possible. It is a single player game, and the player controls the upward motion of the fly. The length of time your fly lives will be the score. When the game begins, it goes to full screen mode and displays a screen with “FLY ESCAPE” in big letters in the center, and below that, in smaller letters, the rules and controls, followed by “x to continue.” When the user presses 'x' the game should begin, causing the background to be silver with a black flypaper (which should be strips of random lengths) on the top and bottom of the screen scrolling to the left, where the fly, a black dot with flapping wings, starts. In the bottom right hand corner the score will appear. The fly should be moved up with the 'w' key, to the left with the 'a' and to the right with the 'd' key. When the fly touches the black fly-paper, the game is over. When the game ends, a screen will appear with a lose message. It will display the score, and ask if you want to play again. If the player says 'y' then the game restarts. If the player says 'n', then the game clears. This game will require inputs at the beginning, or x, and the gameplay will use inputs of w, a, and d, and when it exits, 2 inputs will need to be present, y, and n. These inputs can be taken with the RC and IF commands.
Goal To navigate the fly for as long as possible through the fly paper lining the walls. The length of time the fly is alive is your score.
Interface A screen appears with FLY ESCAPE in big text in the center of the screen, and a quick version of the rules under it in smaller text, followed by “x to continue.” When x is pressed, the fly appears on the left side of the screen in the center, and the background will be silver, and the fly paper shall be black. The fly paper will be on the top and bottom of the screen, and will scroll across the screen, or somesuch.
Rules Don't let the fly touch the flypaper, or game over. The longer you stay alive, the higher your score.
Inputs
* x to continue. make "k = RC if (:k = x) then game. * w, a, and d keys for directions given to the fly. read character commands will also work here. * at the end, a y/n will be needed for playing again.
Exiting At the end, a screen will appear with a skull and crossbones or a giant X or something, signifying the end of the game. under whatever picture I have will be GAME OVER in big text, with “your score is: score” and “Play Again? y/n” in smaller text below it. when 'n' is pressed, cs ss.
Testing To test my game, I first had to ensure that all the screens were working properly. This meant that I had to run the program from every screen to test linkages. When I opened the game from the first method, FLYESCAPE, I was able to successfully navigate from the StartScreen to the GameScreen, to the EndScreen, back to the StartScreen which successfully restarted the GameScreen, and (by setting the score to 170 and then playing for 10 seconds) to the WinScreen, from where I was able to get back to the StartScreen. Throughout, I was noting whether all text was visible on my screen and whether it looked right. The next thing I had to test was the collision and the controls. I found that the Q-button would restart as it was meant to, and that the other keys would move the fly correctly, though when the fly was moved to the right or left, it tended to cause the game to slow down and some of the fly paper to disappear momentarily. Other than this small glitch, the controls all worked properly, and I found when I tested the collision that the fly died every way I could think of to make it die, including through cheating.
Lod the file into Logo. Alternately, open an editor, and paste the procedures into the editor. Then define the procedures with Edit/Define. Type FLYESCAPE to begin and see how long you can keep the fly buzzing!
TO SCORE MAKE "X 0 MAKE "T 0 LABEL "START IF (:T = 1) STOP WAIT 1000 MAKE "X SUM :X 1 IF (:T = 1) STOP SETPC "SILVER (STAMPOVAL 20 20 "TRUE) SETPC "BLACK TT :X IF :X = 180 WIN STOP GO "START END TO COLLISION MAKE "C BASECOLOR (DOTCOLOR) IF (YCOR < -280) MAKE "C 0 MAKE "T 1 IF (YCOR > 280) MAKE "C 0 MAKE "T 1 COLLISION END TO CONTROL ST SETVELOCITY -20 MAKE "COLLIDER LAUNCH [COLLISION] LABEL "CONTROL1 IF (YCOR < -280) MAKE "C 0 IF (YCOR > 280) MAKE "C 0 MAKE "C BASECOLOR (DOTCOLOR) IF (:C = 0) CS ENDSCREEN STOP MAKE "K RC IF :K = "W FD 5 IF :K = "A SETH 270 FD 5 SETH 0 IF :K = "D SETH 90 FD 5 SETH 0 IF :K = "Q (RESTART "TRUE) IF (:X = 180) WIN STOP IF (YCOR < -280) MAKE "C 0 IF (YCOR > 280) MAKE "C 0 IF (:C = 0) CS MAKE "T 1 WAIT 10 ENDSCREEN STOP IF :T = 1 CS WAIT 10 ENDSCREEN STOP GO "CONTROL1 END TO FLYPAPER WRAP MAKE "Y LAUNCH [TOPPAPER] MAKE "T LAUNCH [BOTTOMPAPER] END TO WIN CS SETFONT "TIMES 20 1 SETBG "BLUE TELLALL 0 49 PD HT EACH [SETPC WHO SETH WHO * 360 / 50 SETW RANDOM 5 FD RANDOM 300] TT [YAY YOU WIN] TELL 0 PU SETPOS [200 -200] PD TT [PLAY AGAIN? (Y / N)] LABEL "WINAGAIN MAKE "E2 RC IF :E2 = "Y STARTSCREEN IF :E2 = "N (RESTART "TRUE) GO "WINAGAIN END TO BOTTOMPAPER ASK [3 5 7 9 11 13 15 17 19 21] [HT PU SETPOS [620 -290]] ASK [3 5 7 9 11 13 15 17 19 21] [EACH [SETH 270 FD (130 * ((WHO - 1) / 2))]] LABEL "PAPERSBOTTOM ASK [3] [PD (STAMPRECT 130 100 "TRUE)] ASK [5] [PD (STAMPRECT 130 210 "TRUE)] ASK [7] [PD (STAMPRECT 130 (RANDOM 250) "TRUE)] ASK [9] [PD (STAMPRECT 130 160 "TRUE)] ASK [11] [PD (STAMPRECT 130 250 "TRUE)] ASK [13] [PD (STAMPRECT 130 50 "TRUE)] ASK [15] [PD (STAMPRECT 130 90 "TRUE)] ASK [17] [PD (STAMPRECT 130 170 "TRUE)] ASK [19] [PD (STAMPRECT 130 100 "TRUE)] ASK [21] [PD (STAMPRECT 130 230 "TRUE)] ASK [3 5 7 9 11 13 15 17 19 21] [WAIT 100] IF (:C = 0) STOP ASK [3] [PE (STAMPRECT 130 100 "TRUE)] ASK [5] [PE (STAMPRECT 130 210 "TRUE)] ASK [7] [PE (STAMPRECT 130 250 "TRUE)] ASK [9] [PE (STAMPRECT 130 160 "TRUE)] ASK [11] [PE (STAMPRECT 130 250 "TRUE)] ASK [13] [PE (STAMPRECT 130 50 "TRUE)] ASK [15] [PE (STAMPRECT 130 90 "TRUE)] ASK [17] [PE (STAMPRECT 130 170 "TRUE)] ASK [19] [PE (STAMPRECT 130 100 "TRUE)] ASK [21] [PE (STAMPRECT 130 230 "TRUE)] ASK [3 5 7 9 11 13 15 17 19 21] [FD 10] IF (:X = 179) STOP IF (:C = 0) STOP GO "PAPERSBOTTOM END TO STARTSCREEN MAKE "B 0 TELLALL 0 49 HT SETPC "BLACK TELL 0 CS FS PU HT SETBG "BLUE SETPC "BLACK SETPOS [-150 200] SETFONT "TIMES 60 1 PD TT LOWERCASE "FLYESCAPE PU SETFONT "TIMES 12 0 SETPOS [-300 110] PD TT [USING THE A, W, AND D KEYS TO MOVE UP, LEFT, AND RIGHT, GUIDE YOUR FLY THROUGH] PU SETPOS [-330 90] PD TT [THE FLY PAPER FOR AS LONG AS POSSIBLE. IF YOU TOUCH THE FLY PAPER, THEN ITS GAME OVER] PU SETPOS [-310 70] PD TT [FOR THE FLY. SURVIVE FOR 3 MINUTES (180 SCORE) TO WIN THE GAME. 'Q' TO EXIT THE GAME] PU SETPOS [-90 0] PD TT [PRESS 'X' TO CONTINUE] PU SETPOS [62 140] PD (STAMPOVAL 18 23 "TRUE) SETH 310 REPEAT 2 [FD 20 RT 10] REPEAT 5 [FD 11 RT 41] REPEAT 2 [FD 20 RT 10] SETPOS [62 140] SETH 360 REPEAT 2 [FD 20 RT 10] REPEAT 5 [FD 11 RT 41] REPEAT 2 [FD 20 RT 10] SETPOS [62 140] SETH 150 SETW 10 FD 25 PU SETW 1 LABEL "GAMESTARTER MAKE "B RC IF :B = "X CS GAME STOP GO "GAMESTARTER END TO FLYESCAPE SETTURTLES 50 TELL 0 LOADSHAPE [Y / COMPUTERSCIENCEANDPROGRAMMING / LOGO / FLYESCAPE / FLYSHAPE] STARTSCREEN END TO GAME FS TELLALL 0 49 EACH [HT SETPC 0 PU] MAKE "Z LAUNCH [GAMEBACKGROUND] MAKE "S LAUNCH [FLYPAPER] TELL 0 CONTROL LABEL "WINNING IF :X = 180 WIN STOP GO "WINNING END TO TOPPAPER ASK [2 4 6 8 10 12 14 16 18 20] [HT PU SETPOS [620 320]] ASK [2 4 6 8 10 12 14 16 18 20] [EACH [SETH 270 FD (130 * ((WHO) / 2))]] LABEL "PAPERSTOP ASK [2] [PD (STAMPRECT 130 -100 "TRUE)] ASK [4] [PD (STAMPRECT 130 -210 "TRUE)] ASK [6] [PD (STAMPRECT 130 -170 "TRUE)] ASK [8] [PD (STAMPRECT 130 -160 "TRUE)] ASK [10] [PD (STAMPRECT 130 -280 "TRUE)] ASK [12] [PD (STAMPRECT 130 -300 "TRUE)] ASK [14] [PD (STAMPRECT 130 -90 "TRUE)] ASK [16] [PD (STAMPRECT 130 -170 "TRUE)] ASK [18] [PD (STAMPRECT 130 -100 "TRUE)] ASK [20] [PD (STAMPRECT 130 -230 "TRUE)] ASK [2 4 6 8 10 12 14 16 18 20] [WAIT 100] IF (:C = 0) MAKE "T 1 STOP ASK [2] [PE (STAMPRECT 130 -100 "TRUE)] ASK [4] [PE (STAMPRECT 130 -210 "TRUE)] ASK [6] [PE (STAMPRECT 130 -250 "TRUE)] ASK [8] [PE (STAMPRECT 130 -160 "TRUE)] ASK [10] [PE (STAMPRECT 130 -280 "TRUE)] ASK [12] [PE (STAMPRECT 130 -300 "TRUE)] ASK [14] [PE (STAMPRECT 130 -90 "TRUE)] ASK [16] [PE (STAMPRECT 130 -170 "TRUE)] ASK [18] [PE (STAMPRECT 130 -100 "TRUE)] ASK [20] [PE (STAMPRECT 130 -230 "TRUE)] ASK [2 4 6 8 10 12 14 16 18 20] [FD 15] IF (:X = 179) STOP IF (:C = 0) MAKE "T 1 STOP GO "PAPERSTOP END TO GAMEBACKGROUND SETBG "SILVER ASK 1 [PU SETPOS [-600 340] PD TT [FLY ESCAPE - A RICKY ORR PRODUCTION - 2008] PU SETPOS [600 -320] PD SCORE] END TO ENDSCREEN CS FS SETBG 0 WAIT 100 SETPC "GRAY PU SETPOS [-300 -250] PD (STAMPRECT 600 500 "TRUE) SETPC "BLACK PU SETPOS [-220 70] SETFONT "TIMES 50 1 PD TT [GAME OVER] PU SETPOS [-100 -50] SETFONT "TIMES 12 0 PD TT :X PU SETPOS [-75 -50] PD TT [WAS YOUR SCORE] PU SETPOS [-70 -70] PD TT [PLAY AGAIN? (Y / N)] ;MAKE A SQUISHED FLY PU SETPOS [0 100] PD (STAMPOVAL 50 20 "TRUE) SETH 270 FD 70 RT 15 FD 20 RT 60 FD 10 RT 5 FD 29 RT 100 FD 20 RT 26 FD 30 LT 30 FD 10 RT 80 FD 20 SETPOS [0 100] SETH 90 FD 70 RT 30 FD 10 LT 50 FD 20 LT 100 FD 20 RT 15 FD 10 LT 30 FD 40 LT 90 FD 60 HT LABEL "AGAIN MAKE "E RC IF :E = "Y MAKE "C "SILVER STARTSCREEN STOP IF :E = "N (RESTART "TRUE) GO "AGAIN END MAKE "A "2 MAKE "B "X MAKE "C "0 MAKE "E "W MAKE "K "W MAKE "S "168 MAKE "T "1 MAKE "X "2 MAKE "Y "169 MAKE "Z "167 MAKE "E2 "Y MAKE "COLLIDER "171