Tänään oli tekemisen puute ja väänsin tämmösen, monella tapaa vielä keskeneräinen, mutta pelattavissa. Kolme kenttää, pelataan nuolinäppäimillä, esc lopettaa.
Huom! Tämä pelinalku vaatii QB64:n toimiakseen!
Title$ = "BREAKOUT FROM HELL v0.3" DIM PG$(20) SCREEN 12 speed% = 700 ' muuta tätä arvoa jos peli tuntuu liian hitaalta / nopealta balls% = 3: score% = 0: level% = 1 Alku: CLS FOR y% = 1 TO 20 PG$(y%) = SPACE$(18) LINE (1 * 32, y% * 16)-(18 * 32 + 31, y% * 16 + 15), 1, BF NEXT y% IF level% = 1 THEN PG$(3) = " 1111111111111111 " PG$(4) = " 12 3 12 13 2 1 " PG$(5) = " 1 1 1 1 " PG$(6) = " 111 1111 111 " PG$(10) = " 1111111111111111 " END IF IF level% = 2 THEN PG$(1) = "4 4 2 4 4 " PG$(2) = " " PG$(3) = " 2 " PG$(4) = " " PG$(5) = "111111111111111111" END IF IF level% = 3 THEN PG$(1) = "2 1 2 1 2 1 2 1 2 " PG$(2) = " 1 1 1 1 " PG$(3) = "2 1 2 1 2 1 2 1 2 " PG$(4) = " 1 1 1 1 " PG$(5) = "2 1 2 1 2 1 2 1 2 " PG$(6) = " 1 1 1 1 " END IF blocks% = 0 FOR y% = 1 TO 20 FOR x% = 1 TO 18 IF MID$(PG$(y%), x%, 1) <> " " THEN koko% = VAL(MID$(PG$(y%), x%, 1)) LINE (x% * 32 + 1, y% * 16 + 1)-(x% * 32 + (32 * koko%) - 2, y% * 16 + (16 * koko%) - 2), 9, BF blocks% = blocks% + 1 END IF NEXT x% NEXT y% Irti: _TITLE Title$ + " - LEVEL " + STR$(level%) + " - SCORE: " + STR$(score%) + " - Balls left: " + STR$(balls%) px% = 18: py% = 20 ' mailan sijainti bx% = 20: by% = 19 ' pallon sijanti bd% = 5 ' pallon suunta numeronäppäimistön mukaisesti 7/9/5/1/3 LINE (px% * 16, py% * 16)-((4 + px%) * 16 - 1, py% * 16 + 14), 15, BF ' maila LINE (bx% * 16, by% * 16)-(bx% * 16 + 14, by% * 16 + 14), 15, BF ' pallo DO hit% = 0: bxold% = bx%: byold% = by% DO IF by% = 20 THEN GOTO Pohjalla SELECT CASE bd% CASE 9 IF POINT(bx% * 16 + 20, by% * 16 - 4) = 1 AND POINT(bx% * 16 + 20, by% * 16 + 4) = 1 AND POINT(bx% * 16 + 4, by% * 16 - 4) = 1 THEN bx% = bx% + 1: by% = by% - 1: hit% = 0 ELSE hit% = 1: muistibd% = 0 IF POINT(bx% * 16 + 20, by% * 16 + 4) <> 1 AND POINT(bx% * 16 + 4, by% * 16 - 4) <> 1 THEN muistibd% = 1 IF POINT(bx% * 16 + 20, by% * 16 + 4) = 9 THEN bd% = 7: PAINT (bx% * 16 + 20, by% * 16 + 4), 1: GOSUB Pisteet IF POINT(bx% * 16 + 4, by% * 16 - 4) = 9 THEN bd% = 3: PAINT (bx% * 16 + 4, by% * 16 - 4), 1: GOSUB Pisteet IF POINT(bx% * 16 + 20, by% * 16 - 4) = 9 THEN bd% = 3: PAINT (bx% * 16 + 20, by% * 16 - 4), 1: GOSUB Pisteet IF POINT(bx% * 16 + 20, by% * 16 + 4) <> 1 OR POINT(bx% * 16 + 20, by% * 16 - 4) <> 1 THEN bd% = 7 IF POINT(bx% * 16 + 4, by% * 16 - 4) = 0 THEN bd% = 3 IF muistibd% = 1 THEN bd% = 1 END IF CASE 7 IF POINT(bx% * 16 - 4, by% * 16 - 4) = 1 AND POINT(bx% * 16 - 4, by% * 16 + 4) = 1 AND POINT(bx% * 16 + 4, by% * 16 - 4) = 1 THEN bx% = bx% - 1: by% = by% - 1: hit% = 0 ELSE hit% = 1: muistibd% = 0 IF POINT(bx% * 16 - 4, by% * 16 + 4) <> 1 AND POINT(bx% * 16 + 4, by% * 16 - 4) <> 1 THEN muistibd% = 3 IF POINT(bx% * 16 - 4, by% * 16 + 4) = 9 THEN bd% = 9: PAINT (bx% * 16 - 4, by% * 16 + 4), 1: GOSUB Pisteet IF POINT(bx% * 16 + 4, by% * 16 - 4) = 9 THEN bd% = 1: PAINT (bx% * 16 + 4, by% * 16 - 4), 1: GOSUB Pisteet IF POINT(bx% * 16 - 4, by% * 16 - 4) = 9 THEN bd% = 1: PAINT (bx% * 16 - 4, by% * 16 - 4), 1: GOSUB Pisteet IF POINT(bx% * 16 - 4, by% * 16 + 4) <> 1 OR POINT(bx% * 16 - 4, by% * 16 - 4) <> 1 THEN bd% = 9 IF POINT(bx% * 16 + 4, by% * 16 - 4) = 0 THEN bd% = 1 IF muistibd% = 3 THEN bd% = 3 END IF CASE 3 IF POINT(bx% * 16 + 20, by% * 16 + 20) = 1 AND POINT(bx% * 16 + 20, by% * 16 + 4) = 1 AND POINT(bx% * 16 + 4, by% * 16 + 20) = 1 THEN bx% = bx% + 1: by% = by% + 1: hit% = 0 ELSE hit% = 1: muistibd% = 0 IF POINT(bx% * 16 + 20, by% * 16 + 4) <> 1 AND POINT(bx% * 16 + 4, by% * 16 + 20) <> 1 THEN muistibd% = 7 IF POINT(bx% * 16 + 20, by% * 16 + 4) = 9 THEN bd% = 1: PAINT (bx% * 16 + 20, by% * 16 + 4), 1: GOSUB Pisteet IF POINT(bx% * 16 + 4, by% * 16 + 20) = 9 THEN bd% = 9: PAINT (bx% * 16 + 4, by% * 16 + 20), 1: GOSUB Pisteet IF POINT(bx% * 16 + 20, by% * 16 + 20) = 9 THEN bd% = 9: PAINT (bx% * 16 + 20, by% * 16 + 20), 1: GOSUB Pisteet IF POINT(bx% * 16 + 20, by% * 16 + 4) <> 1 OR POINT(bx% * 16 + 20, by% * 16 + 20) <> 1 THEN bd% = 1 IF POINT(bx% * 16 + 4, by% * 16 + 20) > 1 THEN bd% = 9 IF POINT(bx% * 16 + 20, by% * 16 + 20) > 1 THEN bd% = 9 IF muistibd% = 7 THEN bd% = 7 END IF CASE 1 IF POINT(bx% * 16 - 4, by% * 16 + 20) = 1 AND POINT(bx% * 16 - 4, by% * 16 + 4) = 1 AND POINT(bx% * 16 + 4, by% * 16 + 20) = 1 THEN bx% = bx% - 1: by% = by% + 1: hit% = 0 ELSE hit% = 1: muistibd% = 0 IF POINT(bx% * 16 - 4, by% * 16 + 4) <> 1 AND POINT(bx% * 16 + 4, by% * 16 + 20) <> 1 THEN muistibd% = 9 IF POINT(bx% * 16 - 4, by% * 16 + 4) = 9 THEN bd% = 3: PAINT (bx% * 16 - 4, by% * 16 + 4), 1: GOSUB Pisteet IF POINT(bx% * 16 + 4, by% * 16 + 20) = 9 THEN bd% = 7: PAINT (bx% * 16 + 4, by% * 16 + 20), 1: GOSUB Pisteet IF POINT(bx% * 16 - 4, by% * 16 + 20) = 9 THEN bd% = 7: PAINT (bx% * 16 - 4, by% * 16 + 20), 1: GOSUB Pisteet IF POINT(bx% * 16 - 4, by% * 16 + 4) <> 1 OR POINT(bx% * 16 - 4, by% * 16 + 20) <> 1 THEN bd% = 3 IF POINT(bx% * 16 + 4, by% * 16 + 20) > 1 THEN bd% = 7 IF POINT(bx% * 16 - 4, by% * 16 + 20) > 1 THEN bd% = 7 IF muistibd% = 9 THEN bd% = 9 END IF CASE 5 END SELECT LOOP WHILE hit% = 1 IF blocks% = 0 THEN level% = level% + 1: GOTO Alku FOR d% = 1 TO 16 IF bd% <> 5 THEN LINE (bxold% * 16 + ((bx% - bxold%) * d%), byold% * 16 + ((by% - byold%) * d%))-(bxold% * 16 + ((bx% - bxold%) * d%) + 15, byold% * 16 + ((by% - byold%) * d%) + 15), 1, B LINE (bxold% * 16 + ((bx% - bxold%) * d%) + 1, byold% * 16 + ((by% - byold%) * d%) + 1)-(bxold% * 16 + ((bx% - bxold%) * d%) + 14, byold% * 16 + ((by% - byold%) * d%) + 14), 15, BF END IF FOR luuppi% = 1 TO speed% Korkeus% = 9: GOSUB Laava a$ = INKEY$ IF a$ <> "" THEN IF bd% = 5 THEN LINE (bx% * 16, by% * 16)-(bx% * 16 + 14, by% * 16 + 14), 1, BF LINE (px% * 16, py% * 16)-((4 + px%) * 16 - 1, py% * 16 + 14), 1, BF ' hide paddle SELECT CASE a$ CASE CHR$(27): END ' esc lopettaa CASE CHR$(0) + "K" IF px% > 2 THEN px% = px% - 1 IF bd% = 5 THEN bx% = bx% - 1 END IF CASE CHR$(0) + "M" IF px% < 34 THEN px% = px% + 1 IF bd% = 5 THEN bx% = bx% + 1 END IF CASE CHR$(0) + "H": IF bd% = 5 THEN bd% = 9 END SELECT IF bd% = 5 THEN LINE (bx% * 16, by% * 16)-(bx% * 16 + 14, by% * 16 + 14), 15, BF LINE (px% * 16, py% * 16)-((4 + px%) * 16 - 1, py% * 16 + 14), 15, BF END IF NEXT luuppi% WAIT &H3DA, 8 NEXT d% LOOP Pohjalla: FOR y% = 0 TO 15 FOR upotus% = 1 TO speed% FOR tulitsunami% = 9 TO 29 Korkeus% = tulitsunami%: GOSUB Laava WAIT &H3DA, 8 NEXT NEXT NEXT y% LINE (32, 20 * 16 - 1)-(607, 21 * 16), 1, BF balls% = balls% - 1 IF balls% > 0 THEN GOTO Irti _TITLE Title$ + " - LEVEL " + STR$(level%) + " - SCORE: " + STR$(score%) + " - Balls left: " + STR$(balls%) + " - GAME OVER!" level% = 1: balls% = 3: score% = 0: level% = 1 LOCATE 26, 33: PRINT "ENTER = NEW GAME" LOCATE 27, 33: PRINT " ESC = QUIT" DO b$ = INKEY$ IF b$ = " " OR b$ = CHR$(13) THEN GOTO Alku IF b$ = CHR$(27) THEN END LOOP Pisteet: blocks% = blocks% - 1 score% = score% + 10 _TITLE Title$ + " - LEVEL " + STR$(level%) + " - SCORE: " + STR$(score%) + " - Balls left: " + STR$(balls%) + " - Bricks left: " + STR$(blocks%) RETURN Laava: lx% = INT(RND * 576) + 32 lc% = INT(RND * 5) + 1 ll% = INT(RND * 4) + 1 lr% = INT(RND * Korkeus%) + 1 IF lc% = 1 THEN pc% = 1 IF lc% = 2 THEN pc% = 4 IF lc% = 3 THEN pc% = 12 IF lc% = 4 THEN pc% = 14 IF lc% = 5 THEN pc% = 15 PSET (lx%, 3 + 16 * 21 + lc% * 4 + ll% - lr%), pc% RETURN
Laadukas peli, mutta minusta joihinkin pallon pomppuihin on mahdoton ehtiä "viivalla", kun liikkuu ns. porrasmaisesti.
Ihan hieno, mutta suosittelen että käytät nuolinäppäinten lukuun _KEYDOWN- käskyä ja koska se on PALJON nopeampi tapa, ohjelman nopeutta tarvii rajoittaa käyttämällä _LIMIT- käskyä. Limittiä käytettäessä et tarvi enää muuta hidastusta, ohjelma pyörii silloin kaikilla koneilla samalla nopeudella.
Uskon että osaat etsiä lisätietoja noista käskyistä QB64-wikistä ;)
Aihe on jo aika vanha, joten et voi enää vastata siihen.