Piotr-246
Gość
|
Wysłany: Śro 15:09, 25 Sie 2021 Temat postu: Kamień |
|
|
rysunek kamienia w grze
DECLARE SUB zabranie ()
DECLARE SUB dreptanie ()
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 31)
DIM pamiec(0 TO 128) AS LONG
DIM SHARED plansza$(0 TO 48)
DIM SHARED kod$
DIM SHARED serca(1 TO 7, 1 TO 7) AS INTEGER
DIM SHARED roomx AS INTEGER, roomy AS INTEGER
DIM SHARED xserca AS INTEGER, yserca AS INTEGER
DIM SHARED doniczka$(0 TO 15)
DIM SHARED kamien$(0 TO 15)
REM cegielki planszy
DIM SHARED cegla(0 TO 16) AS LONG
DIM SHARED tlo(0 TO 16) AS LONG
REM dane elementow planszy
DIM SHARED ceg40(0 TO 640) AS LONG
DIM SHARED ceg17plus17(0 TO 640) AS LONG
DIM SHARED ceg13plus13(0 TO 640) AS LONG
DIM SHARED ceg4plus20plus4(0 TO 640) AS LONG
DIM SHARED ceg4spc32plus4(0 TO 640) AS LONG
DIM SHARED ceg1spc38ceg1(0 TO 640) AS LONG
DIM SHARED ceg1spc39(0 TO 640) AS LONG
DIM SHARED spc39ceg1(0 TO 640) AS LONG
DIM SHARED spc40(0 TO 640) AS LONG
REM ****************** DANE ANIMACJI
DIM SHARED znakp1(0 TO 128) AS LONG
DIM SHARED znakl1(0 TO 128) AS LONG
DIM SHARED znakp2(0 TO 128) AS LONG
DIM SHARED znakl2(0 TO 128) AS LONG
DIM SHARED znakp3(0 TO 128) AS LONG
DIM SHARED znakl3(0 TO 128) AS LONG
DIM SHARED vertd1(0 TO 128) AS LONG
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 60: XS = 100: YS = 60: REM wspolrzedne poczatkowe gracza na ekranie
licz = -1: REM wartosc startowa zegara
roomx = 4: roomy = 4: REM plansza startowa
REM ***** SUB palety - ustawienie nowych wartosci barw
palety
REM ***** SUB cegly - zapelnienie pozostalych tablic
cegly
REM SUB plansze - wypelnienie tablicy wygladu plansz
plansze
REM SUB animacja - tablice animacji postaci
animacja
REM ************************* WYBOR POMIESZCZENIA
rysuj:
kod$ = plansza$(roomx - 1 + (roomy - 1) * 7)
REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania
REM SUB rysowanie - rysowanie planszy
rysowanie
REM pomiar czasu rysowania
t1 = PEEK(1132):
REM menu na dole
COLOR 15
LOCATE 25, 15: PRINT "L-SHIFT ALT P-SHIFT";
LOCATE 24, 2: COLOR 240: PRINT "T:"; t0; "/"; t1;
PRINT " ROOM:"; roomx; "/"; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 15, y + 31), pamiec
PUT (x, y), vertd1, PSET
liczsercaroom = 0
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
IF dzwiekbrania = 1 THEN dzwiekbrania = 0: zabranie
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 25, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1800: NEXT delay
REM ************************ sprawdzenie klawiszy
alt = 0: lshift = 0: pshift = 0: skos = 0
k$ = INKEY$
IF k$ = CHR$(27) THEN END
REM klawisz alt - wznoszenie sie
IF (PEEK(1047) AND 8) = 8 THEN alt = 1
IF (PEEK(1047) AND 2) = 2 THEN lshift = 1
IF (PEEK(1047) AND 1) = 1 THEN pshift = 1
REM bezruch = grawitacja
IF lshift = 0 AND pshift = 0 AND alt = 0 THEN dy = 2: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 2: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 2: obrot = 1: vert = 0
IF alt = 1 THEN dy = -4: vert = 1
IF dx <> 0 AND dy <> 0 THEN skos = 1
czy:
REM ************ sprawdzenie czy jest przejscie do innej planszy
IF x + dx > 301 THEN x = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF x + dx < 2 THEN x = 301: XS = 301: roomx = roomx - 1: GOTO rysuj
IF y + dy > 149 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 147: YS = 147: roomy = roomy - 1: GOTO rysuj
REM *********** sprawdzenie czy ruch jest mozliwy
REM sprawdzenie przeszkody. Przeszkoda sa punkty powyzej
REM okreslonej sumy rejestru koloru >=128
xsuma = 0
ysuma = 0
xmozliwy = 0
ymozliwy = 0
REM sprawdzenie sasiedztwa obok
IF dx > 0 THEN FOR i = 0 TO 31: xsuma = xsuma + POINT(x + 19, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 31: xsuma = xsuma + POINT(x - 3, y + i): NEXT i
IF xsuma < 128 THEN xmozliwy = 1
REM sprawdzenie sasiedztwa gora dol
IF dy > 0 THEN FOR i = 0 TO 15: ysuma = ysuma + POINT(x + i, y + 35): NEXT i
IF dy < 0 THEN FOR i = 0 TO 15: ysuma = ysuma + POINT(x + i, y - 4): NEXT i
IF ysuma < 128 THEN ymozliwy = 1
suma = xsuma + ysuma
IF suma < 128 THEN IF dx <> 0 OR dy <> 0 THEN GOTO ruch
REM szczegolne przypadki
IF suma >= 128 AND xmozliwy = 1 THEN dy = 0: GOTO czy
IF suma >= 128 AND ymozliwy = 1 THEN dx = 0: GOTO czy
REM ruch niemozliwy powrot petli glownej bez zmian pozostaja x y
x = XS: y = YS
GOTO PETLA
REM ***************** RUCH
ruch:
x = x + dx: y = y + dy
IF dy = 0 AND przebieranie = 0 AND alt = 0 THEN dreptanie: REM dzwiek chodzenia
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
deltawx = ABS(x - xserca)
deltawy = ABS(y + 16 - yserca)
IF deltawx < 10 AND deltawy < 22 THEN GOSUB wziatek
REM ********************* zapamietanie tego co za ludzikiem
GET (x, y)-(x + 15, y + 31), pamiec
REM ************* rysowanie nowej postaci WEDLUG FAZY RUCHU
REM aby nie rysowac dwoch postaci w przypadku skosu
IF skos = 1 THEN GOTO bezskosu:
REM ************************** ruch w dol lub gore
IF vert = 1 THEN PUT (x, y), vertd1, OR: XS = x: YS = y: GOTO PETLA
bezskosu:
REM ************************** ruch w lewo
IF obrot = -1 THEN
IF dy = 0 THEN przebieranie = przebieranie + 1
IF przebieranie = 3 THEN przebieranie = 0
IF przebieranie = 0 THEN PUT (x, y), znakl1, OR
IF przebieranie = 1 THEN PUT (x, y), znakl2, OR
IF przebieranie = 2 THEN PUT (x, y), znakl3, OR
END IF
REM ****************** ruch w prawo
IF obrot = 1 THEN
IF dy = 0 THEN przebieranie = przebieranie + 1
IF przebieranie = 3 THEN przebieranie = 0
IF przebieranie = 0 THEN PUT (x, y), znakp1, OR
IF przebieranie = 1 THEN PUT (x, y), znakp2, OR
IF przebieranie = 2 THEN PUT (x, y), znakp3, OR
END IF
XS = x: YS = y
GOTO PETLA
REM GOSUB-RETURN****************************** obsluga wziatku
wziatek:
IF serca(roomx, roomy) = 0 THEN GOTO niemawziatku
IF liczsercaroom = 1 THEN GOTO niemawziatku
serca(roomx, roomy) = 0
liczserca = liczserca + 1
PUT (xserca, yserca), tlo, PSET
liczsercaroom = 1
dzwiekbrania = 1
REM zabranie
LOCATE 1, 1: COLOR 6: PRINT liczserca;
niemawziatku:
RETURN
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H200080
znakl1(0) = &H200080
pomoc$(0) = "0000000000003F3F3F3F000000000000" + "0000000000003F3F3F3F000000000000"
pomoc$(1) = "00000000003F3F3F3F3F3F0000000000" + "00000000003F3F3F3F3F3F0000000000"
pomoc$(2) = "00000000006F6F6F6F3F3F0000000000" + "00000000003F3F3F6F6F6F0000000000"
pomoc$(3) = "00000000006F3F6F6F3F3F0000000000" + "00000000003F3F6F6F3F6F0000000000"
pomoc$(4) = "000000008F6F6F6F6F6F3F0000000000" + "00000000003F6F6F6F6F6F8F00000000"
pomoc$(5) = "00000000006F6F6F6F6F3F0000000000" + "00000000003F6F6F6F6F6F0000000000"
pomoc$(6) = "0000000000006F6F6F6F000000000000" + "0000000000006F6F6F6F000000000000"
pomoc$(7) = "000000000000006F6F1F000000000000" + "0000000000001F6F6F00000000000000"
pomoc$(8) = "000000000000007F1F1F7F0000000000" + "00000000007F1F1F7F00000000000000"
pomoc$(9) = "0000000000007F1F1F1F1F0000000000" + "00000000001F1F1F1F7F000000000000"
pomoc$(10) = "00000000007F1F1F1F1F1F7F00000000" + "000000007F1F1F1F1F1F7F0000000000"
pomoc$(11) = "00000000001F1F1F1F1F1F7F00000000" + "000000007F1F1F1F1F1F1F0000000000"
pomoc$(12) = "00000000001F1F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F1F0000000000"
pomoc$(13) = "000000007F1F1F1F1F1F1F1F7F000000" + "0000007F1F1F1F1F1F1F1F7F00000000"
pomoc$(14) = "000000007F1F1F1F1F1F1F1F1F000000" + "0000001F1F1F1F1F1F1F1F7F00000000"
pomoc$(15) = "000000001F1F1F1F1F1F1F1F1F000000" + "0000001F1F1F1F1F1F1F1F1F00000000"
pomoc$(16) = "0000001F1F1F1F3F3F3F3F1F1F000000" + "0000001F1F3F3F3F3F1F1F1F1F000000"
pomoc$(17) = "0000006F6F002F2F2F2F2F006F6F0000" + "00006F6F002F2F2F2F2F006F6F000000"
pomoc$(18) = "0000006F00002F2F2F2F2F00006F0000" + "00006F00002F2F2F2F2F00006F000000"
pomoc$(19) = "00000000009F2F2F2F2F2F0000000000" + "000000009F2F2F2F2F2F9F0000000000"
pomoc$(20) = "00000000002F2F2F2F2F2F9F00000000" + "000000002F2F2F2F2F2F2F0000000000"
pomoc$(21) = "00000000002F2F2F2F2F2F2F00000000" + "000000002F2F2F2F2F2F2F0000000000"
pomoc$(22) = "00000000002F2F2F002F2F2F00000000" + "000000002F2F2F002F2F2F0000000000"
pomoc$(23) = "000000009F2F2F2F002F2F2F00000000" + "000000002F2F2F002F2F2F2F00000000"
pomoc$(24) = "000000002F2F2F2F002F2F2F2F000000" + "0000009F2F2F2F002F2F2F2F00000000"
pomoc$(25) = "000000002F2F2F00009F2F2F2F000000" + "0000002F2F2F9F00002F2F2F00000000"
pomoc$(26) = "000000002F2F2F0000002F2F2F000000" + "0000002F2F2F0000002F2F2F00000000"
pomoc$(27) = "000000002F2F2F0000002F2F2F000000" + "0000002F2F2F0000002F2F2F00000000"
pomoc$(28) = "0000009F2F2F2F0000002F2F2F3F0000" + "00003F2F2F2F0000009F2F2F9F000000"
pomoc$(29) = "0000002F2F2F00000000003F3F3F0000" + "00003F3F3F00000000002F2F2F000000"
pomoc$(30) = "0000003F3F3F000000003F3F00000000" + "000000003F3F000000002F2F2F000000"
pomoc$(31) = "00003F3F3F3F00000000000000000000" + "000000000000000000003F3F3F3F0000"
FOR i = 0 TO 31
znakp1(i * 4 + 4) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 4 + 3) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 4 + 2) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakp1(i * 4 + 1) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 4 + 4) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 4 + 3) = VAL("&H" + MID$(pomoc$(i), 41, 8))
znakl1(i * 4 + 2) = VAL("&H" + MID$(pomoc$(i), 49, 8))
znakl1(i * 4 + 1) = VAL("&H" + MID$(pomoc$(i), 57, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H200080
znakl2(0) = &H200080
pomoc$(0) = "0000000000003F3F3F3F000000000000" + "0000000000003F3F3F3F000000000000"
pomoc$(1) = "00000000003F3F3F3F3F3F0000000000" + "00000000003F3F3F3F3F3F0000000000"
pomoc$(2) = "00000000006F6F6F3F3F3F0000000000" + "00000000003F3F3F6F6F6F0000000000"
pomoc$(3) = "00000000006F3F6F6F3F3F0000000000" + "00000000003F3F6F6F3F6F0000000000"
pomoc$(4) = "000000008F6F6F6F6F3F3F0000000000" + "00000000003F3F6F6F6F6F8F00000000"
pomoc$(5) = "00000000006F6F6F6F6F3F0000000000" + "00000000003F6F6F6F6F6F0000000000"
pomoc$(6) = "0000000000006F6F6F6F000000000000" + "0000000000006F6F6F6F000000000000"
pomoc$(7) = "000000000000006F6F1F000000000000" + "0000000000001F6F6F00000000000000"
pomoc$(8) = "000000000000007F1F1F7F0000000000" + "00000000007F1F1F7F00000000000000"
pomoc$(9) = "0000000000007F1F1F1F1F0000000000" + "00000000001F1F1F1F7F000000000000"
pomoc$(10) = "0000000000001F1F1F1F1F0000000000" + "00000000001F1F1F1F1F000000000000"
pomoc$(11) = "0000000000001F1F1F1F1F0000000000" + "00000000001F1F1F1F1F000000000000"
pomoc$(12) = "0000000000001F1F1F1F1F0000000000" + "00000000001F1F1F1F1F000000000000"
pomoc$(13) = "0000000000001F1F1F1F1F0000000000" + "00000000001F1F1F1F1F000000000000"
pomoc$(14) = "00000000007F1F1F1F1F1F0000000000" + "00000000001F1F1F1F1F7F0000000000"
pomoc$(15) = "00000000007F1F1F1F1F1F0000000000" + "00000000001F1F1F1F1F7F0000000000"
pomoc$(16) = "00000000007F1F1F1F1F3F0000000000" + "00000000003F1F1F1F1F7F0000000000"
pomoc$(17) = "00000000008F8F1F1F8F2F0000000000" + "00000000002F8F1F1F8F2F0000000000"
pomoc$(18) = "00000000002F2F6F6F2F2F0000000000" + "00000000002F2F6F6F2F2F0000000000"
pomoc$(19) = "00000000002F2F6F6F2F2F0000000000" + "00000000002F2F6F6F2F2F0000000000"
pomoc$(20) = "00000000002F2F2F2F2F000000000000" + "0000000000002F2F2F2F2F0000000000"
pomoc$(21) = "000000009F2F2F2F2F2F000000000000" + "0000000000002F2F2F2F2F9F00000000"
pomoc$(22) = "000000002F2F2F2F2F2F000000000000" + "0000000000002F2F2F2F2F2F00000000"
pomoc$(23) = "000000009F2F2F2F2F2F000000000000" + "0000000000002F2F2F2F2F9F00000000"
pomoc$(24) = "00000000002F2F2F2F2F000000000000" + "0000000000002F2F2F2F2F0000000000"
pomoc$(25) = "00000000002F2F2F2F2F3F0000000000" + "00000000003F2F2F2F2F2F0000000000"
pomoc$(26) = "0000000000002F2F2F2F3F0000000000" + "00000000003F2F2F2F2F000000000000"
pomoc$(27) = "000000000000002F2F2F3F3F00000000" + "000000003F3F2F2F2F00000000000000"
pomoc$(28) = "000000000000002F2F2F003F3F000000" + "0000003F3F002F2F2F00000000000000"
pomoc$(29) = "000000000000002F2F2F000000000000" + "0000000000002F2F2F00000000000000"
pomoc$(30) = "000000000000002F2F2F000000000000" + "0000000000002F2F2F00000000000000"
pomoc$(31) = "00000000003F3F3F3F00000000000000" + "000000000000003F3F3F3F0000000000"
FOR i = 0 TO 31
znakp2(i * 4 + 4) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 4 + 3) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 4 + 2) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakp2(i * 4 + 1) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 4 + 4) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 4 + 3) = VAL("&H" + MID$(pomoc$(i), 41, 8))
znakl2(i * 4 + 2) = VAL("&H" + MID$(pomoc$(i), 49, 8))
znakl2(i * 4 + 1) = VAL("&H" + MID$(pomoc$(i), 57, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H200080
znakl3(0) = &H200080
pomoc$(0) = "0000000000003F3F3F3F000000000000" + "0000000000003F3F3F3F000000000000"
pomoc$(1) = "00000000003F3F3F3F3F3F0000000000" + "00000000003F3F3F3F3F3F0000000000"
pomoc$(2) = "00000000006F6F6F3F3F3F0000000000" + "00000000003F3F3F6F6F6F0000000000"
pomoc$(3) = "00000000006F3F6F6F3F3F0000000000" + "00000000003F3F6F6F3F6F0000000000"
pomoc$(4) = "000000008F6F6F6F6F3F3F0000000000" + "00000000003F3F6F6F6F6F8F00000000"
pomoc$(5) = "00000000006F6F6F6F6F3F0000000000" + "00000000003F6F6F6F6F6F0000000000"
pomoc$(6) = "0000000000006F6F6F6F000000000000" + "0000000000006F6F6F6F000000000000"
pomoc$(7) = "000000000000006F6F1F000000000000" + "0000000000001F6F6F00000000000000"
pomoc$(8) = "000000000000007F1F1F7F0000000000" + "00000000007F1F1F7F00000000000000"
pomoc$(9) = "0000000000007F1F1F1F1F0000000000" + "00000000001F1F1F1F7F000000000000"
pomoc$(10) = "00000000007F1F1F1F1F1F0000000000" + "000000001F1F1F1F1F7F000000000000"
pomoc$(11) = "00000000001F1F1F1F1F1F7F00000000" + "000000001F1F1F1F1F1F7F0000000000"
pomoc$(12) = "000000007F1F1F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F1F7F00000000"
pomoc$(13) = "000000007F1F1F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F1F7F00000000"
pomoc$(14) = "000000007F1F1F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F1F7F00000000"
pomoc$(15) = "000000001F1F1F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F1F1F00000000"
pomoc$(16) = "000000001F1F1F3F3F3F3F1F00000000" + "000000001F3F3F3F3F1F1F1F00000000"
pomoc$(17) = "00000000006F6F2F2F2F2F6F00000000" + "000000006F2F2F2F2F6F6F0000000000"
pomoc$(18) = "0000000000006F2F2F2F2F6F00000000" + "000000006F2F2F2F2F6F000000000000"
pomoc$(19) = "0000000000002F2F2F2F2F0000000000" + "00000000002F2F2F2F2F000000000000"
pomoc$(20) = "0000000000002F2F2F2F2F0000000000" + "00000000002F2F2F2F2F000000000000"
pomoc$(21) = "00000000002F2F2F2F2F2F0000000000" + "00000000002F2F2F2F2F2F0000000000"
pomoc$(22) = "00000000002F2F2F2F2F2F0000000000" + "00000000002F2F2F2F2F2F0000000000"
pomoc$(23) = "000000009F2F2F2F2F2F2F0000000000" + "00000000002F2F2F2F2F2F9F00000000"
pomoc$(24) = "000000002F2F2F002F2F2F0000000000" + "00000000002F2F2F002F2F2F00000000"
pomoc$(25) = "000000002F2F2F002F2F2F0000000000" + "00000000002F2F2F002F2F2F00000000"
pomoc$(26) = "000000002F2F2F009F2F2F9F00000000" + "000000009F2F2F9F002F2F2F00000000"
pomoc$(27) = "000000002F2F2F00002F2F2F00000000" + "000000002F2F2F00002F2F2F00000000"
pomoc$(28) = "000000002F2F2F00002F2F2F00000000" + "000000002F2F2F00002F2F2F00000000"
pomoc$(29) = "0000003F3F3F3F00002F2F2F00000000" + "000000002F2F2F00003F3F3F3F000000"
pomoc$(30) = "000000000000000000002F2F2F000000" + "0000002F2F2F00000000000000000000"
pomoc$(31) = "00000000000000003F3F3F3F00000000" + "000000003F3F3F3F0000000000000000"
FOR i = 0 TO 31
znakp3(i * 4 + 4) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 4 + 3) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 4 + 2) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakp3(i * 4 + 1) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 4 + 4) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 4 + 3) = VAL("&H" + MID$(pomoc$(i), 41, 8))
znakl3(i * 4 + 2) = VAL("&H" + MID$(pomoc$(i), 49, 8))
znakl3(i * 4 + 1) = VAL("&H" + MID$(pomoc$(i), 57, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H200080
pomoc$(0) = "0000000000003F3F3F00000000000000"
pomoc$(1) = "00000000003F3F3F3F3F000000000000"
pomoc$(2) = "000000003F3F6F6F6F3F3F0000000000"
pomoc$(3) = "000000003F6F3F6F3F6F3F0000000000"
pomoc$(4) = "000000003F6F6F6F6F6F3F0000000000"
pomoc$(5) = "00000000006FCF8FCF6F000000000000"
pomoc$(6) = "0000000000006F8F6F00000000000000"
pomoc$(7) = "0000000000001F6F1F00000000000000"
pomoc$(8) = "000000007F1F1F1F1F1F7F0000000000"
pomoc$(9) = "0000001F1F1F1F1F1F1F1F1F00000000"
pomoc$(10) = "00007F1F1F1F1F1F1F1F1F1F7F000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F1F1F7F000000"
pomoc$(12) = "00001F1F7F1F1F1F1F1F7F1F1F000000"
pomoc$(13) = "007F1F1F7F1F1F1F1F1F7F1F1F7F0000"
pomoc$(14) = "00AF1FAF7F1F1F1F1F1F7FAF1FAF0000"
pomoc$(15) = "001F1F7FAF1F1F1F1F1FAF7F1F1F0000"
pomoc$(16) = "001F1F7F1F1F1F1F1F1F1F7F1F1F0000"
pomoc$(17) = "001F1F004FBFBFBFBFBF4F001F1F0000"
pomoc$(18) = "008F6F009F2F2F2F2F2F9F006F8F0000"
pomoc$(19) = "000000009F2F2F2F2F2F9F0000000000"
pomoc$(20) = "000000009F2F9F009F2F9F0000000000"
pomoc$(21) = "000000009F2F9F009F2F9F0000000000"
pomoc$(22) = "000000009F2F9F009F2F9F0000000000"
pomoc$(23) = "000000009F2F9F009F2F9F0000000000"
pomoc$(24) = "000000009F2F9F009F2F9F0000000000"
pomoc$(25) = "000000009F2F9F009F2F9F0000000000"
pomoc$(26) = "000000009F2F9F009F2F9F0000000000"
pomoc$(27) = "000000009F2F9F009F2F9F0000000000"
pomoc$(28) = "000000009F2F9F009F2F9F0000000000"
pomoc$(29) = "000000009F2F9F009F2F9F0000000000"
pomoc$(30) = "000000003F3F3F003F3F3F0000000000"
pomoc$(31) = "0000003F3F3F0000003F3F3F00000000"
FOR i = 0 TO 31
vertd1(i * 4 + 4) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 4 + 3) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 4 + 2) = VAL("&H" + MID$(pomoc$(i), 17, 8))
vertd1(i * 4 + 1) = VAL("&H" + MID$(pomoc$(i), 25, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFFFEFFFFFFFFFF"
pomoc$(5) = "FFFFFEFFFFFFFFFF"
pomoc$(6) = "FFFFFEFFFFFFFFFF"
pomoc$(7) = "FEFEFEFEFEFEFEFE"
FOR i = 0 TO 7:
cegla((i + 1) * 2) = VAL("&H" + MID$(pomoc$(i), 1, 8))
cegla((i + 1) * 2 - 1) = VAL("&H" + MID$(pomoc$(i), 9, 8))
NEXT i
REM komorka tla
tlo(0) = &H80040
pomoc$(0) = "0001000000000000"
pomoc$(1) = "0101010101010101"
pomoc$(2) = "0001000000000000"
pomoc$(3) = "0001000000000000"
pomoc$(4) = "0001000000000000"
pomoc$(5) = "0001000000000000"
pomoc$(6) = "0001000000000000"
pomoc$(7) = "0001000000000000"
FOR i = 0 TO 7:
tlo((i + 1) * 2) = VAL("&H" + MID$(pomoc$(i), 1, 8))
tlo((i + 1) * 2 - 1) = VAL("&H" + MID$(pomoc$(i), 9, 8))
NEXT i
REM przygotowanie tablic elementow wierszowych
FOR x = 0 TO 39
FOR y = 0 TO 10
PUT (x * 8, y * 8), tlo, PSET
NEXT y
NEXT x
FOR i = 0 TO 39
PUT (i * 8, 0), cegla, PSET
NEXT i
GET (0, 0)-(319, 7), ceg40
FOR i = 0 TO 16
PUT (i * 8, 8), cegla, PSET
PUT (312 - i * 8, 8), cegla, PSET
NEXT i
GET (0, 8)-(319, 15), ceg17plus17
FOR i = 0 TO 12
PUT (i * 8, 16), cegla, PSET
PUT (312 - i * 8, 16), cegla, PSET
NEXT i
GET (0, 16)-(319, 23), ceg13plus13
FOR i = 0 TO 3
PUT (i * 8, 24), cegla, PSET
PUT (312 - i * 8, 24), cegla, PSET
NEXT i
FOR i = 0 TO 19
PUT (i * 8 + 80, 24), cegla, PSET
NEXT i
GET (0, 24)-(319, 31), ceg4plus20plus4
FOR i = 0 TO 3
PUT (i * 8, 32), cegla, PSET
PUT (312 - i * 8, 32), cegla, PSET
NEXT i
GET (0, 32)-(319, 39), ceg4spc32plus4
PUT (0, 40), cegla, PSET
PUT (8, 40), cegla, PSET
PUT (304, 40), cegla, PSET
PUT (312, 40), cegla, PSET
GET (0, 40)-(319, 47), ceg1spc38ceg1
PUT (0, 48), cegla, PSET
PUT (8, 48), cegla, PSET
GET (0, 48)-(319, 55), ceg1spc39
PUT (304, 56), cegla, PSET
PUT (312, 56), cegla, PSET
GET (0, 56)-(319, 63), spc39ceg1
GET (0, 64)-(319, 71), spc40
REM RYSUNEK DONICZKI
doniczka$(0) = "AAAEEAAEEAAA"
doniczka$(1) = "AAEEEEEEEEAA"
doniczka$(2) = "AEEEEEEEEEEA"
doniczka$(3) = "AEEEEEEEEAEE"
doniczka$(4) = "EEAEAEEAEAEE"
doniczka$(5) = "EAAEAEEAEAAE"
doniczka$(6) = "EAEAAEEAAEAE"
doniczka$(7) = "EAEAAEEAAEAE"
doniczka$(8) = "AAAAAEEAAAAA"
doniczka$(9) = "AAAAAEEAAAAA"
doniczka$(10) = "AAAAAEEAAAAA"
doniczka$(11) = "AAAGGGGGGAAA"
doniczka$(12) = "AAAGGGGGGAAA"
doniczka$(13) = "AAAAGGGGAAAA"
doniczka$(14) = "AAAAGGGGAAAA"
doniczka$(15) = "AAAAGGGGAAAA"
REM RYSUNEK kamienia
kamien$(0) = "BAAJKPMPMPKAEABA"
kamien$(1) = "AKKFGODJPGMPKPAB"
kamien$(2) = "AKPJEPJPGKPOJKFA"
kamien$(3) = "APJILHKFHFOJHPGA"
kamien$(4) = "KFFJKIGONLLKFLDA"
kamien$(5) = "KPGOPDMPDDIGIJPB"
kamien$(6) = "NFHJILGEJOMPGEKA"
kamien$(7) = "MFGOMKJMFPHGOFMD"
kamien$(8) = "KGJNIGKFNOPNOGPB"
kamien$(9) = "MJMIFPEJMGJMIJKA"
kamien$(10) = "KPGEGKNKFPEMFPNA"
kamien$(11) = "NKAJHLOGOMGLCKAA"
kamien$(12) = "AJODEIHIIGHGOGAC"
kamien$(13) = "AJGCKOOHCJPKKGAA"
kamien$(14) = "DAAKJKKMGKNKAAAA"
kamien$(15) = "CBAADABAAACADBBC"
END SUB
SUB dreptanie
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182
REM odczytanie wartosci portu 97
stary.port = INP(97)
REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)
REM wlaczenie glosnika
OUT 97, nowy.port
REM najpierw mlodszy potem starszy bajt
t0 = PEEK(1132)
FOR i = 1 TO 10
OUT 66, 32: OUT 66, 2
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 32: OUT 66, 1
OUT 66, 32: OUT 66, 0
OUT 66, 104: OUT 66, 2
OUT 66, 48: OUT 66, 0
OUT 66, 250: OUT 66, 2
OUT 66, 32: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB palety
REM ****************** Ustawienie wlasnej wartosci barw
REM **************** kolejno, blue green red, kazdy max=6
REM rejestry tla - zaczyna od &H0
PALETTE 0, 10 * 65536 + 10 * 256 + 10
PALETTE 1, 9 * 65536 + 9 * 256 + 9
PALETTE 2, 47 * 65536 + 47 * 256 + 47
PALETTE 3, 63 * 65536 + 31 * 256 + 0
PALETTE 4, 0 * 65536 + 31 * 256 + 0
PALETTE 5, 0 * 65536 + 0 * 256 + 63: REM czerwien serca
REM rejestry gracza powinny byc kodowane &HnF od 1F
REM ze wzgledu na funkce PUT-OR
PALETTE &H1F, 0 * 65536 + 0 * 256 + 48: REM sweter
PALETTE &H2F, 63 * 65536 + 47 * 256 + 0: REM SPODNIE
PALETTE &H3F, 31 * 65536 + 31 * 256 + 31: REM SREDNIA SZAROSC
PALETTE &H4F, 15 * 65536 + 15 * 256 + 15: REM 1/4 SZAROSCI
PALETTE &H5F, 47 * 65536 + 47 * 256 + 47: REM 3/4 SZAROSCI
PALETTE &H6F, 46 * 65536 + 55 * 256 + 63: REM SKORA
PALETTE &H7F, 0 + 65536 + 0 * 256 + 31: REM pol sweter
PALETTE &H8F, 34 * 65536 + 40 * 256 + 46: REM 3/4 skora
PALETTE &H9F, 47 * 65536 + 38 * 256 + 0: REM 7/8 SPODNI
PALETTE &HAF, 0 * 65536 + 0 * 256 + 40: REM 3/4 swetra
PALETTE &HBF, 23 * 65536 + 23 * 256 + 23: REM 3/8 szarosci
PALETTE &HCF, 43 * 65536 + 43 * 256 + 51: REM 7/8 skora
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 19 * 65536 + 20 * 256 + 28: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
FOR i = 0 TO 15
PALETTE 230 + i, i * 4 * 65536 + i * 4 * 256 + i * 4: REM kamien
NEXT i
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM kodowanie _+++++++++++++++++++++++_okna++++_se_kw
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLLUHHHHHHUHLLLLLUU_______YQ_GN"
plansza$(1) = "##.....UHHHHHWHHPPPPP##____MI"
plansza$(2) = "##PPPPPHHUHHHHHWHHHHHUU_HE__________ZT"
plansza$(3) = "##QQHLLLLLHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPPHHHHHUHHHHHUU_______YR"
plansza$(5) = "##LLLLLHHHWWWWWWHHHHHUU____MG"
plansza$(6) = "##PPPPPWHHHHHH0HHHH00UU_LC__________FR"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHHWHHHLLLLLHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH.....WHHHHH##_______YQ_RN"
plansza$(9) = "UUUHHHHHHWPPPPPUUHHHHUU____MK"
plansza$(10) = "#WWWWLLLLLHHWWWHHHHHWWW_____________ZS"
plansza$(11) = "UUQQHPPPPPHHUHHHHHWWW##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###__________RN_FS"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "##HHHHHHWHHHHHUHHHHHWWW__________NG_ZS"
plansza$(15) = "##HHHHHHHWWHLLLLLHHHHHW_MC_YP____UP"
plansza$(16) = "UU000000000......0000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPPUUUUUU_MM__________ZP"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW_______NP_SM"
plansza$(19) = "##000HHHHHULLLLL000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPP000####____aM____UP"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHHHWWLLLLLUUUUUUUU____YK____SG"
plansza$(22) = "WHHHHHWWHHPPPPPWHHHHH##"
plansza$(23) = "##00HHHLLLLLHHHHHHHWWWW_______NP_UQ_ZR"
plansza$(24) = "UUUUQQQPPPPPQWQQQQQUUUU_YF_YJ_YO_SL_FR_BB1": REM startowa MaX=dU
plansza$(25) = "##HHHHHHHHHWWWHHHHHUUUU__________NG"
plansza$(26) = "UUUUHHHHHWWWWHHLLLLLUUU_______YR_SG"
plansza$(27) = "####00000UUUUUUPPPPPUUU_____________PS"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLLHWWWWWHHHLLLLL##_DD____aR_SS_ZT"
plansza$(29) = "##.....UUUUUUUUU.....##"
plansza$(30) = "WWPPPPPHHHUUUUUHPPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUULLLLLWHHHHH##____ML_______PT"
plansza$(32) = "UHHHHHWHHHPPPPP########____YL"
plansza$(33) = "UUUU00000UU00000UUUUUUU"
plansza$(34) = "UUUU000HHHHHWHHHHH000##____OG____SR_FQ"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UULLLLLUUU00UUU_____________KN"
plansza$(36) = "#######UUUPPPPPHLLLLL##__________SR"
plansza$(37) = "UU0HHHHHWHHHHHU0.....H#_______GS"
plansza$(38) = "##LLLLLU0000000UPPPPP##_EC__________ZT"
plansza$(39) = "##PPPPPWLLLLLHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPPUUUUUUUUUU"
plansza$(41) = "##HHHHHWHHHHH0000000UUU_CC_______ZF_PS"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLLL##########_EI__________ZL"
plansza$(43) = "######UU.....##########____SJ____ML"
plansza$(44) = "##LLLLL0PPPPP##########_____________KL"
plansza$(45) = "##PPPPP000#############____PH____ZJ"
plansza$(46) = "##LLLLL000#############__________EE"
plansza$(47) = "UUPPPPP0HHHHHHHHLLLLL##_____________FT"
plansza$(48) = "UUUUUUUUUUUUUUUUPPPPP##_LR"
REM lokalizacja serc
REM serca wiersza 1
serca(1, 1) = 1
serca(4, 1) = 1
REM serca wiersza 2
serca(2, 2) = 1
serca(6, 2) = 1
serca(7, 2) = 1
REM serca wiersza 3
serca(1, 3) = 1
serca(2, 3) = 1
serca(5, 3) = 1
serca(7, 3) = 1
REM serca wiersza 4
serca(1, 4) = 1
serca(3, 4) = 1
serca(4, 4) = 1
serca(5, 4) = 1
serca(6, 4) = 1
REM serca wiersza 5
serca(1, 5) = 1
serca(7, 5) = 1
REM serca wiersza 6
serca(2, 6) = 1
serca(5, 6) = 1
serca(7, 6) = 1
REM serca wiersza 7
serca(2, 7) = 1
serca(4, 7) = 1
serca(5, 7) = 1
END SUB
SUB rysowanie
COLOR 2
LOCATE 1, 1
FOR i = 0 TO 22
el$ = MID$(kod$, i + 1, 1)
REM PRINT wiersz$(ASC(el$))
IF el$ = "#" THEN PUT (0, i * 8), ceg40, PSET
IF el$ = "U" THEN PUT (0, i * 8), ceg17plus17, PSET
IF el$ = "0" THEN PUT (0, i * 8), ceg13plus13, PSET
IF el$ = "W" THEN PUT (0, i * 8), ceg4plus20plus4, PSET
IF el$ = "Q" THEN PUT (0, i * 8), ceg4spc32plus4, PSET
IF el$ = "H" THEN PUT (0, i * 8), ceg1spc38ceg1, PSET
IF el$ = "L" THEN PUT (0, i * 8), ceg1spc39, PSET
IF el$ = "P" THEN PUT (0, i * 8), spc39ceg1, PSET
IF el$ = "." THEN PUT (0, i * 8), spc40, PSET
NEXT i
el$ = MID$(kod$, 25, 1)
IF el$ = "" OR el$ = "_" THEN GOTO oknonz
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 26, 1)
yokna = (ASC(el$) - 65) * 8
LINE (xokna + 2, yokna + 2)-(xokna + 32, yokna + 21), 3, BF
LINE (xokna + 2, yokna + 2)-(xokna + 32, yokna + 2), 2
LINE (xokna + 2, yokna + 21)-(xokna + 32, yokna + 21), 2
LINE (xokna + 2, yokna + 2)-(xokna + 2, yokna + 21), 2
LINE (xokna + 12, yokna + 2)-(xokna + 12, yokna + 21), 2
LINE (xokna + 22, yokna + 2)-(xokna + 22, yokna + 21), 2
LINE (xokna + 32, yokna + 2)-(xokna + 32, yokna + 21), 2
oknonz:
REM okno niebiesko-zielone
el$ = MID$(kod$, 28, 1)
IF el$ = "" OR el$ = "_" THEN GOTO oknoziel
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 29, 1)
yokna = (ASC(el$) - 65) * 8
LINE (xokna + 2, yokna + 2)-(xokna + 32, yokna + 11), 3, BF
LINE (xokna + 2, yokna + 12)-(xokna + 32, yokna + 21), 4, BF
LINE (xokna + 2, yokna + 2)-(xokna + 32, yokna + 2), 2
LINE (xokna + 2, yokna + 21)-(xokna + 32, yokna + 21), 2
LINE (xokna + 2, yokna + 2)-(xokna + 2, yokna + 21), 2
LINE (xokna + 12, yokna + 2)-(xokna + 12, yokna + 21), 2
LINE (xokna + 22, yokna + 2)-(xokna + 22, yokna + 21), 2
LINE (xokna + 32, yokna + 2)-(xokna + 32, yokna + 21), 2
oknoziel:
REM okno niebiesko-zielone
el$ = MID$(kod$, 31, 1)
IF el$ = "" OR el$ = "_" THEN GOTO serce
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 32, 1)
yokna = (ASC(el$) - 65) * 8
LINE (xokna + 2, yokna + 2)-(xokna + 32, yokna + 21), 4, BF
LINE (xokna + 2, yokna + 2)-(xokna + 32, yokna + 2), 2
LINE (xokna + 2, yokna + 21)-(xokna + 32, yokna + 21), 2
LINE (xokna + 2, yokna + 2)-(xokna + 2, yokna + 21), 2
LINE (xokna + 12, yokna + 2)-(xokna + 12, yokna + 21), 2
LINE (xokna + 22, yokna + 2)-(xokna + 22, yokna + 21), 2
LINE (xokna + 32, yokna + 2)-(xokna + 32, yokna + 21), 2
serce:
REM serce
xserca = -20
yokna = -20
IF serca(roomx, roomy) = 0 THEN GOTO donica
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO donica
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 35, 1)
yokna = (ASC(el$) - 65) * 8
COLOR 5: LOCATE yokna / 8, xokna / 8: PRINT CHR$(3);
xserca = xokna - 8
yserca = yokna - 8
donica:
el$ = MID$(kod$, 37, 1)
IF el$ = "" OR el$ = "_" THEN GOTO kamien
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 38, 1)
yokna = (ASC(el$) - 65) * 8
FOR yd = 0 TO 15
FOR xd = 0 TO 11
COLOR ASC(MID$(doniczka$(yd), xd + 1, 1)) - 65
: PSET (xokna + xd, yokna + yd)
NEXT xd: NEXT yd
kamien:
el$ = MID$(kod$, 40, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 41, 1)
yokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 42, 1)
ilex = (ASC(el$) - 48)
FOR i = 1 TO ilex
FOR yd = 0 TO 15
FOR xd = 0 TO 15
COLOR ASC(MID$(kamien$(yd), xd + 1, 1)) - 65 + 230
: PSET (xokna + xd + (i - 1) * 16, yokna + yd)
NEXT xd: NEXT yd
NEXT i
koniecrysowania:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB
SUB zabranie
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182
REM odczytanie wartosci portu 97
stary.port = INP(97)
REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)
REM wlaczenie glosnika
OUT 97, nowy.port
REM najpierw mlodszy potem starszy bajt
t0 = PEEK(1132)
OUT 66, 32: OUT 66, 3
FOR i = 1 TO 3000: NEXT i
OUT 66, 204: OUT 66, 4
FOR i = 1 TO 3000: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
|
|