DECLARE SUB highscore (score!) ' Game ' version 1.0 ' made by Olle Bergkvist SCREEN 13 reboot: CLS xme = 5 yme = 150 ymov = -.05 FOR A = 0 TO 319: PSET (A, 0), 15: FOR n = 0 TO 2000: NEXT: NEXT FOR A = 0 TO 319: PSET (A, 199), 15: FOR n = 0 TO 2000: NEXT: NEXT FOR A = 0 TO 199: PSET (0, A), 9: FOR n = 0 TO 2000: NEXT: NEXT FOR A = 0 TO 199: PSET (319, A), 14: FOR n = 0 TO 2000: NEXT: NEXT LOCATE 3 PRINT "Welcome to my platform game!" PRINT PRINT "Avoid the red things. Pick up the yellow things. The goal is at right. " PRINT "Navigate with the numeric keyboard, or the arrow keys. Exit with Esc." PRINT "Press M to turn on/off the music." PRINT "Press any key to start the game." LOCATE 22 PRINT "Made by Olle Bergkvist 1.0" LOCATE 5 PSET (xme, 199 - yme), 15 CIRCLE (xme, 199 - yme), 10 CIRCLE (xme, 199 - yme), 20 SLEEP LINE (0, 0)-(0, 200), 9 LINE (319, 0)-(319, 200), 14 LINE (1, 1)-(318, 198), 0, BF RANDOMIZE TIMER ' Platforms FOR n = 1 TO 10 plx = 0 DO ply = INT(150 * RND) + 25 pllen = INT(100 * RND) LINE (plx, ply)-(plx + pllen, ply), 9 plx = plx + pllen LOOP UNTIL plx > 320 NEXT n ' Yellow things FOR n = 1 TO 50 DO x = 320 * RND y = 200 * RND LOOP WHILE POINT(x, y) PSET (x, y), 14 NEXT n ' Red things FOR n = 1 TO 50 DO x = 320 * RND y = 200 * RND LOOP WHILE POINT(x, y) PSET (x, y), 12 NEXT n ' Music muson = 1 wantmus = 1 mus = 1 GOSUB music start = TIMER playat = start '-----------------------Start DO IF PLAY(0) = 0 THEN GOSUB music keyn = INP(96) ' keyboard input IF keyn = 1 THEN SOUND 100, 0: END 'To make the speaker shut up, and exit :-D IF (keyn = 71 OR keyn = 72 OR keyn = 73) AND ymov = 0 THEN ymov = 1 IF keyn = 50 THEN wantmus = -muson' turn on/off music SELECT CASE keyn CASE 79, 75, 71 xmov = -1 CASE 81, 77, 73 xmov = 1 CASE ELSE xmov = 0 END SELECT '/////////////////////////// if move IF 100 * xmov OR 100 * ymov THEN PRESET (xme, 199 - yme) xme = xme + xmov yme = yme + ymov IF xme > 318 THEN time = TIMER - start PRINT "You came out alive!" PRINT "It took"; time; "seconds." PRINT "You got"; score; "points." highscore (score) PRINT "Press Esc to exit, or Space to play again." SOUND 100, 0: PLAY "l4 o2 c e g o3 l2 c" DO IF INKEY$ = CHR$(27) THEN END IF INKEY$ = " " THEN GOTO reboot LOOP END END IF IF xme < 1 THEN xme = 1 IF yme > 198 THEN yme = 198 pxl = POINT(xme, 199 - yme) SELECT CASE pxl CASE 14: SOUND 100, 0: PLAY "mb l32 c e g": score = score + 1 CASE 0, 15: ymov = ymov - .05 CASE 9 DO yme = yme + 1 LOOP WHILE POINT(xme, 199 - yme) = 9 IF ymov < 0 THEN ymov = 0 END SELECT IF pxl = 12 OR yme < 0 THEN PRINT "You died!" PRINT "After"; xme; "of 320 pixels and "; TIMER - start; "seconds." PRINT "You got"; score; "coins." highscore (score) PRINT "Press Esc to exit, or Space to try again." SOUND 100, 0: SOUND 50, 30 DO IF INKEY$ = CHR$(27) THEN END IF INKEY$ = " " THEN GOTO reboot LOOP END END IF 'END IF '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ PSET (xme, 199 - yme), 15 t = TIMER IF t - playat > 1 THEN playat = t: 'SOUND 1000, .5 DO key$ = INKEY$ LOOP WHILE t + .01 > TIMER LOOP music: muson = wantmus IF muson = 1 THEN SELECT CASE mus CASE 1: PLAY "MB O3 L2 A L4 F C D F F C" CASE 2: PLAY "L4 D F F > C < L2 A G" CASE 3: PLAY "L2 A L4 F C D F F C" CASE 4: PLAY "L4 D F L8 A# A L4 G L2 F P2" END SELECT END IF mus = mus + 1 IF mus = 5 THEN mus = 1 RETURN SUB highscore (score) OPEN "platform.dat" FOR APPEND AS #1 PRINT #1, "0" CLOSE OPEN "platform.dat" FOR INPUT AS #1 INPUT #1, high CLOSE PRINT "Highscore:"; high IF high < score THEN high = score OPEN "platform.dat" FOR OUTPUT AS #1 PRINT #1, high CLOSE END SUB