Autor Wiadomość
Piotr-246
PostWysłany: Sob 20:58, 16 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
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) = "0F000000080808080000000F" + "0F000000080808080000000F"
pomoc$(1) = "000000000F0F080800000000" + "0000000008080F0F00000000"
pomoc$(2) = "000000000F0F0F0800000000" + "00000000080F0F0F00000000"
pomoc$(3) = "000000000F0F0F0800000000" + "00000000080F0F0F00000000"
pomoc$(4) = "00000000000F0F0000000000" + "00000000000F0F0000000000"
pomoc$(5) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(6) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(7) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(8) = "0000000C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(9) = "00000C0C000C0C0C0C000000" + "0000000C0C0C0C000C0C0000"
pomoc$(10) = "00000C0C000C0C0C0C000000" + "0000000C0C0C0C000C0C0000"
pomoc$(11) = "000C0C00000C0C0C0C000000" + "0000000C0C0C0C00000C0C00"
pomoc$(12) = "000F0F00000808080F000000" + "0000000F08080800000F0F00"
pomoc$(13) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(14) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(15) = "000000000B0B0B0B0B000000" + "0000000B0B0B0B0B00000000"
pomoc$(16) = "0000000B0B00000B0B000000" + "0000000B0B00000B0B000000"
pomoc$(17) = "0000000B0B00000B0B000000" + "0000000B0B00000B0B000000"
pomoc$(18) = "0000000B0B00000B0B000000" + "0000000B0B00000B0B000000"
pomoc$(19) = "000000000B0B00000B0B0000" + "00000B0B00000B0B00000000"
pomoc$(20) = "000000000B0B00000B0B0000" + "00000B0B00000B0B00000000"
pomoc$(21) = "000000000B0B00000B0B0000" + "00000B0B00000B0B00000000"
pomoc$(22) = "000000000B0B000707070000" + "0000070707000B0B00000000"
pomoc$(23) = "000000070707000000000000" + "000000000000070707000000"









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) = "000000000808080800000000" + "000000000808080800000000"
pomoc$(1) = "000000000F0F080800000000" + "0000000008080F0F00000000"
pomoc$(2) = "000000000F0F0F0800000000" + "00000000080F0F0F00000000"
pomoc$(3) = "000000000F0F0F0F00000000" + "00000000080F0F0F00000000"
pomoc$(4) = "00000000000F0F0000000000" + "00000000000F0F0000000000"
pomoc$(5) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(6) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(7) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(8) = "0000000C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(9) = "0000000C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(10) = "00000C0C000C0C0C0C000000" + "0000000C0C0C0C000C0C0000"
pomoc$(11) = "00000C0C000C0C0C0C000000" + "0000000C0C0C0C000C0C0000"
pomoc$(12) = "00000F0F000808080F000000" + "0000000F080808000F0F0000"
pomoc$(13) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(14) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(15) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(16) = "0000000B0B0B0B0B00000000" + "000000000B0B0B0B0B000000"
pomoc$(17) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(18) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(19) = "00000000000B0B0B07000000" + "000000070B0B0B0000000000"
pomoc$(20) = "0000000000000B0B07070000" + "000007070B0B000000000000"
pomoc$(21) = "0000000000000B0B00000700" + "000700000B0B000000000000"
pomoc$(22) = "0000000000000B0B00000000" + "000000000B0B000000000000"
pomoc$(23) = "000000000707070700000000" + "000000000707070700000000"


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) = "000000000808080800000000" + "000000000808080800000000"
pomoc$(1) = "000000000F0F080800000000" + "0000000008080F0F00000000"
pomoc$(2) = "000000000F0F0F0800000000" + "00000000080F0F0F00000000"
pomoc$(3) = "000000000F0F0F0F00000000" + "000000000F0F0F0F00000000"
pomoc$(4) = "00000000000F0F0000000000" + "00000000000F0F0000000000"
pomoc$(5) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(6) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(7) = "000000000C0C0C0C00000000" + "000000000C0C0C0C00000000"
pomoc$(8) = "0000000C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(9) = "0000000C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C0C0000"
pomoc$(10) = "00000C0C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C0C0000"
pomoc$(11) = "00000C0C000C0C0C0C000000" + "0000000C0C0C0C000C0C0000"
pomoc$(12) = "00000F0F000808080F000000" + "0000000F080808000F0F0000"
pomoc$(13) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(14) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(15) = "00000000000B0B0B00000000" + "000000000B0B0B0000000000"
pomoc$(16) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(17) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(18) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(19) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(20) = "0000000007070B0B0B000000" + "0000000B0B0B070700000000"
pomoc$(21) = "000000070700000B0B000000" + "0000000B0B00000707000000"
pomoc$(22) = "000000000000000B0B000000" + "0000000B0B00000000000000"
pomoc$(23) = "000000000007070707000000" + "000000070707070000000000"


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) = "000000000808080800000000"
pomoc$(1) = "000000000F0F0F0F00000000"
pomoc$(2) = "000000000F0F0F0F00000000"
pomoc$(3) = "000000000F0F0F0F00000000"
pomoc$(4) = "00000000000F0F0000000000"
pomoc$(5) = "0000000C0C0C0C0C0C000000"
pomoc$(6) = "000C0C0C0C0C0C0C0C0C0C00"
pomoc$(7) = "000C0C0C0C0C0C0C0C0C0C00"
pomoc$(8) = "0C0C0C0C0C0C0C0C0C0C0C0C"
pomoc$(9) = "0C0C0C0C0C0C0C0C0C0C0C0C"
pomoc$(10) = "0C0C000C0C0C0C0C0C000C0C"
pomoc$(11) = "0C0C000C0C0C0C0C0C000C0C"
pomoc$(12) = "0F0F00080808080808000F0F"
pomoc$(13) = "0000000B0B0B0B0B0B000000"
pomoc$(14) = "0000000B0B0B0B0B0B000000"
pomoc$(15) = "0000000B0B0B0B0B0B000000"
pomoc$(16) = "0000000B0B00000B0B000000"
pomoc$(17) = "0000000B0B00000B0B000000"
pomoc$(18) = "0000000B0B00000B0B000000"
pomoc$(19) = "0000000B0B00000B0B000000"
pomoc$(20) = "0000000B0B00000B0B000000"
pomoc$(21) = "0000000B0B00000B0B000000"
pomoc$(22) = "000000070700000707000000"
pomoc$(23) = "000707070700000707070700"


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) = "8181818181818281"
pomoc$(1) = "8181818181818281"
pomoc$(2) = "8181818181818281"
pomoc$(3) = "8282828282828282"
pomoc$(4) = "8182818181818181"
pomoc$(5) = "8182818181818181"
pomoc$(6) = "8182818181818181"
pomoc$(7) = "8282828282828282"

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) = "0000010101000000"
pomoc$(1) = "0001010001010000"
pomoc$(2) = "0101000000010100"
pomoc$(3) = "0100000000000101"
pomoc$(4) = "0101000000010100"
pomoc$(5) = "0001010001010000"
pomoc$(6) = "0000010101000000"
pomoc$(7) = "0000000100000000"

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
PALETTE 0, 10 * 65536 + 10 * 256 + 10
PALETTE 1, 9 * 65536 + 9 * 256 + 9
REM rejestry gracza takze po zsumowaniu z tlem
PALETTE 13, 0 * 65536 + 0 * 256 + 48: REM sweter
PALETTE 12, 0 * 65536 + 0 * 256 + 48: REM sweter
REM rejestry przeszkod
PALETTE 129, 27 * 65536 + 27 * 256 + 27: REM cegly
PALETTE 130, 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) = "##LLLHHUHHHHHHUHHHLLLUU"
plansza$(1) = "##...UUUHHHHHWHHHHPPP##"
plansza$(2) = "##PPPHHUHUHHHWHWHHHHHUU"
plansza$(3) = "##QQHLLLHHHHHHHWWHHQQ##"
plansza$(4) = "##HHHPPPHHHUUHHHUUHHHUU"
plansza$(5) = "##LLLHHHMWWWWWWWWWHHHUU"
plansza$(6) = "##PPPHWWHHH0HHHWHHH00UU"

REM ************ plansze wiersza roomy=2

plansza$(7) = "UHHHWWWHHHLLLHUHHHHHH##"
plansza$(8) = "#HHHHHHHHH...WWWHHHHH##"
plansza$(9) = "UUHHHWHHHWPPPHUUUUHHHUU"
plansza$(10) = "###WWWLLLHHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPHHHUHHHWWHHH##"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"

REM ************* plansze wiersza roomy=3

plansza$(14) = "####HHHHHMWMHHHVUVHHHWW"
plansza$(15) = "#HHHHWHHHWWHLLLHHHHHHHW"
plansza$(16) = "UU000000000.....00000##"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHWW"
plansza$(19) = "##000HHHHUUULLLH000HHUU"
plansza$(20) = "UU00HHHWHHHUPPPH000UUUU"

REM ************ plansze wiersza roomy=4

plansza$(21) = "WWWHHHWWWWLLLUUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHPPPHWWHHWWH##"
plansza$(23) = "##00HHHLLLHHHHHHHHHWWWW"
plansza$(24) = "UUUUQQQPPPQQQWQQQUUUUUU": REM startowa
plansza$(25) = "##HHHWWHHHWWWHHHUUUUUUU"
plansza$(26) = "UUUVHHHHWWWWHHHWWHHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"

REM ****************** plansze wiersza roomy=5

plansza$(28) = "UULLLHHHWWWWWHHHHHLLL##"
plansza$(29) = "##...#############...##"
plansza$(30) = "WWPPPHHHHUUUUUUHHHPPPUU"
plansza$(31) = "UUUUHHHUUUHLLLHWWHHHH##"
plansza$(32) = "UHHHHWWHHHHPPP#########"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHWHHH0000####"

REM ******************* plansze wiersza roomy=6

plansza$(35) = "###00000UUUULLLUUU00UUU"
plansza$(36) = "#######UUUUUPPPHWLLL###"
plansza$(37) = "UU000HHHWWHHHUU00...HH#"
plansza$(38) = "##LLLUU00000000UUPPP###"
plansza$(39) = "##PPPHWWLLLWHHH000HH###"
plansza$(40) = "UUUUUU00PPP0UUUUUUUUUUU"
plansza$(41) = "##HHHWWH000000000000UUU"


REM ******************* plansze wiersza roomy=7

plansza$(42) = "UUUUUU00LLL0###########"
plansza$(43) = "######UU...U###########"
plansza$(44) = "####LLL0PPP############"
plansza$(45) = "####PPP000#############"
plansza$(46) = "##LLLU0000#############"
plansza$(47) = "UUPPPH00HH000HHHWWLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUPPP##"


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
PostWysłany: Śro 12:16, 13 Sty 2021    Temat postu:

REM ************************* DANE STARTOWE

SCREEN 13
DEF SEG = 0

DIM cegla(0 TO 16) AS LONG
DIM dwiecegly(0 TO 32) AS LONG
DIM czterycegly(0 TO 64) AS LONG
DIM osiemcegiel(0 TO 128) AS LONG
DIM szesnasciecegiel(0 TO 256) AS LONG
DIM czterdziescicegiel(0 TO 640) AS LONG
DIM osiemdziesiatcegiel(0 TO 1280) AS LONG

cegla(0) = &H80040

FOR i = 1 TO 8: READ a1$, a2$
cegla(i * 2) = VAL("&H" + a1$)
cegla(i * 2 - 1) = VAL("&H" + a2$)
NEXT i

DATA "00000000","00000000"
DATA "01010101","00010101"
DATA "01010101","00010101"
DATA "01010101","00010101"
DATA "00000000","00000000"
DATA "00010101","01010101"
DATA "00010101","01010101"
DATA "00010101","01010101"

PUT (0, 0), cegla, PSET
PUT (8, 0), cegla, PSET

GET (0, 0)-(15, 7), dwiecegly
PUT (16, 0), dwiecegly, PSET

GET (0, 0)-(31, 7), czterycegly
PUT (32, 0), czterycegly, PSET

GET (0, 0)-(63, 7), osiemcegiel
PUT (64, 0), osiemcegiel, PSET

GET (0, 0)-(127, 7), szesnasciecegiel
PUT (128, 0), szesnasciecegiel, PSET
PUT (256, 0), osiemcegiel, PSET
GET (0, 0)-(319, 7), czterdziescicegiel

PUT (0, 8), czterdziescicegiel, PSET
GET (0, 0)-(319, 15), osiemdziesiatcegiel




REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)

DIM plansza$(0 TO 48)

REM ************ plansze wiersza roomy=1

plansza$(0) = "#LL0HHHUHHHHHHU3333WLLU"
plansza$(1) = "#..UUUUU44444WHHHHHUPP#"
plansza$(2) = "#PPHHHHUHUHHHWHWHHHUHHU"
plansza$(3) = "##QQHHLLHHHHHHHWWHHQQ##"
plansza$(4) = "#HHHHPPHHHHUUHHHHUUUHHU"
plansza$(5) = "##LL0HHHWWWWWWWWWWWHHHU"
plansza$(6) = "##PPHHWWHH00HHHWWHH00UU"

REM ************ plansze wiersza roomy=2

plansza$(7) = "UHHWWWWWHHLLHHUHHHHUHH#"
plansza$(8) = "#HHHHHHHHH..HWHWHWHWHH#"
plansza$(9) = "UU33W3333WPPHHUUUUUHHHU"
plansza$(10) = "###WWWLLHHHWWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPHHHHU44WWHHHHH#"
plansza$(12) = "UUHHHHHHHHH00HHHHHHHH##"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"

REM ************* plansze wiersza roomy=3

plansza$(14) = "####HHHHHHWHHHHHHUUHHHW"
plansza$(15) = "#HHHHW444WWHHLLHHHHHHHW"
plansza$(16) = "UU00000000000..000000##"
plansza$(17) = "WWWWWWWWWWWWWPP########"
plansza$(18) = "#3333333333333WWHHHHHHW"
plansza$(19) = "##0004444UUULL33000HHUU"
plansza$(20) = "UU00HHWWHHUUPPHH000UUUU"

REM ************ plansze wiersza roomy=4

plansza$(21) = "WWWHHHWWWWLLUUUUUUUUUUU"
plansza$(22) = "W33333WWHHZZHHWW44WWHH#"
plansza$(23) = "##00HHHLLHHW44WHHHWWWWW"
plansza$(24) = "###QQQQXXQQQQWWQQUUUUUU": REM startowa
plansza$(25) = "#HHWWWW3333WWHHUUUUUUUU"
plansza$(26) = "UUUUHHHHWWWWHHHWWWHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"

REM ****************** plansze wiersza roomy=5

plansza$(28) = "UULLHHHHWWWWWHHHHHHLLH#"
plansza$(29) = "##..###############..##"
plansza$(30) = "WHPPHHHHHUUUUUHHHHHPPUU"
plansza$(31) = "UUUHHHHUUHHHLLHWWHHHHH#"
plansza$(32) = "U3333WWHHHHHPP#########"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHWHHH0000####"

REM ******************* plansze wiersza roomy=6

plansza$(35) = "##000000UUUULLUUUU00UUU"
plansza$(36) = "#######UUUUUPPHHWWLL###"
plansza$(37) = "UU000HHWWHHUUU0000..HH#"
plansza$(38) = "##LLUUU00000000UUUPP###"
plansza$(39) = "##PPHHWWLLWWHHH000HH###"
plansza$(40) = "UUUUUU00ZZ00UUUUUUUUUUU"
plansza$(41) = "##HHWWHH000000000000UUU"


REM ******************* plansze wiersza roomy=7

plansza$(42) = "UUUUUU00LL00###########"
plansza$(43) = "######UU..UU###########"
plansza$(44) = "####LL00PP#############"
plansza$(45) = "####PP0000#############"
plansza$(46) = "##LLUU0000#############"
plansza$(47) = "UUPPHH00HH00000HHWWLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUUPP##"

REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI

DIM ZNAKP1(0 TO 32) AS LONG
DIM ZNAKL1(0 TO 32) AS LONG
DIM ZNAKP2(0 TO 32) AS LONG
DIM ZNAKL2(0 TO 32) AS LONG
DIM ZNAKP3(0 TO 32) AS LONG
DIM ZNAKL3(0 TO 32) AS LONG

REM ************************* ruch poziomy FAZA 1

ZNAKP1(0) = &H100040
ZNAKL1(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$:
ZNAKP1(i * 2) = VAL("&H" + a1$)
ZNAKP1(i * 2 - 1) = VAL("&H" + a2$)
ZNAKL1(i * 2) = VAL("&H" + a3$)
ZNAKL1(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000808","08000000","00000008","08080000"
DATA "00000F0F","08000000","00000008","0F0F0000"
DATA "00000F0F","0F000000","0000000F","0F0F0000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "0000000C","0C000000","0000000C","0C000000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "000C000C","0C0C0C00","000C0C0C","0C000C00"
DATA "000F0008","08080F00","000F0808","08000F00"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "00000B00","000B0000","00000B00","000B0000"
DATA "00000B00","000B0000","00000B00","000B0000"
DATA "0000000B","00000B00","000B0000","0B000000"
DATA "0000000B","00070707","07070700","0B000000"
DATA "00000707","00000000","00000000","07070000"

REM ************************************ FAZA 2

ZNAKP2(0) = &H100040
ZNAKL2(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$:
ZNAKP2(i * 2) = VAL("&H" + a1$)
ZNAKP2(i * 2 - 1) = VAL("&H" + a2$)
ZNAKL2(i * 2) = VAL("&H" + a3$)
ZNAKL2(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000808","08000000","00000008","08080000"
DATA "00000F0F","08000000","00000008","0F0F0000"
DATA "00000F0F","0F000000","0000000F","0F0F0000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "0000000C","0C000000","0000000C","0C000000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "000C000C","0C0C0C00","000C0C0C","0C000C00"
DATA "000F0008","08080F00","000F0808","08000F00"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "00000B0B","0B0B0000","00000B0B","0B0B0000"
DATA "000B0B00","0B000000","0000000B","000B0B00"
DATA "00000B0B","0B070700","0007070B","0B0B0000"
DATA "00000000","0B000700","0007000B","00000000"
DATA "00000000","0B000000","0000000B","00000000"
DATA "00000007","07070000","00000707","07000000"


REM ************************ ruch poziomy FAZA 3

ZNAKP3(0) = &H100040
ZNAKL3(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$:
ZNAKP3(i * 2) = VAL("&H" + a1$)
ZNAKP3(i * 2 - 1) = VAL("&H" + a2$)
ZNAKL3(i * 2) = VAL("&H" + a3$)
ZNAKL3(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000808","08000000","00000008","08080000"
DATA "00000F0F","08000000","00000008","0F0F0000"
DATA "00000F0F","0F000000","0000000F","0F0F0000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "0000000C","0C000000","0000000C","0C000000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "000C000C","0C0C0C00","000C0C0C","0C000C00"
DATA "000F0008","08080F00","000F0808","08000F00"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "00000B0B","0B0B0000","00000B0B","0B0B0000"
DATA "000B0B00","0B000000","0000000B","000B0B00"
DATA "00000B0B","0B000000","0000000B","0B0B0000"
DATA "00000707","0B000000","0000000B","07070000"
DATA "00000000","000B0000","00000B00","00000000"
DATA "00000000","07070700","00070707","00000000"


REM ************************ fazy ruchu pionowego

DIM vertd1(0 TO 32) AS LONG
DIM vertg1(0 TO 32) AS LONG
DIM vertd2(0 TO 32) AS LONG
DIM vertg2(0 TO 32) AS LONG
DIM vertd3(0 TO 32) AS LONG
DIM vertg3(0 TO 32) AS LONG

REM Ludzik idacy w dol lub w gore faza 1

vertd1(0) = &H100040
vertg1(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$
vertd1(i * 2) = VAL("&H" + a1$)
vertd1(i * 2 - 1) = VAL("&H" + a2$)
vertg1(i * 2) = VAL("&H" + a3$)
vertg1(i * 2 - 1) = VAL("&H" + a4$)

NEXT i

DATA "00000008","08080000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "00000C0C","0C0C0C00","00000C0C","0C0C0C00"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C000C","0C0C000C","000C000C","0C0C000C"
DATA "000F0008","0808000F","000F0008","0808000F"
DATA "0000000B","0B0B0000","0000000B","0B0B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "00000707","00070700","00000707","00070700"

REM Ludzik idacy w dol lub w gore faza 2

vertd2(0) = &H100040
vertg2(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$
vertd2(i * 2) = VAL("&H" + a1$)
vertd2(i * 2 - 1) = VAL("&H" + a2$)
vertg2(i * 2) = VAL("&H" + a3$)
vertg2(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000008","08080000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "00000C0C","0C0C0C00","00000C0C","0C0C0C00"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C000C","0C0C000C","000C000C","0C0C000C"
DATA "000F0008","0808000F","000F0008","0808000F"
DATA "0000000B","0B0B0000","0000000B","0B0B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "00000707","000B0000","00000707","000B0000"
DATA "00000000","000B0000","00000000","000B0000"
DATA "00000000","00070700","00000000","00070700"


REM Ludzik idacy w dol lub w gore faza 3

vertd3(0) = &H100040
vertg3(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$
vertd3(i * 2) = VAL("&H" + a1$)
vertd3(i * 2 - 1) = VAL("&H" + a2$)
vertg3(i * 2) = VAL("&H" + a3$)
vertg3(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000008","08080000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "00000C0C","0C0C0C00","00000C0C","0C0C0C00"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C000C","0C0C000C","000C000C","0C0C000C"
DATA "000F0008","0808000F","000F0008","0808000F"
DATA "0000000B","0B0B0000","0000000B","0B0B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","00070700","0000000B","00070700"
DATA "0000000B","00000000","0000000B","00000000"
DATA "00000707","00000000","00000707","00000000"





REM ********************* kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM wiersz$(35 TO 90):

DEF SEG = 0: REM to dla pomiarow predkosci

x = 20: y = 10
xs = 20: ys = 10
licz = -1
roomx = 4
roomy = 4

REM Ustawienie wlasnej wartosci barw
REM kolejno, blue green red, kazdy max=6
PALETTE 1, 0
PALETTE 2, 15 * 65536 + 15 * 256 + 15
PALETTE 3, 31 * 65536 + 31 * 256 + 31
REM dawne PALETTE 100, 63 * 65536 + 31 * 256 + 47
REM dawne PALETTE 101, 63 * 65536 + 15 * 256 + 0

REM ********** dane poszczegolnych elementow
mur2$ = CHR$(219) + CHR$(219):
mur4$ = mur2$ + mur2$: mur8$ = mur4$ + mur4$: mur16$ = mur8$ + mur8$

spc2$ = CHR$(32) + CHR$(32):
spc4$ = spc2$ + spc2$: spc8$ = spc4$ + spc4$: spc16$ = spc8$ + spc8$

REM kod elementu "#" - mur na cal szerokosc ekranu
wiersz$(35) = mur16$ + mur16$ + mur8$

REM kod elementu "L" - mur tylko na lewej krawedzi ekranu
wiersz$(76) = CHR$(219) + spc16$ + spc16$ + spc4$ + spc2$ + CHR$(32)

REM kod elementu "P" - mur tylko na prawej krawedzi ekranu
wiersz$(80) = spc16$ + spc16$ + spc4$ + spc2$ + CHR$(32) + CHR$(219)

REM kod elementu "." - pust przestrzen na calej szerokosci ekranu
wiersz$(46) = spc16$ + spc16$ + spc8$

REM kod elementu "U" - dziura na srodku muru
wiersz$(85) = mur16$ + mur2$ + spc4$ + mur2$ + mur16$

REM kod elenetu "H" - dwie sciany na obu krawedziach
wiersz$(72) = CHR$(219) + spc16$ + spc16$ + spc4$ + spc2$ + CHR$(219)

REM kod elementu "W" - dwie dziury w murze
wiersz$(87) = CHR$(219) + mur4$ + spc4$ + mur16$ + mur4$ + mur2$ + spc4$ + mur4$ + CHR$(219)

REM kod elementu "3" - trzy sciany w tym jedna po lewej
wiersz$(51) = CHR$(219) + spc8$ + spc4$ + CHR$(219) + spc16$ + spc8$ + CHR$(32) + CHR$(219)

REM kod elementu "4" - trzy sciany w tym jedna po prawej
wiersz$(52) = CHR$(219) + spc16$ + spc8$ + CHR$(32) + CHR$(219) + spc8$ + spc4$ + CHR$(219)

REM kod elementu "0" - mala przestrzen posrodku
wiersz$(48) = mur8$ + mur4$ + mur2$ + spc8$ + spc4$ + mur8$ + mur4$ + mur2$

REM kod elementu "S" - mur w jednej trzeciej z lewej
wiersz$(83) = mur8$ + mur4$ + mur2$ + spc16$ + spc8$ + spc2$

REM kod elementu "Z" - mur w jednej trzeciej z prawej
wiersz$(90) = spc16$ + spc8$ + spc2$ + mur8$ + mur4$ + mur2$

REM kod elementu "Q" - srednia przestrzen posrodku
wiersz$(81) = CHR$(219) + mur4$ + spc16$ + spc8$ + spc4$ + spc2$ + mur4$ + CHR$(219)

REM kod elementu "X" - sredni mur z prawej
wiersz$(88) = spc16$ + spc16$ + spc2$ + CHR$(32) + mur4$ + CHR$(219)

REM kod elementu "Y" - sredni mur z lewej
wiersz$(89) = mur4$ + CHR$(219) + spc16$ + spc16$ + spc2$ + CHR$(32)

REM ************************* WYBOR POMIESZCZENIA

rysuj:

kod$ = plansza$(roomx - 1 + (roomy - 1) * 7)

REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania
REM CLS - wylaczenie CLS zapobiega miganiu ekranu


COLOR 2

LOCATE 1, 1
PRINT wiersz$(ASC(MID$(kod$, 1, 1)))
PRINT wiersz$(ASC(MID$(kod$, 2, 1)))
PUT (0, 0), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 3, 1)))
PRINT wiersz$(ASC(MID$(kod$, 4, 1)))
PUT (0, 16), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 5, 1)))
PRINT wiersz$(ASC(MID$(kod$, 6, 1)))
PUT (0, 32), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 7, 1)))
PRINT wiersz$(ASC(MID$(kod$, 8, 1)))
PUT (0, 48), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 9, 1)))
PRINT wiersz$(ASC(MID$(kod$, 10, 1)))
PUT (0, 64), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 11, 1)))
PRINT wiersz$(ASC(MID$(kod$, 12, 1)))
PUT (0, 80), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 13, 1)))
PRINT wiersz$(ASC(MID$(kod$, 14, 1)))
PUT (0, 96), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 15, 1)))
PRINT wiersz$(ASC(MID$(kod$, 16, 1)))
PUT (0, 112), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 17, 1)))
PRINT wiersz$(ASC(MID$(kod$, 18, 1)))
PUT (0, 128), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 19, 1)))
PRINT wiersz$(ASC(MID$(kod$, 20, 1)))
PUT (0, 144), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 21, 1)))
PRINT wiersz$(ASC(MID$(kod$, 22, 1)))
PUT (0, 160), osiemdziesiatcegiel, OR
PRINT wiersz$(ASC(MID$(kod$, 23, 1)))
PUT (0, 176), osiemdziesiatcegiel, OR

LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM pomiar czasu rysowania
t1 = PEEK(1132): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM ustawienie gracza na planszy
PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET

REM *************************** PETLA GLOWNA

petla:

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 300: NEXT delay
REM ************************ sprawdzenie klawiszy

k$ = INKEY$
IF k$ = "" THEN GOTO petla

POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);

IF k$ = CHR$(27) THEN END

IF k$ = CHR$(0) + "M" THEN x = x + 1: obrot = 1: vert = 0
IF k$ = CHR$(0) + "K" THEN x = x - 1: obrot = -1: vert = 0
IF k$ = CHR$(0) + "H" THEN y = y - 1: obrot = 0: vert = -1
IF k$ = CHR$(0) + "P" THEN y = y + 1: obrot = 0: vert = 1

REM ************ sprawdzenie czy jest przejscie do innej planszy
REM ************ dla ludzika dwuznakowego!

IF x = 41 THEN x = 1: xs = 1: roomx = roomx + 1: GOTO rysuj
IF x = 0 THEN x = 40: xs = 40: roomx = roomx - 1: GOTO rysuj
IF y = 23 THEN y = 1: ys = 1: roomy = roomy + 1: GOTO rysuj
IF y = 0 THEN y = 23: ys = 23: roomy = roomy - 1: GOTO rysuj

REM *********** sprawdzenie czy ruch jest mozliwy

pobrany1 = SCREEN(y, x)
pobrany2 = SCREEN(y + 1, x)


REM *********** sprawdzenie czy cos mozna wziac

IF pobrany1 = 3 OR pobrany2 = 3 THEN SOUND 250, .5: SOUND 150, .5: GOTO ruch
IF pobrany1 = 4 OR pobrany2 = 4 THEN SOUND 1150, .5: SOUND 550, .5: GOTO ruch

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

REM ***************** ruch

ruch:
SOUND 100, .025: SOUND 30000, .025: SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci

LOCATE ys, xs: PRINT " ";
LOCATE ys + 1, xs: PRINT " ";

REM ************* rysowanie nowej postaci WEDLUG FAZY RUCHU

REM ************************** ruch w gore

IF vert = -1 THEN
przebiervert = przebiervert + 1
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg1, PSET
IF przebiervert = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg2, PSET
IF przebiervert = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg1, PSET
IF przebiervert = 3 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg3, PSET
END IF

REM ************************** ruch w dol

IF vert = 1 THEN
przebiervert = przebiervert + 1
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET
IF przebiervert = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd2, PSET
IF przebiervert = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET
IF przebiervert = 3 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd3, PSET

END IF

REM ************************** ruch w lewo

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
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 - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

GOTO petla
Piotr-246
PostWysłany: Śro 11:13, 13 Sty 2021    Temat postu: QuickBasic -eksperymenty

REM ************************* DANE STARTOWE

SCREEN 13
DEF SEG = 0

DIM cegla(0 TO 16) AS LONG
DIM dwiecegly(0 TO 32) AS LONG
DIM czterycegly(0 TO 64) AS LONG
DIM osiemcegiel(0 TO 128) AS LONG
DIM szesnasciecegiel(0 TO 256) AS LONG
DIM czterdziescicegiel(0 TO 640) AS LONG
DIM osiemdziesiatcegiel(0 TO 1280) AS LONG
cegla(0) = &H80040

FOR i = 1 TO 8: READ a1$, a2$
cegla(i * 2) = VAL("&H" + a1$)
cegla(i * 2 - 1) = VAL("&H" + a2$)
NEXT i

DATA "00000000","00000000"
DATA "01010101","00010101"
DATA "01010101","00010101"
DATA "01010101","00010101"
DATA "00000000","00000000"
DATA "00010101","01010101"
DATA "00010101","01010101"
DATA "00010101","01010101"

PUT (0, 0), cegla, PSET
PUT (8, 0), cegla, PSET

GET (0, 0)-(15, 7), dwiecegly
PUT (16, 0), dwiecegly, PSET

GET (0, 0)-(31, 7), czterycegly
PUT (32, 0), czterycegly, PSET

GET (0, 0)-(63, 7), osiemcegiel
PUT (64, 0), osiemcegiel, PSET

GET (0, 0)-(127, 7), szesnasciecegiel
PUT (128, 0), szesnasciecegiel, PSET
PUT (256, 0), osiemcegiel, PSET
GET (0, 0)-(319, 7), czterdziescicegiel

PUT (0, 8), czterdziescicegiel, PSET
GET (0, 0)-(319, 15), osiemdziesiatcegiel

PUT (0, 50), osiemdziesiatcegiel, PSET

FOR i = 0 TO 11
PUT (0, i * 16), osiemdziesiatcegiel, PSET
NEXT i



REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)

DIM plansza$(0 TO 48)

REM ************ plansze wiersza roomy=1

plansza$(0) = "#LL0HHHUHHHHHHU3333WLLU"
plansza$(1) = "#..UUUUU44444WHHHHHUPP#"
plansza$(2) = "#PPHHHHUHUHHHWHWHHHUHHU"
plansza$(3) = "##QQHHLLHHHHHHHWWHHQQ##"
plansza$(4) = "#HHHHPPHHHHUUHHHHUUUHHU"
plansza$(5) = "##LL0HHHWWWWWWWWWWWHHHU"
plansza$(6) = "##PPHHWWHH00HHHWWHH00UU"

REM ************ plansze wiersza roomy=2

plansza$(7) = "UHHWWWWWHHLLHHUHHHHUHH#"
plansza$(8) = "#HHHHHHHHH..HWHWHWHWHH#"
plansza$(9) = "UU33W3333WPPHHUUUUUHHHU"
plansza$(10) = "###WWWLLHHHWWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPHHHHU44WWHHHHH#"
plansza$(12) = "UUHHHHHHHHH00HHHHHHHH##"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"

REM ************* plansze wiersza roomy=3

plansza$(14) = "####HHHHHHWHHHHHHUUHHHW"
plansza$(15) = "#HHHHW444WWHHLLHHHHHHHW"
plansza$(16) = "UU00000000000..000000##"
plansza$(17) = "WWWWWWWWWWWWWPP########"
plansza$(18) = "#3333333333333WWHHHHHHW"
plansza$(19) = "##0004444UUULL33000HHUU"
plansza$(20) = "UU00HHWWHHUUPPHH000UUUU"

REM ************ plansze wiersza roomy=4

plansza$(21) = "WWWHHHWWWWLLUUUUUUUUUUU"
plansza$(22) = "W33333WWHHZZHHWW44WWHH#"
plansza$(23) = "##00HHHLLHHW44WHHHWWWWW"
plansza$(24) = "###QQQQXXQQQQWWQQUUUUUU": REM startowa
plansza$(25) = "#HHWWWW3333WWHHUUUUUUUU"
plansza$(26) = "UUUUHHHHWWWWHHHWWWHHUUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"

REM ****************** plansze wiersza roomy=5

plansza$(28) = "UULLHHHHWWWWWHHHHHHLLH#"
plansza$(29) = "##..###############..##"
plansza$(30) = "WHPPHHHHHUUUUUHHHHHPPUU"
plansza$(31) = "UUUHHHHUUHHHLLHWWHHHHH#"
plansza$(32) = "U3333WWHHHHHPP#########"
plansza$(33) = "UUUU0000UUUU0000UUUUUUU"
plansza$(34) = "UUUU0000HHHWHHH0000####"

REM ******************* plansze wiersza roomy=6

plansza$(35) = "##000000UUUULLUUUU00UUU"
plansza$(36) = "#######UUUUUPPHHWWLL###"
plansza$(37) = "UU000HHWWHHUUU0000..HH#"
plansza$(38) = "##LLUUU00000000UUUPP###"
plansza$(39) = "##PPHHWWLLWWHHH000HH###"
plansza$(40) = "UUUUUU00ZZ00UUUUUUUUUUU"
plansza$(41) = "##HHWWHH000000000000UUU"


REM ******************* plansze wiersza roomy=7

plansza$(42) = "UUUUUU00LL00###########"
plansza$(43) = "######UU..UU###########"
plansza$(44) = "####LL00PP#############"
plansza$(45) = "####PP0000#############"
plansza$(46) = "##LLUU0000#############"
plansza$(47) = "UUPPHH00HH00000HHWWLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUUPP##"

REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI

DIM ZNAKP1(0 TO 32) AS LONG
DIM ZNAKL1(0 TO 32) AS LONG
DIM ZNAKP2(0 TO 32) AS LONG
DIM ZNAKL2(0 TO 32) AS LONG
DIM ZNAKP3(0 TO 32) AS LONG
DIM ZNAKL3(0 TO 32) AS LONG

REM ************************* ruch poziomy FAZA 1

ZNAKP1(0) = &H100040
ZNAKL1(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$:
ZNAKP1(i * 2) = VAL("&H" + a1$)
ZNAKP1(i * 2 - 1) = VAL("&H" + a2$)
ZNAKL1(i * 2) = VAL("&H" + a3$)
ZNAKL1(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000808","08000000","00000008","08080000"
DATA "00000F0F","08000000","00000008","0F0F0000"
DATA "00000F0F","0F000000","0000000F","0F0F0000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "0000000C","0C000000","0000000C","0C000000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "000C000C","0C0C0C00","000C0C0C","0C000C00"
DATA "000F0008","08080F00","000F0808","08000F00"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "00000B00","000B0000","00000B00","000B0000"
DATA "00000B00","000B0000","00000B00","000B0000"
DATA "0000000B","00000B00","000B0000","0B000000"
DATA "0000000B","00070707","07070700","0B000000"
DATA "00000707","00000000","00000000","07070000"

REM ************************************ FAZA 2

ZNAKP2(0) = &H100040
ZNAKL2(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$:
ZNAKP2(i * 2) = VAL("&H" + a1$)
ZNAKP2(i * 2 - 1) = VAL("&H" + a2$)
ZNAKL2(i * 2) = VAL("&H" + a3$)
ZNAKL2(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000808","08000000","00000008","08080000"
DATA "00000F0F","08000000","00000008","0F0F0000"
DATA "00000F0F","0F000000","0000000F","0F0F0000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "0000000C","0C000000","0000000C","0C000000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "000C000C","0C0C0C00","000C0C0C","0C000C00"
DATA "000F0008","08080F00","000F0808","08000F00"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "00000B0B","0B0B0000","00000B0B","0B0B0000"
DATA "000B0B00","0B000000","0000000B","000B0B00"
DATA "00000B0B","0B070700","0007070B","0B0B0000"
DATA "00000000","0B000700","0007000B","00000000"
DATA "00000000","0B000000","0000000B","00000000"
DATA "00000007","07070000","00000707","07000000"


REM ************************ ruch poziomy FAZA 3

ZNAKP3(0) = &H100040
ZNAKL3(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$:
ZNAKP3(i * 2) = VAL("&H" + a1$)
ZNAKP3(i * 2 - 1) = VAL("&H" + a2$)
ZNAKL3(i * 2) = VAL("&H" + a3$)
ZNAKL3(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000808","08000000","00000008","08080000"
DATA "00000F0F","08000000","00000008","0F0F0000"
DATA "00000F0F","0F000000","0000000F","0F0F0000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "0000000C","0C000000","0000000C","0C000000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "00000C0C","0C0C0000","00000C0C","0C0C0000"
DATA "000C000C","0C0C0C00","000C0C0C","0C000C00"
DATA "000F0008","08080F00","000F0808","08000F00"
DATA "0000000B","0B0B0000","00000B0B","0B000000"
DATA "00000B0B","0B0B0000","00000B0B","0B0B0000"
DATA "000B0B00","0B000000","0000000B","000B0B00"
DATA "00000B0B","0B000000","0000000B","0B0B0000"
DATA "00000707","0B000000","0000000B","07070000"
DATA "00000000","000B0000","00000B00","00000000"
DATA "00000000","07070700","00070707","00000000"


REM ************************ fazy ruchu pionowego

DIM vertd1(0 TO 32) AS LONG
DIM vertg1(0 TO 32) AS LONG
DIM vertd2(0 TO 32) AS LONG
DIM vertg2(0 TO 32) AS LONG
DIM vertd3(0 TO 32) AS LONG
DIM vertg3(0 TO 32) AS LONG

REM Ludzik idacy w dol lub w gore faza 1

vertd1(0) = &H100040
vertg1(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$
vertd1(i * 2) = VAL("&H" + a1$)
vertd1(i * 2 - 1) = VAL("&H" + a2$)
vertg1(i * 2) = VAL("&H" + a3$)
vertg1(i * 2 - 1) = VAL("&H" + a4$)

NEXT i

DATA "00000008","08080000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "00000C0C","0C0C0C00","00000C0C","0C0C0C00"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C000C","0C0C000C","000C000C","0C0C000C"
DATA "000F0008","0808000F","000F0008","0808000F"
DATA "0000000B","0B0B0000","0000000B","0B0B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "00000707","00070700","00000707","00070700"

REM Ludzik idacy w dol lub w gore faza 2

vertd2(0) = &H100040
vertg2(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$
vertd2(i * 2) = VAL("&H" + a1$)
vertd2(i * 2 - 1) = VAL("&H" + a2$)
vertg2(i * 2) = VAL("&H" + a3$)
vertg2(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000008","08080000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "00000C0C","0C0C0C00","00000C0C","0C0C0C00"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C000C","0C0C000C","000C000C","0C0C000C"
DATA "000F0008","0808000F","000F0008","0808000F"
DATA "0000000B","0B0B0000","0000000B","0B0B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "00000707","000B0000","00000707","000B0000"
DATA "00000000","000B0000","00000000","000B0000"
DATA "00000000","00070700","00000000","00070700"


REM Ludzik idacy w dol lub w gore faza 3

vertd3(0) = &H100040
vertg3(0) = &H100040

FOR i = 1 TO 16: READ a1$, a2$, a3$, a4$
vertd3(i * 2) = VAL("&H" + a1$)
vertd3(i * 2 - 1) = VAL("&H" + a2$)
vertg3(i * 2) = VAL("&H" + a3$)
vertg3(i * 2 - 1) = VAL("&H" + a4$)
NEXT i

DATA "00000008","08080000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "0000000F","0F0F0000","00000008","08080000"
DATA "00000000","0F000000","00000000","0F000000"
DATA "00000C0C","0C0C0C00","00000C0C","0C0C0C00"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C0C0C","0C0C0C0C","000C0C0C","0C0C0C0C"
DATA "000C000C","0C0C000C","000C000C","0C0C000C"
DATA "000F0008","0808000F","000F0008","0808000F"
DATA "0000000B","0B0B0000","0000000B","0B0B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","000B0000","0000000B","000B0000"
DATA "0000000B","00070700","0000000B","00070700"
DATA "0000000B","00000000","0000000B","00000000"
DATA "00000707","00000000","00000707","00000000"





REM ********************* kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM wiersz$(35 TO 90):

DEF SEG = 0: REM to dla pomiarow predkosci

x = 20: y = 10
xs = 20: ys = 10
licz = -1
roomx = 4
roomy = 4

REM Ustawienie wlasnej wartosci barw
REM kolejno, blue green red, kazdy max=6
PALETTE 1, 0
PALETTE 2, 7 * 65536 + 7 * 256 + 7
PALETTE 3, 0 * 65536 + 0 * 256 + 47
PALETTE 100, 63 * 65536 + 31 * 256 + 47
PALETTE 101, 63 * 65536 + 15 * 256 + 0

REM ********** dane poszczegolnych elementow
mur2$ = CHR$(219) + CHR$(219):
mur4$ = mur2$ + mur2$: mur8$ = mur4$ + mur4$: mur16$ = mur8$ + mur8$

spc2$ = CHR$(32) + CHR$(32):
spc4$ = spc2$ + spc2$: spc8$ = spc4$ + spc4$: spc16$ = spc8$ + spc8$

REM kod elementu "#" - mur na cal szerokosc ekranu
wiersz$(35) = mur16$ + mur16$ + mur8$

REM kod elementu "L" - mur tylko na lewej krawedzi ekranu
wiersz$(76) = CHR$(177) + spc16$ + spc16$ + spc4$ + spc2$ + CHR$(32)

REM kod elementu "P" - mur tylko na prawej krawedzi ekranu
wiersz$(80) = spc16$ + spc16$ + spc4$ + spc2$ + CHR$(32) + CHR$(177)

REM kod elementu "." - pust przestrzen na calej szerokosci ekranu
wiersz$(46) = spc16$ + spc16$ + spc8$

REM kod elementu "U" - dziura na srodku muru
wiersz$(85) = mur16$ + mur2$ + spc4$ + mur2$ + mur16$

REM kod elenetu "H" - dwie sciany na obu krawedziach
wiersz$(72) = CHR$(177) + spc16$ + spc16$ + spc4$ + spc2$ + CHR$(177)

REM kod elementu "W" - dwie dziury w murze
wiersz$(87) = CHR$(177) + mur4$ + spc4$ + mur16$ + mur4$ + mur2$ + spc4$ + mur4$ + CHR$(177)

REM kod elementu "3" - trzy sciany w tym jedna po lewej
wiersz$(51) = CHR$(177) + spc8$ + spc4$ + CHR$(177) + spc16$ + spc8$ + CHR$(32) + CHR$(177)

REM kod elementu "4" - trzy sciany w tym jedna po prawej
wiersz$(52) = CHR$(177) + spc16$ + spc8$ + CHR$(32) + CHR$(177) + spc8$ + spc4$ + CHR$(177)

REM kod elementu "0" - mala przestrzen posrodku
wiersz$(48) = mur8$ + mur4$ + mur2$ + spc8$ + spc4$ + mur8$ + mur4$ + mur2$

REM kod elementu "S" - mur w jednej trzeciej z lewej
wiersz$(83) = mur8$ + mur4$ + mur2$ + spc16$ + spc8$ + spc2$

REM kod elementu "Z" - mur w jednej trzeciej z prawej
wiersz$(90) = spc16$ + spc8$ + spc2$ + mur8$ + mur4$ + mur2$

REM kod elementu "Q" - srednia przestrzen posrodku
wiersz$(81) = CHR$(177) + mur4$ + spc16$ + spc8$ + spc4$ + spc2$ + mur4$ + CHR$(177)

REM kod elementu "X" - sredni mur z prawej
wiersz$(88) = spc16$ + spc16$ + spc2$ + CHR$(32) + mur4$ + CHR$(177)

REM kod elementu "Y" - sredni mur z lewej
wiersz$(89) = mur4$ + CHR$(177) + spc16$ + spc16$ + spc2$ + CHR$(32)

REM ************************* WYBOR POMIESZCZENIA

rysuj:

kod$ = plansza$(roomx - 1 + (roomy - 1) * 7)

REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania
REM CLS - wylaczenie CLS zapobiega miganiu ekranu
COLOR 2

LOCATE 1, 1: PRINT wiersz$(ASC(MID$(kod$, 1, 1)))
PRINT wiersz$(ASC(MID$(kod$, 2, 1)))
PRINT wiersz$(ASC(MID$(kod$, 3, 1)))
PRINT wiersz$(ASC(MID$(kod$, 4, 1)))
PRINT wiersz$(ASC(MID$(kod$, 5, 1)))
PRINT wiersz$(ASC(MID$(kod$, 6, 1)))
PRINT wiersz$(ASC(MID$(kod$, 7, 1)))
PRINT wiersz$(ASC(MID$(kod$, 8, 1)))
PRINT wiersz$(ASC(MID$(kod$, 9, 1)))
PRINT wiersz$(ASC(MID$(kod$, 10, 1)))
PRINT wiersz$(ASC(MID$(kod$, 11, 1)))
PRINT wiersz$(ASC(MID$(kod$, 12, 1)))
PRINT wiersz$(ASC(MID$(kod$, 13, 1)))
PRINT wiersz$(ASC(MID$(kod$, 14, 1)))
PRINT wiersz$(ASC(MID$(kod$, 15, 1)))
PRINT wiersz$(ASC(MID$(kod$, 16, 1)))
PRINT wiersz$(ASC(MID$(kod$, 17, 1)))
PRINT wiersz$(ASC(MID$(kod$, 18, 1)))
PRINT wiersz$(ASC(MID$(kod$, 19, 1)))
PRINT wiersz$(ASC(MID$(kod$, 20, 1)))
PRINT wiersz$(ASC(MID$(kod$, 21, 1)))
PRINT wiersz$(ASC(MID$(kod$, 22, 1)))
PRINT wiersz$(ASC(MID$(kod$, 23, 1)))
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

FOR i = 0 TO 11
PUT (0, i * 16), osiemdziesiatcegiel, OR
NEXT i


REM pomiar czasu rysowania
t1 = PEEK(1132): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";
REM ustawienie gracza na planszy
PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET


REM *************************** PETLA GLOWNA

petla:

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 300: NEXT delay
REM ************************ sprawdzenie klawiszy

k$ = INKEY$
IF k$ = "" THEN GOTO petla

POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);

IF k$ = CHR$(27) THEN END

IF k$ = CHR$(0) + "M" THEN x = x + 1: obrot = 1: vert = 0
IF k$ = CHR$(0) + "K" THEN x = x - 1: obrot = -1: vert = 0
IF k$ = CHR$(0) + "H" THEN y = y - 1: obrot = 0: vert = -1
IF k$ = CHR$(0) + "P" THEN y = y + 1: obrot = 0: vert = 1

REM ************ sprawdzenie czy jest przejscie do innej planszy
REM ************ dla ludzika dwuznakowego!

IF x = 41 THEN x = 1: xs = 1: roomx = roomx + 1: GOTO rysuj
IF x = 0 THEN x = 40: xs = 40: roomx = roomx - 1: GOTO rysuj
IF y = 23 THEN y = 1: ys = 1: roomy = roomy + 1: GOTO rysuj
IF y = 0 THEN y = 23: ys = 23: roomy = roomy - 1: GOTO rysuj

REM *********** sprawdzenie czy ruch jest mozliwy

pobrany1 = SCREEN(y, x)
pobrany2 = SCREEN(y + 1, x)


REM *********** sprawdzenie czy cos mozna wziac

IF pobrany1 = 3 OR pobrany2 = 3 THEN SOUND 250, .5: SOUND 150, .5: GOTO ruch
IF pobrany1 = 4 OR pobrany2 = 4 THEN SOUND 1150, .5: SOUND 550, .5: GOTO ruch

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

REM ***************** ruch

ruch:
SOUND 100, .025: SOUND 30000, .025: SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci

LOCATE ys, xs: PRINT " ";
LOCATE ys + 1, xs: PRINT " ";

REM ************* rysowanie nowej postaci WEDLUG FAZY RUCHU

REM ************************** ruch w gore

IF vert = -1 THEN
przebiervert = przebiervert + 1
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg1, PSET
IF przebiervert = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg2, PSET
IF przebiervert = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg1, PSET
IF przebiervert = 3 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertg3, PSET
END IF

REM ************************** ruch w dol

IF vert = 1 THEN
przebiervert = przebiervert + 1
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET
IF przebiervert = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd2, PSET
IF przebiervert = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET
IF przebiervert = 3 THEN PUT ((x - 1) * 8, (y - 1) * 8), vertd3, PSET

END IF

REM ************************** ruch w lewo

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
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 - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

GOTO petla

Powered by phpBB © 2001, 2005 phpBB Group