Autor |
Wiadomość |
Piotr-246 |
Wysłany: Pon 12:16, 21 Cze 2021 Temat postu: |
|
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
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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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
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
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLLUHHHHHHUHLLLLLUU_______YQ_GN"
plansza$(1) = "##.....UHHHHHWHHPPPPP##____MI"
plansza$(2) = "##PPPPPHHUHHHHHWHHHHHUU_HE"
plansza$(3) = "##QQHLLLLLHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPPHHHHHUHHHHHUU_______YR"
plansza$(5) = "##LLLLLHHHWWWWWWHHHHHUU____MG"
plansza$(6) = "##PPPPPWHHHHHH0HHHH00UU_LC_"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHHWHHHLLLLLHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH.....WHHHHH##_______YQ_RN"
plansza$(9) = "UUUHHHHHHWPPPPPUUHHHHUU____MK"
plansza$(10) = "#WWWWLLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHPPPPPHHUHHHHHWWW##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###__________RN"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "##HHHHHHWHHHHHUHHHHHWWW__________NG"
plansza$(15) = "##HHHHHHHWWHLLLLLHHHHHW_MC_YP____UP"
plansza$(16) = "UU000000000......0000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPPUUUUUU_MM"
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_UP"
plansza$(24) = "UUUUQQQPPPPPQWQQQQQUUUU_YF_YJ_YO_SL": REM startowa MaX=dU
plansza$(25) = "##HHHHHHHHHWWWHHHHHUUUU__________NG"
plansza$(26) = "UUUUHHHHHWWWWHHLLLLLUUU_______YR_SG"
plansza$(27) = "####00000UUUUUUPPPPPUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLLHWWWWWHHHLLLLL##_DD____aR_SR"
plansza$(29) = "##.....UUUUUUUUU.....##"
plansza$(30) = "WWPPPPPHHHUUUUUHPPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUULLLLLWHHHHH##____ML"
plansza$(32) = "UHHHHHWHHHPPPPP########____YL"
plansza$(33) = "UUUU00000UU00000UUUUUUU"
plansza$(34) = "UUUU000HHHHHWHHHHH000##____OG____SR"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UULLLLLUUU00UUU"
plansza$(36) = "#######UUUPPPPPHLLLLL##__________SR"
plansza$(37) = "UU0HHHHHWHHHHHU0.....H#_______GS"
plansza$(38) = "##LLLLLU0000000UPPPPP##_EC"
plansza$(39) = "##PPPPPWLLLLLHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPPUUUUUUUUUU"
plansza$(41) = "##HHHHHWHHHHH0000000UUU_CC_______ZF"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLLL##########_EI"
plansza$(43) = "######UU.....##########____SJ____ML"
plansza$(44) = "##LLLLL0PPPPP##########"
plansza$(45) = "##PPPPP000#############____PH____ZJ"
plansza$(46) = "##LLLLL000#############__________EE"
plansza$(47) = "UUPPPPP0HHHHHHHHLLLLL##"
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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
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 |
|
|
Piotr-246 |
Wysłany: Sob 10:04, 19 Cze 2021 Temat postu: |
|
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
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 24, 15: PRINT "L-SHIFT ALT P-SHIFT";
LOCATE 25, 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 24, 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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) = "00000000006FCF3FCF6F000000000000"
pomoc$(6) = "0000000000006FCF6F00000000000000"
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
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, 42 * 65536 + 42 * 256 + 50: 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
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLLUHHHHHHUHLLLLLUU_______YQ_GN"
plansza$(1) = "##.....UHHHHHWHHPPPPP##____MI"
plansza$(2) = "##PPPPPHHUHHHHHWHHHHHUU_HE"
plansza$(3) = "##QQHLLLLLHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPPHHHHHUHHHHHUU_______YR"
plansza$(5) = "##LLLLLHHHWWWWWWHHHHHUU____MG"
plansza$(6) = "##PPPPPWHHHHHH0HHHH00UU_LC_"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHHWHHHLLLLLHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH.....WHHHHH##_______YQ_RN"
plansza$(9) = "UUUHHHHHHWPPPPPUUHHHHUU____MK"
plansza$(10) = "#WWWWLLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHPPPPPHHUHHHHHWWW##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###__________RN"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHHW__________NG"
plansza$(15) = "##HHHHHHHWWHLLLLLHHHHHW_MC_YP____UP"
plansza$(16) = "UU000000000......0000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPPUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW_______NP_SM"
plansza$(19) = "##000HHHHHULLLLL000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPP000UUUU____aM____UP"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHHHWWLLLLLUUUUUUUU____YK____SG"
plansza$(22) = "WHHHHHWWHHPPPPPWHHHHH##"
plansza$(23) = "##00HHHLLLLLHHHHHHHWWWW_______NP_UP"
plansza$(24) = "UUUUQQQPPPPPQWQQQQQUUUU_YF_YJ_YO_SN": REM startowa MaX=dU
plansza$(25) = "##HHHHHHHHHWWWHHHHHUUUU__________NG"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU_______YR_SG"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLLHWWWWWHHHLLLLL##_DD____aR_SR"
plansza$(29) = "##.....#########.....##"
plansza$(30) = "WWPPPPPHHHUUUUUHPPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUULLLLLWHHHHH##____ML"
plansza$(32) = "UHHHHHWHHHPPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU000HHHHHWHHHHH000##____OG____SR"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UULLLLLUUU00UUU"
plansza$(36) = "#######UUUPPPPPHLLLLL##__________SR"
plansza$(37) = "UU0HHHHHWHHHHHU0.....H#_______GS"
plansza$(38) = "##LLLLLU0000000UPPPPP##_EC"
plansza$(39) = "##PPPPPWLLLLLHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPPUUUUUUUUUU"
plansza$(41) = "##HHHHHWHHHHH0000000UUU_CC_______ZF"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLLL##########_EI"
plansza$(43) = "######UU.....##########____SJ____ML"
plansza$(44) = "##LLLLL0PPPPP##########"
plansza$(45) = "##PPPPP000#############____PH____ZJ"
plansza$(46) = "##LLLLL000#############__________EE"
plansza$(47) = "UUPPPPP0HHHHHHHHLLLLL##"
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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
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 |
|
|
Piotr-246 |
Wysłany: Śro 12:26, 16 Cze 2021 Temat postu: |
|
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 23)
DIM pamiec(0 TO 96) 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
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 96) AS LONG
DIM SHARED znakl1(0 TO 96) AS LONG
DIM SHARED znakp2(0 TO 96) AS LONG
DIM SHARED znakl2(0 TO 96) AS LONG
DIM SHARED znakp3(0 TO 96) AS LONG
DIM SHARED znakl3(0 TO 96) AS LONG
DIM SHARED vertd1(0 TO 96) AS LONG
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 80: XS = 100: YS = 80: 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):
COLOR 15
LOCATE 24, 15: PRINT "L-SHIFT ALT P-SHIFT";
LOCATE 25, 2: COLOR 240: PRINT "T:"; t0; "/"; t1;
PRINT " ROOM:"; roomx; "/"; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 15, y + 23), pamiec
PUT (x, y), vertd1, PSET
liczsercaroom = 0
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 158 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(x + 19, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 + 26): 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 THEN dreptanie: REM dzwiek chodzenia
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
IF (INT(x / 12) = INT(xserca / 12)) AND (INT(y / 15) = INT((yserca - 12) / 15)) THEN GOSUB wziatek
REM ********************* zapamietanie tego co za ludzikiem
GET (x, y)-(x + 15, y + 23), 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
zabranie
REM SOUND 500, .5: SOUND 1500, .5
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) = &H180080
znakl1(0) = &H180080
pomoc$(0) = "0000000000003F3F3F3F000000000000" + "0000000000003F3F3F3F000000000000"
pomoc$(1) = "0000000000006F6F6F3F3F0000000000" + "00000000003F3F6F6F6F000000000000"
pomoc$(2) = "0000000000003F6F6F3F3F0000000000" + "00000000003F3F6F6F3F000000000000"
pomoc$(3) = "00000000008F6F6F6F6F3F0000000000" + "00000000003F0F6F6F6F8F0000000000"
pomoc$(4) = "0000000000006F6F6F6F3F0000000000" + "00000000003F6F6F6F6F000000000000"
pomoc$(5) = "00000000000000006F6F000000000000" + "0000000000006F6F0000000000000000"
pomoc$(6) = "000000000000007F1F1F7F0000000000" + "00000000007F1F1F7F00000000000000"
pomoc$(7) = "0000000000007F1F1F1F1F0000000000" + "00000000001F1F1F1F7F000000000000"
pomoc$(8) = "0000000000007F1F1F1F1F7F00000000" + "000000007F1F1F1F1F7F000000000000"
pomoc$(9) = "0000000000001F1F1F1F1F7F00000000" + "000000007F1F1F1F1F1F000000000000"
pomoc$(10) = "0000000000001F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F000000000000"
pomoc$(11) = "000000007F1F1F1F1F1F1F1F7F000000" + "0000007F1F1F1F1F1F1F1F7F00000000"
pomoc$(12) = "000000001F1F1F3F3F3F3F1F1F000000" + "0000001F1F3F3F3F3F1F1F1F00000000"
pomoc$(13) = "0000006F8F00002F2F2F2F008F6F0000" + "00006F8F002F2F2F2F00008F6F000000"
pomoc$(14) = "000000000000002F2F2F2F0000000000" + "00000000002F2F2F2F00000000000000"
pomoc$(15) = "0000000000002F2F2F2F2F0000000000" + "00000000002F2F2F2F2F000000000000"
pomoc$(16) = "0000000000002F2F002F2F0000000000" + "00000000002F2F002F2F000000000000"
pomoc$(17) = "00000000002F2F2F002F2F2F00000000" + "000000002F2F2F002F2F2F0000000000"
pomoc$(18) = "00000000002F2F0000002F2F00000000" + "000000002F2F0000002F2F0000000000"
pomoc$(19) = "00000000002F2F0000002F2F00000000" + "000000002F2F0000002F2F0000000000"
pomoc$(20) = "000000002F2F2F0000002F2F2F000000" + "0000002F2F2F0000002F2F2F00000000"
pomoc$(21) = "000000002F2F00000000002F2F000000" + "0000002F2F00000000002F2F00000000"
pomoc$(22) = "00003F3F3F2F00000000003F3F000000" + "0000003F3F00000000002F3F3F3F0000"
pomoc$(23) = "000000003F3F0000003F3F3F00000000" + "000000003F3F3F0000003F3F00000000"
FOR i = 0 TO 23
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) = &H180080
znakl2(0) = &H180080
pomoc$(0) = "0000000000003F3F3F3F000000000000" + "0000000000003F3F3F3F000000000000"
pomoc$(1) = "0000000000006F6F6F3F3F0000000000" + "00000000003F3F6F6F6F000000000000"
pomoc$(2) = "0000000000003F6F6F3F3F0000000000" + "00000000003F3F6F6F3F000000000000"
pomoc$(3) = "00000000008F6F6F6F6F3F0000000000" + "00000000003F6F6F6F6F8F0000000000"
pomoc$(4) = "0000000000006F6F6F6F3F0000000000" + "00000000003F6F6F6F6F000000000000"
pomoc$(5) = "00000000000000006F6F000000000000" + "0000000000006F6F0000000000000000"
pomoc$(6) = "000000000000007F1F1F7F0000000000" + "00000000007F1F1F7F00000000000000"
pomoc$(7) = "000000000000001F1F1F1F0000000000" + "00000000001F1F1F1F00000000000000"
pomoc$(8) = "000000000000001F1F1F1F0000000000" + "00000000001F1F1F1F00000000000000"
pomoc$(9) = "000000000000001F1F1F1F0000000000" + "00000000001F1F1F1F00000000000000"
pomoc$(10) = "000000000000001F1F1F1F0000000000" + "00000000001F1F1F1F00000000000000"
pomoc$(11) = "000000000000001F1F1F1F0000000000" + "00000000001F1F1F1F00000000000000"
pomoc$(12) = "000000000000003F1F1F3F0000000000" + "00000000003F1F1F3F00000000000000"
pomoc$(13) = "000000000000008F6F8F2F0000000000" + "00000000002F8F6F8F00000000000000"
pomoc$(14) = "000000000000002F2F2F2F0000000000" + "00000000002F2F2F2F00000000000000"
pomoc$(15) = "0000000000002F2F2F2F000000000000" + "0000000000002F2F2F2F000000000000"
pomoc$(16) = "0000000000002F2F2F2F000000000000" + "0000000000002F2F2F2F000000000000"
pomoc$(17) = "00000000002F2F2F2F2F000000000000" + "0000000000002F2F2F2F2F0000000000"
pomoc$(18) = "0000000000002F2F2F2F000000000000" + "0000000000002F2F2F2F000000000000"
pomoc$(19) = "000000000000002F2F2F3F0000000000" + "00000000003F2F2F2F00000000000000"
pomoc$(20) = "00000000000000002F2F3F3F00000000" + "000000003F3F2F2F0000000000000000"
pomoc$(21) = "00000000000000002F2F003F3F000000" + "0000003F3F002F2F0000000000000000"
pomoc$(22) = "00000000000000002F2F000000000000" + "0000000000002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F000000000000" + "0000000000003F3F3F3F000000000000"
FOR i = 0 TO 23
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) = &H180080
znakl3(0) = &H180080
pomoc$(0) = "0000000000003F3F3F3F000000000000" + "0000000000003F3F3F3F000000000000"
pomoc$(1) = "0000000000006F6F6F3F3F0000000000" + "00000000003F3F6F6F6F000000000000"
pomoc$(2) = "0000000000003F6F6F3F3F0000000000" + "00000000003F3F6F6F3F000000000000"
pomoc$(3) = "00000000008F6F6F6F6F3F0000000000" + "00000000003F6F6F6F6F8F0000000000"
pomoc$(4) = "0000000000006F6F6F6F3F0000000000" + "00000000006F6F6F6F6F000000000000"
pomoc$(5) = "00000000000000006F6F000000000000" + "0000000000006F6F0000000000000000"
pomoc$(6) = "000000000000007F1F1F7F0000000000" + "00000000007F1F1F7F00000000000000"
pomoc$(7) = "0000000000007F1F1F1F1F0000000000" + "00000000001F1F1F1F7F000000000000"
pomoc$(8) = "0000000000001F1F1F1F1F0000000000" + "00000000001F1F1F1F1F000000000000"
pomoc$(9) = "00000000007F1F1F1F1F1F7F00000000" + "000000007F1F1F1F1F1F7F0000000000"
pomoc$(10) = "00000000007F1F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F7F0000000000"
pomoc$(11) = "00000000001F1F1F1F1F1F1F00000000" + "000000001F1F1F1F1F1F1F0000000000"
pomoc$(12) = "00000000001F1F3F3F3F3F1F00000000" + "000000001F3F3F3F3F1F1F0000000000"
pomoc$(13) = "00000000006F8F2F2F2F2F6F00000000" + "000000006F2F2F2F2F8F6F0000000000"
pomoc$(14) = "000000000000002F2F2F2F0000000000" + "00000000002F2F2F2F00000000000000"
pomoc$(15) = "0000000000002F2F2F2F000000000000" + "0000000000002F2F2F2F000000000000"
pomoc$(16) = "0000000000002F2F2F2F000000000000" + "0000000000002F2F2F2F000000000000"
pomoc$(17) = "00000000002F2F2F2F2F000000000000" + "0000000000002F2F2F2F2F0000000000"
pomoc$(18) = "00000000002F2F002F2F000000000000" + "0000000000002F2F002F2F0000000000"
pomoc$(19) = "00000000002F2F002F2F2F0000000000" + "00000000002F2F2F002F2F0000000000"
pomoc$(20) = "00000000002F2F00002F2F0000000000" + "00000000002F2F00002F2F0000000000"
pomoc$(21) = "000000003F3F3F00002F2F0000000000" + "00000000002F2F00003F3F3F00000000"
pomoc$(22) = "000000000000000000002F2F00000000" + "000000002F2F00000000000000000000"
pomoc$(23) = "00000000000000003F3F3F3F00000000" + "000000003F3F3F3F0000000000000000"
FOR i = 0 TO 23
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), 56, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180080
pomoc$(0) = "00000000003F3F3F3F3F000000000000"
pomoc$(1) = "000000003F3F6F6F6F3F3F0000000000"
pomoc$(2) = "000000003F6F3F6F3F6F3F0000000000"
pomoc$(3) = "00000000006F6F6F6F6F000000000000"
pomoc$(4) = "00000000008F6F3F6F8F000000000000"
pomoc$(5) = "0000000000008F8F8F00000000000000"
pomoc$(6) = "000000007F1F1F1F1F1F7F0000000000"
pomoc$(7) = "0000001F1F1F1F1F1F1F1F1F00000000"
pomoc$(8) = "00007F1F1F1F1F1F1F1F1F1F7F000000"
pomoc$(9) = "00007F1F1F1F1F1F1F1F1F1F7F000000"
pomoc$(10) = "00007F1F7F1F1F1F1F1F7F1F7F000000"
pomoc$(11) = "00007F1F001F1F1F1F1F001F7F000000"
pomoc$(12) = "00007F1F003F3F3F3F3F001F7F000000"
pomoc$(13) = "00008F6F002F2F2F2F2F006F8F000000"
pomoc$(14) = "00000000002F2F2F2F2F000000000000"
pomoc$(15) = "00000000002F2F002F2F000000000000"
pomoc$(16) = "00000000002F2F002F2F000000000000"
pomoc$(17) = "00000000002F2F002F2F000000000000"
pomoc$(18) = "00000000002F2F002F2F000000000000"
pomoc$(19) = "00000000002F2F002F2F000000000000"
pomoc$(20) = "00000000002F2F002F2F000000000000"
pomoc$(21) = "00000000002F2F002F2F000000000000"
pomoc$(22) = "00000000003F3F003F3F000000000000"
pomoc$(23) = "000000003F3F0000003F3F0000000000"
FOR i = 0 TO 23
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) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
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
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU_______YQ_GN"
plansza$(1) = "##....UUHHHHWHHHHPPPP##____MI"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU_HE"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU_______YR"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU____MG"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU_LC_"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##_______YQ_RN"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU____MK"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB_YP____UP"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW_______NP_SM"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU____aM____UP"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHHWWWLLLLUUUUUUUUU____YK____SG"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP_UP"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO_SM": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU_______YR_SG"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DD____aR_SR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##____OG____SR"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###__________SR"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU_CC"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########_EI"
plansza$(43) = "######UU....###########____SJ____ML"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############____PH"
plansza$(46) = "##LLLL0000#############__________EE"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##_LR"
REM lokalizacja serc
REM serca wiersza 1
SERCA(1, 1) = 1
SERCA(1, 4) = 1
REM serca wiersza 2
SERCA(2, 2) = 1
SERCA(7, 2) = 1
REM serca wiersza 3
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(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
REM serca wiersza 7
SERCA(2, 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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
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 |
|
|
Piotr-246 |
Wysłany: Wto 21:19, 15 Cze 2021 Temat postu: |
|
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 23)
DIM pamiec(0 TO 72) 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
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 80: XS = 100: YS = 80: 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):
COLOR 15
LOCATE 24, 15: PRINT "L-SHIFT ALT P-SHIFT";
LOCATE 25, 2: COLOR 240: PRINT "T:"; t0; "/"; t1;
PRINT " ROOM:"; roomx; "/"; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 11, y + 23), pamiec
PUT (x, y), vertd1, PSET
liczsercaroom = 0
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN x = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF x + dx < 2 THEN x = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF y + dy > 158 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(x + 15, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(x + i, y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 THEN dreptanie: REM dzwiek chodzenia
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
IF (INT(x / 12) = INT(xserca / 12)) AND (INT(y / 15) = INT((yserca - 12) / 15)) THEN GOSUB wziatek
REM ********************* zapamietanie tego co za ludzikiem
GET (x, y)-(x + 11, y + 23), 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
zabranie
REM SOUND 500, .5: SOUND 1500, .5
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) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "0000003F3F3F3F3F00000000"
pomoc$(1) = "00003F3F6F6F6F3F3F000000"
pomoc$(2) = "00003F6F3F6F3F6F3F000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(8) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
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
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU_______YQ_GN"
plansza$(1) = "##....UUHHHHWHHHHPPPP##____MI"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU_HE"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU_______YR"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU____MG"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU_LC_"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##_______YQ_RN"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU____MK"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB_YP____UP"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW_______NP_SM"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU____aM____UP"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHHWWWLLLLUUUUUUUUU____YK____SG"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP_UP"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO_SM": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU_______YR_SG"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DD____aR_SR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##____OG____SR"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###__________SR"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU_CC"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########_EI"
plansza$(43) = "######UU....###########____SJ____ML"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############____PH"
plansza$(46) = "##LLLL0000#############__________EE"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##_LR"
REM lokalizacja serc
REM serca wiersza 1
SERCA(1, 1) = 1
SERCA(1, 4) = 1
REM serca wiersza 2
SERCA(2, 2) = 1
SERCA(7, 2) = 1
REM serca wiersza 3
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(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
REM serca wiersza 7
SERCA(2, 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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
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 |
|
|
Piotr-246 |
Wysłany: Wto 20:19, 15 Cze 2021 Temat postu: |
|
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 23)
DIM pamiec(0 TO 72) 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
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 80: XS = 100: YS = 80: 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):
COLOR 15
LOCATE 24, 15: PRINT "L-SHIFT ALT P-SHIFT";
LOCATE 25, 2: COLOR 240: PRINT "T:"; t0; "/"; t1;
PRINT " ROOM:"; roomx; "/"; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 11, y + 23), pamiec
PUT (x, y), vertd1, PSET
liczsercaroom = 0
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN x = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF x + dx < 2 THEN x = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF y + dy > 158 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(x + 15, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(x + i, y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 AND przebieranie = 0 THEN dreptanie: REM dzwiek chodzenia
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
IF (INT(x / 12) = INT(xserca / 12)) AND (INT(y / 12) = INT((yserca - 12) / 12)) THEN GOSUB wziatek
REM ********************* zapamietanie tego co za ludzikiem
GET (x, y)-(x + 11, y + 23), 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
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
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
zabranie
REM SOUND 500, .5: SOUND 1500, .5
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) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "0000003F3F3F3F3F00000000"
pomoc$(1) = "00003F3F6F6F6F3F3F000000"
pomoc$(2) = "00003F6F3F6F3F6F3F000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(8) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
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
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU_______YQ_GN"
plansza$(1) = "##....UUHHHHWHHHHPPPP##____MI"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU_HE"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU_______YR"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU____MG"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU_LC_"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##_______YQ_RN"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU____MK"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB_YP____UP"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW_______NP_SM"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU____aM____UP"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHHWWWLLLLUUUUUUUUU____YK____SG"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP_UP"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO_SM": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU_______YR_SG"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DD____aR_SR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##____OG____SR"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###__________SR"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU_CC"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########_EI"
plansza$(43) = "######UU....###########____SJ____ML"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############____PH"
plansza$(46) = "##LLLL0000#############__________EE"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##_LR"
REM lokalizacja serc
REM serca wiersza 1
SERCA(1, 1) = 1
SERCA(1, 4) = 1
REM serca wiersza 2
SERCA(2, 2) = 1
SERCA(7, 2) = 1
REM serca wiersza 3
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(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
REM serca wiersza 7
SERCA(2, 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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
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 |
|
|
Piotr-246 |
Wysłany: Wto 16:40, 20 Kwi 2021 Temat postu: |
|
DECLARE SUB dreptanie ()
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) 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
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 80: XS = 100: YS = 80: 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):
COLOR 15
LOCATE 24, 15: PRINT "L-SHIFT ALT P-SHIFT";
LOCATE 25, 2: COLOR 240: PRINT "T:"; t0; "/"; t1;
PRINT " ROOM:"; roomx; "/"; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 11, y + 23), pamiec
PUT (x, y), vertd1, PSET
liczsercaroom = 0
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN x = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF x + dx < 2 THEN x = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF y + dy > 158 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(x + 15, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(x + i, y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN dreptanie: REM dzwiek chodzenia
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
IF (INT(x / 12) = INT(xserca / 12)) AND (INT(y / 12) = INT((yserca - 12) / 12)) THEN GOSUB wziatek
REM ********************* zapamietanie tego co za ludzikiem
GET (x, y)-(x + 11, y + 23), 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
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
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
SOUND 500, .5: SOUND 1500, .5
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) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "000000003F3F3F0000000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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 18
OUT 66, 0: OUT 66, 1
OUT 66, 32: OUT 66, 2
OUT 66, 64: OUT 66, 2
OUT 66, 0: OUT 66, 1
OUT 66, 64: OUT 66, 2
OUT 66, 0: OUT 66, 1
OUT 66, 32: OUT 66, 2
OUT 66, 0: OUT 66, 1
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
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
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU_______YQ_GN"
plansza$(1) = "##....UUHHHHWHHHHPPPP##____MI"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU_HE"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU_______YR"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU____MG"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU_LC_"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##_______YQ_RN"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU____MK"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB_YP____UP"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW_______NP_SM"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU____aM____UP"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHHWWWLLLLUUUUUUUUU____YK____SG"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP_UP"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO_SM": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU_______YR_SG"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DD____aR_SR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##____ML____SR"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###__________SR"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU_CC"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########_EI"
plansza$(43) = "######UU....###########____SJ____ML"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############____PH"
plansza$(46) = "##LLLL0000#############__________EE"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##_LQ"
REM lokalizacja serc
REM serca wiersza 1
SERCA(1, 1) = 1
SERCA(1, 4) = 1
REM serca wiersza 2
SERCA(2, 2) = 1
SERCA(7, 2) = 1
REM serca wiersza 3
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(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
REM serca wiersza 7
SERCA(2, 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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
koniecrysowania:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Pon 16:13, 18 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) 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
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 11, y + 23), pamiec
PUT (x, y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
liczsercaroom = 0
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN x = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF x + dx < 2 THEN x = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF y + dy > 158 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(x + 15, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(x + i, y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN REM dzwiek chodzenia
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
IF (INT(x / 12) = INT(xserca / 12)) AND (INT(y / 12) = INT((yserca - 12) / 12)) THEN GOSUB wziatek
REM ********************* zapamietanie tego co za ludzikiem
GET (x, y)-(x + 11, y + 23), 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
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
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
SOUND 500, .5: SOUND 1500, .5
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) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "000000003F3F3F0000000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU_______YQ_GN"
plansza$(1) = "##....UUHHHHWHHHHPPPP##____MI"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU_HE"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##__________SM"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU_______YQ"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU____MK"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU_LE_"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##_LB"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##_______YQ_RN"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU____MK"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU____DJ____aM"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB_YP____UP"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW_______NP_SM"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU____aM____UP"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHHWWWLLLLUUUUUUUUU____YK____SG"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP_UP"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO_SM": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU_______YR_SG"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DD____aR_SR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##____ML____SR"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###__________SR"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###__________MM"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU_CC"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########_EI"
plansza$(43) = "######UU....###########____SK____ML"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############____PH"
plansza$(46) = "##LLLL0000#############__________DD"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##_LQ"
REM lokalizacja serc
REM serca wiersza 1
SERCA(1, 1) = 1
SERCA(1, 4) = 1
REM serca wiersza 2
SERCA(2, 2) = 1
SERCA(7, 2) = 1
REM serca wiersza 3
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(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
REM serca wiersza 7
SERCA(2, 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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
koniecrysowania:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Pon 13:09, 18 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) 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
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 11, y + 23), pamiec
PUT (x, y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
liczsercaroom = 0
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN x = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF x + dx < 2 THEN x = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF y + dy > 158 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(x + 15, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(x + i, y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: REM SOUND 30000, .025
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
IF (INT(x / 12) = INT(xserca / 12)) AND (INT(y / 12) = INT((yserca - 12) / 12)) THEN GOSUB wziatek
REM ********************* zapamietanie tego co za ludzikiem
GET (x, y)-(x + 11, y + 23), 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
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
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
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) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "000000003F3F3F0000000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP_SM"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO_SM": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
REM lokalizacja serc
serca(3, 4) = 1
serca(4, 4) = 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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
koniecrysowania:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Pon 12:28, 18 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) 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
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 100: y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (x, y)-(x + 11, y + 23), pamiec
PUT (x, y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN x = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF x + dx < 2 THEN x = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF y + dy > 158 THEN y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(x + 15, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(x + i, y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: SOUND 30000, .025
REM ******************** czy jest wziatek
REM IF (INT(x / 8) = INT(xserca / 8)) AND (INT(y / 8) = INT((yserca - 12) / 8)) THEN serca(roomx, roomy) = 0: liczserca = liczserca + 1: PUT (xserca, yserca), tlo, PSET
REM ************* otworzenie tego, co bylo za ludzikiem
PUT (XS, YS), pamiec, PSET
REM ******************** czy jest wziatek
IF (INT(x / 12) = INT(xserca / 12)) AND (INT(y / 12) = INT((yserca - 12) / 12)) THEN
serca(roomx, roomy) = 0:
liczserca = liczserca + 1:
PUT (xserca, yserca), tlo, PSET
REM LINE (xserca, yserca)-(xserca + 20, yserca + 20), 255, BF
END IF
REM zapamietanie tego co za ludzikiem
GET (x, y)-(x + 11, y + 23), 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
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
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
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "000000003F3F3F0000000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO_SM": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
REM lokalizacja serc
serca(4, 4) = 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 koniecrysowania
el$ = MID$(kod$, 34, 1)
IF el$ = "" OR el$ = "_" THEN GOTO koniecrysowania
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
koniecrysowania:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Pon 9:54, 18 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) AS LONG
DIM SHARED plansza$(0 TO 48)
DIM SHARED kod$
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
X = 100: Y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (X, Y)-(X + 11, Y + 23), pamiec
PUT (X, Y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN X = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF X + dx < 2 THEN X = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF Y + dy > 158 THEN Y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF Y + dy < 2 THEN Y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(X + 15, Y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(X + i, Y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia
PUT (XS, YS), pamiec, PSET
GET (X, Y)-(X + 11, Y + 23), 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
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
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
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "0000004F3F3F3F4F00000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MB"
plansza$(16) = "UU000000000.....00000##_WR"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_______NP"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YF_YJ_YO": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DR"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_______aR"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##____ML"
plansza$(32) = "UHHHHWWHHHHPPPP########____YL"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_______GS"
plansza$(38) = "##LLLLU00000000UPPPP###_EC"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
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 koniecrysowania
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
koniecrysowania:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Pon 6:04, 18 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) AS LONG
DIM SHARED plansza$(0 TO 48)
DIM SHARED kod$
REM cegielki planszy
DIM SHARED cegla(0 TO 16) AS LONG
DIM SHARED tlo(0 TO 16) AS LONG
DIM SHARED okno(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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
X = 100: Y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (X, Y)-(X + 11, Y + 23), pamiec
PUT (X, Y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN X = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF X + dx < 2 THEN X = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF Y + dy > 158 THEN Y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF Y + dy < 2 THEN Y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(X + 15, Y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(X + i, Y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia
PUT (XS, YS), pamiec, PSET
GET (X, Y)-(X + 11, Y + 23), 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
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
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
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F3F4F000000" + "0000004F3F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F0F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F3F4F000000" + "0000004F3F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000003F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F3F4F000000" + "0000004F3F3F3F3F00000000"
pomoc$(1) = "000000006F6F6F3F3F000000" + "0000003F3F6F6F6F00000000"
pomoc$(2) = "000000003F6F6F3F3F000000" + "0000003F3F6F6F3F00000000"
pomoc$(3) = "0000008F6F6F6F6F3F000000" + "0000003F6F6F6F6F8F000000"
pomoc$(4) = "000000006F6F6F6F3F000000" + "0000006F6F6F6F6F00000000"
pomoc$(5) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(6) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "0000004F3F3F3F4F00000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000006F6F6F6F6F00000000"
pomoc$(4) = "0000008F6F3F6F8F00000000"
pomoc$(5) = "000000008F8F8F0000000000"
pomoc$(6) = "00007F1F1F1F1F1F7F000000"
pomoc$(7) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F001F1F1F1F1F001F7F00"
pomoc$(12) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000003F3F003F3F00000000"
pomoc$(23) = "00003F3F0000003F3F000000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
okno(0) = &H80040
pomoc$(0) = "0202020202020202"
pomoc$(1) = "0203030303030302"
pomoc$(2) = "0203030303030302"
pomoc$(3) = "0203030303030302"
pomoc$(4) = "0203030303030302"
pomoc$(5) = "0203030303030302"
pomoc$(6) = "0203030303030302"
pomoc$(7) = "0202020202020202"
FOR i = 0 TO 7:
okno((i + 1) * 2) = VAL("&H" + MID$(pomoc$(i), 1, 8))
okno((i + 1) * 2 - 1) = VAL("&H" + MID$(pomoc$(i), 9, 8))
NEXT i
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MC"
plansza$(16) = "UU000000000.....00000##_WS"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_NQ"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YK": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DS"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_cS"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##_MM"
plansza$(32) = "UHHHHWWHHHHPPPP########_YM"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_GS"
plansza$(38) = "##LLLLU00000000UPPPP###_ED"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
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$ = "" THEN GOTO BEZOKNA
xokna = (ASC(EL$) - 65) * 8
EL$ = MID$(kod$, 26, 1)
yokna = (ASC(EL$) - 65) * 8
PUT (xokna, yokna), okno, PSET
PUT (xokna + 7, yokna), okno, PSET
PUT (xokna + 14, yokna), okno, PSET
PUT (xokna, yokna + 7), okno, PSET
PUT (xokna + 7, yokna + 7), okno, PSET
PUT (xokna + 14, yokna + 7), okno, PSET
BEZOKNA:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Nie 22:07, 17 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) AS LONG
DIM SHARED plansza$(0 TO 48)
DIM SHARED kod$
REM cegielki planszy
DIM SHARED cegla(0 TO 16) AS LONG
DIM SHARED tlo(0 TO 16) AS LONG
DIM SHARED okno(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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
X = 100: Y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (X, Y)-(X + 11, Y + 23), pamiec
PUT (X, Y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN X = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF X + dx < 2 THEN X = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF Y + dy > 158 THEN Y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF Y + dy < 2 THEN Y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(X + 15, Y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(X + i, Y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia
PUT (XS, YS), pamiec, PSET
GET (X, Y)-(X + 11, Y + 23), 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
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
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
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F0F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F6F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F6F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "0000004F3F3F3F4F00000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000008F6F5F6F8F00000000"
pomoc$(4) = "000000008F6F8F0000000000"
pomoc$(5) = "00007F1F1F1F1F1F7F000000"
pomoc$(6) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(7) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(12) = "7F1F002F2F2F2F2F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F002F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000002F2F002F2F00000000"
pomoc$(23) = "004F3F3F3F003F3F3F4F0000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
okno(0) = &H80040
pomoc$(0) = "0202020202020202"
pomoc$(1) = "0203030303030302"
pomoc$(2) = "0203030303030302"
pomoc$(3) = "0203030303030302"
pomoc$(4) = "0203030303030302"
pomoc$(5) = "0203030303030302"
pomoc$(6) = "0203030303030302"
pomoc$(7) = "0202020202020202"
FOR i = 0 TO 7:
okno((i + 1) * 2) = VAL("&H" + MID$(pomoc$(i), 1, 8))
okno((i + 1) * 2 - 1) = VAL("&H" + MID$(pomoc$(i), 9, 8))
NEXT i
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##_aI"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW_MC"
plansza$(16) = "UU000000000.....00000##_WS"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU_MM"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW_NQ"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU_YK": REM startowa MaX=dU
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##_DS"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU_cS"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##_MM"
plansza$(32) = "UHHHHWWHHHHPPPP########_YM"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#_GS"
plansza$(38) = "##LLLLU00000000UPPPP###_ED"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
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$ = "" THEN GOTO BEZOKNA
xokna = (ASC(EL$) - 65) * 8
EL$ = MID$(kod$, 26, 1)
yokna = (ASC(EL$) - 65) * 8
PUT (xokna, yokna), okno, PSET
PUT (xokna + 7, yokna), okno, PSET
PUT (xokna + 14, yokna), okno, PSET
PUT (xokna, yokna + 7), okno, PSET
PUT (xokna + 7, yokna + 7), okno, PSET
PUT (xokna + 14, yokna + 7), okno, PSET
BEZOKNA:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Nie 20:42, 17 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) AS LONG
DIM SHARED plansza$(0 TO 48)
DIM SHARED kod$
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
X = 100: Y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (X, Y)-(X + 11, Y + 23), pamiec
PUT (X, Y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN X = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF X + dx < 2 THEN X = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF Y + dy > 158 THEN Y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF Y + dy < 2 THEN Y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(X + 15, Y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(X + i, Y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia
PUT (XS, YS), pamiec, PSET
GET (X, Y)-(X + 11, Y + 23), 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
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
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
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F0F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000007F1F1F1F1F7F0000" + "00007F1F1F1F1F7F00000000"
pomoc$(9) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(10) = "000000001F1F1F1F1F1F0000" + "00001F1F1F1F1F1F00000000"
pomoc$(11) = "00007F1F1F1F1F1F1F1F7F00" + "007F1F1F1F1F1F1F1F7F0000"
pomoc$(12) = "00001F1F1F3F3F3F3F1F1F00" + "001F1F3F3F3F3F1F1F1F0000"
pomoc$(13) = "006F8F00002F2F2F2F008F6F" + "6F8F002F2F2F2F00008F6F00"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F6F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(8) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(9) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(10) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(11) = "00000000001F1F1F1F000000" + "0000001F1F1F1F0000000000"
pomoc$(12) = "00000000003F1F1F3F000000" + "0000003F1F1F3F0000000000"
pomoc$(13) = "00000000008F6F8F2F000000" + "0000002F8F6F8F0000000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F6F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "0000004F3F3F3F4F00000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000008F6F5F6F8F00000000"
pomoc$(4) = "000000008F6F8F0000000000"
pomoc$(5) = "00007F1F1F1F1F1F7F000000"
pomoc$(6) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(7) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(12) = "7F1F002F2F2F2F2F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F002F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000002F2F002F2F00000000"
pomoc$(23) = "004F3F3F3F003F3F3F4F0000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW"
plansza$(16) = "UU000000000.....00000##"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU": REM startowa
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##"
plansza$(32) = "UHHHHWWHHHHPPPP########"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHHWHHHH0000##"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#"
plansza$(38) = "##LLLLU00000000UPPPP###"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHHWHHHH000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
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
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Nie 19:15, 17 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) AS LONG
DIM SHARED plansza$(0 TO 48)
DIM SHARED kod$
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
X = 100: Y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (X, Y)-(X + 11, Y + 23), pamiec
PUT (X, Y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 1850: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN X = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF X + dx < 2 THEN X = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF Y + dy > 158 THEN Y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF Y + dy < 2 THEN Y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(X + 15, Y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(X + i, Y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia
PUT (XS, YS), pamiec, PSET
GET (X, Y)-(X + 11, Y + 23), 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
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
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
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F0F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F2F002F2F2F0000" + "00002F2F2F002F2F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "00002F2F2F0000002F2F2F00" + "002F2F2F0000002F2F2F0000"
pomoc$(21) = "00002F2F00000000002F2F00" + "002F2F00000000002F2F0000"
pomoc$(22) = "3F3F3F2F00000000003F3F00" + "003F3F00000000002F3F3F3F"
pomoc$(23) = "00003F3F0000003F3F3F0000" + "00003F3F3F0000003F3F0000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F6F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F7F00000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(8) = "000000001F1F1F1F1F7F0000" + "00007F1F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "00000000003F3F3F4F000000" + "0000004F3F3F3F0000000000"
pomoc$(1) = "00000000006F6F3F3F000000" + "0000003F3F6F6F0000000000"
pomoc$(2) = "000000006F3F6F6F3F000000" + "0000003F6F6F3F6F00000000"
pomoc$(3) = "00000000006F6F6F6F000000" + "0000006F6F6F6F0000000000"
pomoc$(4) = "0000000000006F6F00000000" + "000000006F6F000000000000"
pomoc$(5) = "00000000007F1F1F7F000000" + "0000007F1F1F7F0000000000"
pomoc$(6) = "00000000001F1F1F7F000000" + "0000007F1F1F1F0000000000"
pomoc$(7) = "000000007F1F1F1F1F000000" + "0000001F1F1F1F7F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000007F1F1F1F1F1F7F0000" + "00007F1F1F1F1F1F7F000000"
pomoc$(10) = "0000007F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F7F000000"
pomoc$(11) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "0000001F1F3F3F3F3F1F0000" + "00001F3F3F3F3F1F1F000000"
pomoc$(13) = "0000006F8F2F2F2F2F6F0000" + "00006F2F2F2F2F8F6F000000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "0000004F3F3F3F4F00000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000008F6F5F6F8F00000000"
pomoc$(4) = "000000008F6F8F0000000000"
pomoc$(5) = "00007F1F1F1F1F1F7F000000"
pomoc$(6) = "007F1F1F1F1F1F1F1F7F0000"
pomoc$(7) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "7F1F1F1F1F1F1F1F1F1F7F00"
pomoc$(10) = "7F1F7F1F1F1F1F1F7F1F7F00"
pomoc$(11) = "7F1F003F3F3F3F3F001F7F00"
pomoc$(12) = "7F1F002F2F2F2F2F001F7F00"
pomoc$(13) = "8F6F002F2F2F2F2F006F8F00"
pomoc$(14) = "0000002F2F002F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000002F2F002F2F00000000"
pomoc$(23) = "004F3F3F3F003F3F3F4F0000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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
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
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, 31 * 65536 + 23 * 256 + 0: REM POL SPODNIE
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW"
plansza$(16) = "UU000000000.....00000##"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU": REM startowa
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##"
plansza$(32) = "UHHHHWWHHHHPPPP########"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHWHHH0000####"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#"
plansza$(38) = "##LLLLU00000000UPPPP###"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHWWH000000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
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
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|
Piotr-246 |
Wysłany: Nie 16:13, 17 Sty 2021 Temat postu: |
|
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
DIM SHARED pomoc$(0 TO 23)
DIM pamiec(0 TO 72) AS LONG
DIM SHARED plansza$(0 TO 48)
DIM SHARED kod$
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 72) AS LONG
DIM SHARED znakl1(0 TO 72) AS LONG
DIM SHARED znakp2(0 TO 72) AS LONG
DIM SHARED znakl2(0 TO 72) AS LONG
DIM SHARED znakp3(0 TO 72) AS LONG
DIM SHARED znakl3(0 TO 72) AS LONG
DIM SHARED vertd1(0 TO 72) AS LONG
REM przykladowa
REM DIM zmienna(0 TO 72) AS LONG
REM zmienna(0) = &H180060
REM zmienna(1) = &HF0F0F0F
REM zmienna(2) = &HF0F0F0F
REM zmienna(3) = &HF0F0F0F
REM ************************* DANE STARTOWE
SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
X = 100: Y = 80: XS = 100: YS = 80: 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): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM **************** ustawienie gracza na planszy
GET (X, Y)-(X + 11, Y + 23), pamiec
PUT (X, Y), vertd1, PSET
COLOR 15
LOCATE 25, 10: PRINT "L-SHIFT CTRL P-SHIFT";
REM *************************** PETLA GLOWNA
PETLA:
dx = 0: dy = 0
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 450: 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 = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: 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 > 305 THEN X = 4: XS = 4: roomx = roomx + 1: GOTO rysuj
IF X + dx < 2 THEN X = 305: XS = 305: roomx = roomx - 1: GOTO rysuj
IF Y + dy > 158 THEN Y = 4: YS = 4: roomy = roomy + 1: GOTO rysuj
IF Y + dy < 2 THEN Y = 156: YS = 156: 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 23: xsuma = xsuma + POINT(X + 15, Y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 23: 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 11: ysuma = ysuma + POINT(X + i, Y + 26): NEXT i
IF dy < 0 THEN FOR i = 0 TO 11: 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 vert = 0 THEN SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia
PUT (XS, YS), pamiec, PSET
GET (X, Y)-(X + 11, Y + 23), 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
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
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
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ************************* ruch poziomy FAZA 1
znakp1(0) = &H180060
znakl1(0) = &H180060
pomoc$(0) = "000000003F3F3F4F00000000" + "000000004F3F3F3F00000000"
pomoc$(1) = "000000006F6F3F3F00000000" + "000000003F3F6F6F00000000"
pomoc$(2) = "0000006F3F6F6F3F00000000" + "000000003F0F6F3F6F000000"
pomoc$(3) = "000000006F6F6F6F00000000" + "000000006F6F6F6F00000000"
pomoc$(4) = "00000000006F6F0000000000" + "00000000006F6F0000000000"
pomoc$(5) = "00000000001F1F1F00000000" + "000000001F1F1F0000000000"
pomoc$(6) = "00000000001F1F1F00000000" + "000000001F1F1F0000000000"
pomoc$(7) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "0000001F1F1F1F1F1F000000" + "0000001F1F1F1F1F1F000000"
pomoc$(10) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(11) = "00001F1F001F1F1F1F1F0000" + "00001F1F1F1F1F001F1F0000"
pomoc$(12) = "00001F1F003F3F3F3F1F1F00" + "001F1F3F3F3F3F001F1F0000"
pomoc$(13) = "00006F6F002F2F2F2F6F6F00" + "006F6F2F2F2F2F006F6F0000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F2F000000" + "0000002F2F2F2F2F00000000"
pomoc$(16) = "000000002F2F002F2F000000" + "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(18) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(19) = "0000002F2F0000002F2F0000" + "00002F2F0000002F2F000000"
pomoc$(20) = "000000002F2F0000002F2F00" + "002F2F0000002F2F00000000"
pomoc$(21) = "000000002F2F000000002F2F" + "2F2F000000002F2F00000000"
pomoc$(22) = "000000002F2F0000003F3F3F" + "3F3F3F0000002F2F00000000"
pomoc$(23) = "0000003F3F3F000000000000" + "0000000000003F3F3F000000"
FOR i = 0 TO 23
znakp1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************************ FAZA 2
znakp2(0) = &H180060
znakl2(0) = &H180060
pomoc$(0) = "000000003F3F3F4F00000000" + "000000004F3F3F3F00000000"
pomoc$(1) = "000000006F6F3F3F00000000" + "000000003F3F6F6F00000000"
pomoc$(2) = "0000006F3F6F6F3F00000000" + "000000003F6F6F3F6F000000"
pomoc$(3) = "000000006F6F6F6F00000000" + "000000006F6F6F6F00000000"
pomoc$(4) = "00000000006F6F0000000000" + "00000000006F6F0000000000"
pomoc$(5) = "00000000001F1F1F00000000" + "000000001F1F1F0000000000"
pomoc$(6) = "00000000001F1F1F00000000" + "000000001F1F1F0000000000"
pomoc$(7) = "00000000001F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F1F000000"
pomoc$(10) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(11) = "00001F1F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F1F0000"
pomoc$(12) = "00001F1F003F3F3F3F1F1F00" + "001F1F3F3F3F3F001F1F0000"
pomoc$(13) = "00006F6F002F2F2F2F6F6F00" + "006F6F2F2F2F2F006F6F0000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "0000002F2F2F2F2F00000000" + "000000002F2F2F2F2F000000"
pomoc$(18) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(19) = "00000000002F2F2F3F000000" + "0000003F2F2F2F0000000000"
pomoc$(20) = "0000000000002F2F3F3F0000" + "00003F3F2F2F000000000000"
pomoc$(21) = "0000000000002F2F003F3F00" + "003F3F002F2F000000000000"
pomoc$(22) = "0000000000002F2F00000000" + "000000002F2F000000000000"
pomoc$(23) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
FOR i = 0 TO 23
znakp2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl2(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl2(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl2(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ ruch poziomy FAZA 3
znakp3(0) = &H180060
znakl3(0) = &H180060
pomoc$(0) = "000000003F3F3F4F00000000" + "000000004F3F3F3F00000000"
pomoc$(1) = "000000006F6F3F3F00000000" + "000000003F3F6F6F00000000"
pomoc$(2) = "0000006F3F6F6F3F00000000" + "000000003F6F6F3F6F000000"
pomoc$(3) = "000000006F6F6F6F00000000" + "000000006F6F6F6F00000000"
pomoc$(4) = "00000000006F6F0000000000" + "00000000006F6F0000000000"
pomoc$(5) = "00000000001F1F1F00000000" + "000000001F1F1F0000000000"
pomoc$(6) = "00000000001F1F1F00000000" + "000000001F1F1F0000000000"
pomoc$(7) = "000000001F1F1F1F00000000" + "000000001F1F1F1F00000000"
pomoc$(8) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F00000000"
pomoc$(9) = "000000001F1F1F1F1F000000" + "0000001F1F1F1F1F1F000000"
pomoc$(10) = "0000001F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(11) = "00001F1F1F1F1F1F1F1F0000" + "00001F1F1F1F1F1F1F000000"
pomoc$(12) = "00001F1F003F3F3F3F1F1F00" + "001F1F3F3F3F3F001F1F0000"
pomoc$(13) = "00006F6F002F2F2F2F6F6F00" + "006F6F2F2F2F2F006F6F0000"
pomoc$(14) = "00000000002F2F2F2F000000" + "0000002F2F2F2F0000000000"
pomoc$(15) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(16) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(17) = "000000002F2F2F2F00000000" + "000000002F2F2F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000" + "000000002F2F002F2F000000"
pomoc$(19) = "0000002F2F002F2F2F000000" + "0000002F2F2F002F2F000000"
pomoc$(20) = "0000002F2F00002F2F000000" + "0000002F2F00002F2F000000"
pomoc$(21) = "00003F3F3F00002F2F000000" + "0000002F2F00003F3F3F0000"
pomoc$(22) = "00000000000000002F2F0000" + "00002F2F0000000000000000"
pomoc$(23) = "0000000000003F3F3F3F0000" + "00003F3F3F3F000000000000"
FOR i = 0 TO 23
znakp3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
znakp3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
znakp3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
znakl3(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 25, 8))
znakl3(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 33, 8))
znakl3(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 41, 8))
NEXT i
REM ************************ fazy ruchu pionowego
REM Ludzik idacy w dol lub w gore
vertd1(0) = &H180060
pomoc$(0) = "000000003F3F3F0000000000"
pomoc$(1) = "0000003F6F6F6F3F00000000"
pomoc$(2) = "0000006F3F6F3F6F00000000"
pomoc$(3) = "0000006F6F5F6F6F000000000"
pomoc$(4) = "000000006F6F6F0000000000"
pomoc$(5) = "00004F1F1F1F1F1F4F000000"
pomoc$(6) = "00001F1F1F1F1F1F1F000000"
pomoc$(7) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(8) = "001F1F1F1F1F1F1F1F1F0000"
pomoc$(9) = "1F1F1F1F1F1F1F1F1F1F1F00"
pomoc$(10) = "1F1F001F1F1F1F1F001F1F00"
pomoc$(11) = "1F1F001F1F1F1F1F001F1F00"
pomoc$(12) = "1F1F003F3F3F3F3F001F1F00"
pomoc$(13) = "6F6F002F2F2F2F2F006F6F00"
pomoc$(14) = "0000002F2F2F2F2F00000000"
pomoc$(15) = "0000002F2F002F2F00000000"
pomoc$(16) = "0000002F2F002F2F00000000"
pomoc$(17) = "0000002F2F002F2F00000000"
pomoc$(18) = "0000002F2F002F2F00000000"
pomoc$(19) = "0000002F2F002F2F00000000"
pomoc$(20) = "0000002F2F002F2F00000000"
pomoc$(21) = "0000002F2F002F2F00000000"
pomoc$(22) = "0000002F2F002F2F00000000"
pomoc$(23) = "004F3F3F3F003F3F3F4F0000"
FOR i = 0 TO 23
vertd1(i * 3 + 3) = VAL("&H" + MID$(pomoc$(i), 1, 8))
vertd1(i * 3 + 2) = VAL("&H" + MID$(pomoc$(i), 9, 8))
vertd1(i * 3 + 1) = VAL("&H" + MID$(pomoc$(i), 17, 8))
NEXT i
END SUB
SUB cegly
cegla(0) = &H80040
pomoc$(0) = "FFFFFFFFFFFFFEFF"
pomoc$(1) = "FFFFFFFFFFFFFEFF"
pomoc$(2) = "FFFFFFFFFFFFFEFF"
pomoc$(3) = "FEFEFEFEFEFEFEFE"
pomoc$(4) = "FFFEFFFFFFFFFFFF"
pomoc$(5) = "FFFEFFFFFFFFFFFF"
pomoc$(6) = "FFFEFFFFFFFFFFFF"
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
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
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
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
REM rejestry przeszkod - powinny byc od &HFF wstecz
PALETTE &HFF, 27 * 65536 + 27 * 256 + 25: REM cegly
PALETTE &HFE, 34 * 65536 + 34 * 256 + 34: REM fugi
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)
REM ************ plansze wiersza roomy=1
plansza$(0) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHWHHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHWHHHHQQ##"
plansza$(4) = "##HHHPPPPHHHHHHHUHHHHUU"
plansza$(5) = "##LLLLHHHHWWWWWWWHHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"
REM ************ plansze wiersza roomy=2
plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHHHHHWPPPPUUUHHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"
REM ************* plansze wiersza roomy=3
plansza$(14) = "####HHHHHHWHHHHHUHHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLLHHHHHHW"
plansza$(16) = "UU000000000.....00000##"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUULLLLH000HHUU"
plansza$(20) = "UU00HHHHHWHPPPPH000UUUU"
REM ************ plansze wiersza roomy=4
plansza$(21) = "WWWHHHWWWWLLLLUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPPWWHHHHH##"
plansza$(23) = "##00HHHLLLLHHHHHHHHWWWW"
plansza$(24) = "UUUUQQQPPPPQQWQQQQUUUUU": REM startowa
plansza$(25) = "##HHHHWHHHHWWWHHHHUUUUU"
plansza$(26) = "UUUUHHHHHWWWWHHHHHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"
REM ****************** plansze wiersza roomy=5
plansza$(28) = "UULLLLHHWWWWWHHHHLLLL##"
plansza$(29) = "##....###########....##"
plansza$(30) = "WWPPPPHHHHUUUUUHHPPPPUU"
plansza$(31) = "UUUUHHHUUUHLLLLWWHHHH##"
plansza$(32) = "UHHHHWWHHHHPPPP########"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHWHHH0000####"
REM ******************* plansze wiersza roomy=6
plansza$(35) = "###00000UUULLLLUUU00UUU"
plansza$(36) = "#######UUUUPPPPHLLLL###"
plansza$(37) = "UU000HHHHWHHHHU0....HH#"
plansza$(38) = "##LLLLU00000000UPPPP###"
plansza$(39) = "##PPPPWWLLLLHHH000HH###"
plansza$(40) = "UUUUUU00PPPPUUUUUUUUUUU"
plansza$(41) = "##HHHWWH000000000000UUU"
REM ******************* plansze wiersza roomy=7
plansza$(42) = "UUUUUU00LLLL###########"
plansza$(43) = "######UU....###########"
plansza$(44) = "###LLLL0PPPP###########"
plansza$(45) = "###PPPP000#############"
plansza$(46) = "##LLLL0000#############"
plansza$(47) = "UUPPPP00HHHHHHHHWLLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUPPPP##"
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
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB |
|
|