Forum Życie Wieczne Strona Główna Życie Wieczne

 
 FAQFAQ   SzukajSzukaj   UżytkownicyUżytkownicy   GrupyGrupy   GalerieGalerie   RejestracjaRejestracja 
 ProfilProfil   Zaloguj się, by sprawdzić wiadomościZaloguj się, by sprawdzić wiadomości   ZalogujZaloguj 

Gra w QuickBasic-u
Idź do strony Poprzedni  1, 2, 3, 4, 5  Następny
 
Napisz nowy temat   Odpowiedz do tematu    Forum Życie Wieczne Strona Główna -> Offtopic
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Pią 21:15, 15 Sty 2021    Temat postu:

DECLARE SUB plansze ()
DECLARE SUB cegly ()
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

DIM pamiec(0 TO 32) AS LONG

REM ****************** Ustawienie wlasnej wartosci barw
REM **************** kolejno, blue green red, kazdy max=6

PALETTE 1, 11 * 65536 + 11 * 256 + 11
PALETTE 33, 31 * 65536 + 31 * 256 + 35
PALETTE 34, 15 * 65536 + 15 * 256 + 15


REM ************************* cegly

DIM SHARED cegla(0 TO 16) AS LONG
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

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 "21212121","21212221"
DATA "21212121","21212221"
DATA "21212121","21212221"
DATA "22222222","22222222"
DATA "21222121","21212121"
DATA "21222121","21212121"
DATA "21222121","21212121"
DATA "22222222","22222222"

REM SUB cegly - zapelnienie pozostalych tablic
cegly

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

DIM SHARED plansza$(0 TO 48)

REM SUB plansze - wypelnienie tablicy wygladu plansz
plansze

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 ************************* WYBOR POMIESZCZENIA

rysuj:

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

REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania



REM CLS
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;

REM pomiar czasu rysowania
t1 = PEEK(1132): LOCATE 24, 10: PRINT "--"; t0; t1; "--";
PRINT "Room:"; roomx; roomy; "--";

LOCATE 10, 18: COLOR 1: PRINT "START!"

REM ustawienie gracza na planszy
GET (x, y)-(x + 7, y + 15), pamiec
PUT (x, y), vertd1, PSET

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

k$ = INKEY$
IF k$ = "" THEN dy = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy

POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury

IF k$ = CHR$(27) THEN END

IF k$ = CHR$(0) + "K" OR k$ = "4" THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF k$ = CHR$(0) + "M" OR k$ = "6" THEN dx = 4: dy = 1: obrot = 1: vert = 0
IF k$ = CHR$(0) + "H" OR k$ = "8" THEN dy = -4: obrot = 0: vert = -1
IF k$ = CHR$(0) + "P" OR k$ = "2" THEN dy = 4: obrot = 0: vert = 1

IF k$ = CHR$(0) + "I" OR k$ = "9" THEN dx = 4: dy = -4: obrot = 1: vert = 0
IF k$ = CHR$(0) + "G" OR k$ = "7" THEN dx = -4: dy = -4: obrot = -1: vert = 0
IF k$ = CHR$(0) + "O" OR k$ = "1" THEN dx = -4: dy = 4: obrot = -1: vert = 0
IF k$ = CHR$(0) + "Q" OR k$ = "3" THEN dx = 4: dy = 4: obrot = 1: vert = 0

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 > 166 THEN y = 4: ys = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 162: ys = 162: roomy = roomy - 1: GOTO rysuj

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

REM kryterium graficzne
xsuma = 0
ysuma = 0
xmozliwy = 0
IF dx > 0 THEN FOR i = 0 TO 15: xsuma = xsuma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: xsuma = xsuma + POINT(x - 3, y + i): NEXT i
IF xsuma < 20 THEN xmozliwy = 1

IF dy > 0 THEN FOR i = 0 TO 7: ysuma = ysuma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: ysuma = ysuma + POINT(x + i, y - 3): NEXT i
IF ysuma < 20 THEN ymozliwy = 1
suma = xsuma + ysuma

REM ***** sprawdzenie czy cos mozna wziac - stare kryterium tekstowe
REM IF pobrany1 = 3 OR pobrany2 = 3 THEN SOUND 250, .5: SOUND 150, .5: GOTO ruch
REM IF pobrany1 = 4 OR pobrany2 = 4 THEN SOUND 1150, .5: SOUND 550, .5: GOTO ruch

REM sprawdzenie przeszkody. Przeszkoda sa punkty powyzej
REM okreslonej sumy rejestru koloru

IF suma < 27 THEN GOTO ruch
REM szczegolne przypadki
IF suma > 27 AND xmozliwy = 1 THEN dy = 0: GOTO czy
IF suma > 27 AND ymozliwy = 1 THEN dx = 0: GOTO czy
REM stare kryterium tekstowe IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

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
SOUND 100, .025: SOUND 30000, .025: SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia

PUT (xs, ys), pamiec, PSET
GET (x, y)-(x + 7, y + 15), pamiec
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, y), vertg1, OR
IF przebiervert = 1 THEN PUT (x, y), vertg2, OR
IF przebiervert = 2 THEN PUT (x, y), vertg1, OR
IF przebiervert = 3 THEN PUT (x, y), vertg3, OR
END IF

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

IF vert = 1 THEN
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT (x, y), vertd1, OR
IF przebiervert = 1 THEN PUT (x, y), vertd2, OR
IF przebiervert = 2 THEN PUT (x, y), vertd1, OR
IF przebiervert = 3 THEN PUT (x, y), vertd3, OR
przebiervert = przebiervert + 1
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, 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 cegly

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 plansze

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) = "##PPPHWWHH00HHMWMHH00UU"

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

plansza$(7) = "UHHHWWWHHHLLLHUHHHHHH##"
plansza$(8) = "#HHHHHHHHH...WWWHHHHH##"
plansza$(9) = "UUHHWHHHHWPPPHUUUUHHHUU"
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) = "UU00HHWWHHUUPPPH000UUUU"

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) = "UUPPPH00HH0000HHWWLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUPPP##"


END SUB
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Sob 9:26, 16 Sty 2021    Temat postu:

DECLARE SUB plansze ()
DECLARE SUB cegly ()
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

DIM pamiec(0 TO 32) AS LONG

REM ****************** Ustawienie wlasnej wartosci barw
REM **************** kolejno, blue green red, kazdy max=6

PALETTE 1, 9 * 65536 + 5 * 256 + 0
PALETTE 13, 0 * 65536 + 0 * 256 + 47: REM sweter
PALETTE 12, 0 * 65536 + 0 * 256 + 47: REM sweter
PALETTE 33, 35 * 65536 + 20 * 256 + 0
PALETTE 34, 25 * 65536 + 10 * 256 + 0


REM ************************* cegly

DIM SHARED cegla(0 TO 16) AS LONG
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

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 "21212121","21212221"
DATA "21212121","21212221"
DATA "21212121","21212221"
DATA "22222222","22222222"
DATA "21222121","21212121"
DATA "21222121","21212121"
DATA "21222121","21212121"
DATA "22222222","22222222"

REM SUB cegly - zapelnienie pozostalych tablic
cegly

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

DIM SHARED plansza$(0 TO 48)

REM SUB plansze - wypelnienie tablicy wygladu plansz
plansze

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 ************************* WYBOR POMIESZCZENIA

rysuj:

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

REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania



REM CLS
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;

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 + 7, y + 15), 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 250: NEXT delay
REM ************************ sprawdzenie klawiszy

ctrl = 0: lshift = 0: pshift = 0

k$ = INKEY$
REM klawisz ctrl - wznoszenie sie
IF (PEEK(1047) AND 4) = 4 THEN ctrl = 1
IF (PEEK(1047) AND 2) = 2 THEN lshift = 1
IF (PEEK(1047) AND 1) = 1 THEN pshift = 1

IF lshift = 0 AND pshift = 0 AND ctrl = 0 THEN dy = 1: vert = 1: obrot = 0: przebiervert = 0: GOTO czy

POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury

IF k$ = CHR$(27) THEN END

IF lshift = 1 THEN dx = -4: dy = 1: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 1: obrot = 1: vert = 0

PRINT pshift; lshift;
IF ctrl = 1 THEN dy = -4

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 > 166 THEN y = 4: ys = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 162: ys = 162: roomy = roomy - 1: GOTO rysuj

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

REM kryterium graficzne
xsuma = 0
ysuma = 0
xmozliwy = 0
IF dx > 0 THEN FOR i = 0 TO 15: xsuma = xsuma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: xsuma = xsuma + POINT(x - 3, y + i): NEXT i
IF xsuma < 20 THEN xmozliwy = 1

IF dy > 0 THEN FOR i = 0 TO 7: ysuma = ysuma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: ysuma = ysuma + POINT(x + i, y - 3): NEXT i
IF ysuma < 20 THEN ymozliwy = 1
suma = xsuma + ysuma

REM ***** sprawdzenie czy cos mozna wziac - stare kryterium tekstowe
REM IF pobrany1 = 3 OR pobrany2 = 3 THEN SOUND 250, .5: SOUND 150, .5: GOTO ruch
REM IF pobrany1 = 4 OR pobrany2 = 4 THEN SOUND 1150, .5: SOUND 550, .5: GOTO ruch

REM sprawdzenie przeszkody. Przeszkoda sa punkty powyzej
REM okreslonej sumy rejestru koloru

IF suma < 27 THEN GOTO ruch
REM szczegolne przypadki
IF suma > 27 AND xmozliwy = 1 THEN dy = 0: GOTO czy
IF suma > 27 AND ymozliwy = 1 THEN dx = 0: GOTO czy
REM stare kryterium tekstowe IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

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
SOUND 100, .025: SOUND 30000, .025: SOUND 100, .025: SOUND 30000, .025
REM ************* kasowanie starej postaci, otworzenie tego, jest za nia

PUT (xs, ys), pamiec, PSET
GET (x, y)-(x + 7, y + 15), pamiec
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, y), vertg1, OR
IF przebiervert = 1 THEN PUT (x, y), vertg2, OR
IF przebiervert = 2 THEN PUT (x, y), vertg1, OR
IF przebiervert = 3 THEN PUT (x, y), vertg3, OR
END IF

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

IF vert = 1 THEN
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT (x, y), vertd1, OR
IF przebiervert = 1 THEN PUT (x, y), vertd2, OR
IF przebiervert = 2 THEN PUT (x, y), vertd1, OR
IF przebiervert = 3 THEN PUT (x, y), vertd3, OR
przebiervert = przebiervert + 1
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, 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 cegly

COLOR 1
LINE (0, 0)-(319, 71), 1, BF
COLOR 0
FOR x = 0 TO 39: LINE (x * 8, 0)-(x * 8, 71): NEXT x
FOR y = 0 TO 10: LINE (0, y * 8)-(319, y * 8): NEXT y
COLOR 1
LOCATE 9, 10: PRINT "L-SHIFT CTRL P-SHIFT"

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 plansze

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) = "##PPPHWWHH00HHMWMHH00UU"

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

plansza$(7) = "UHHHWWWHHHLLLHUHHHHHH##"
plansza$(8) = "#HHHHHHHHH...WWWHHHHH##"
plansza$(9) = "UUHHWHHHHWPPPHUUUUHHHUU"
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) = "UU00HHWWHHUUPPPH000UUUU"

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) = "UUPPPH00HH0000HHWWLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUPPP##"


END SUB
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Sob 13:29, 16 Sty 2021    Temat postu:

DECLARE SUB plansze ()
DECLARE SUB cegly ()
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

DIM pamiec(0 TO 32) AS LONG

REM ****************** Ustawienie wlasnej wartosci barw
REM **************** kolejno, blue green red, kazdy max=6
REM rejestry tla
PALETTE 0, 11 * 65536 + 11 * 256 + 11
PALETTE 1, 9 * 65536 + 9 * 256 + 9
REM rejestry gracza takze po zsumowaniu z tlem
PALETTE 13, 0 * 65536 + 0 * 256 + 47: REM sweter
PALETTE 12, 0 * 65536 + 0 * 256 + 47: REM sweter
REM rejestry przeszkod
PALETTE 129, 27 * 65536 + 27 * 256 + 27: REM cegly
PALETTE 130, 34 * 65536 + 34 * 256 + 34: REM fugi


REM ************************* cegly

DIM SHARED cegla(0 TO 16) AS LONG

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

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 "81818181","81818281"
DATA "81818181","81818281"
DATA "81818181","81818281"
DATA "82828282","82828282"
DATA "81828181","81818181"
DATA "81828181","81818181"
DATA "81828181","81818181"
DATA "82828282","82828282"

DIM SHARED tlo(0 TO 16) AS LONG

tlo(0) = &H80040

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

DATA "00000101","01000000"
DATA "00010100","01010000"
DATA "01010000","00010100"
DATA "01000000","00000101"
DATA "01010000","00010100"
DATA "00010100","01010000"
DATA "00000101","01000000"
DATA "00000001","00000000"


REM SUB cegly - zapelnienie pozostalych tablic
cegly

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

DIM SHARED plansza$(0 TO 48)

REM SUB plansze - wypelnienie tablicy wygladu plansz
plansze

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 ************************* WYBOR POMIESZCZENIA

rysuj:

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

REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania



REM CLS
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;

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 + 7, y + 15), 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

k$ = INKEY$
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 k$ = CHR$(27) THEN END

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

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 > 166 THEN y = 4: ys = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 162: ys = 162: 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 15: xsuma = xsuma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: 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 7: ysuma = ysuma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: 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 + 7, y + 15), pamiec
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, y), vertg1, OR
IF przebiervert = 1 THEN PUT (x, y), vertg2, OR
IF przebiervert = 2 THEN PUT (x, y), vertg1, OR
IF przebiervert = 3 THEN PUT (x, y), vertg3, OR
END IF

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

IF vert = 1 THEN
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT (x, y), vertd1, OR
IF przebiervert = 1 THEN PUT (x, y), vertd2, OR
IF przebiervert = 2 THEN PUT (x, y), vertd1, OR
IF przebiervert = 3 THEN PUT (x, y), vertd3, OR
przebiervert = przebiervert + 1
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, 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 cegly

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 plansze

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) = "##PPPHWWHH00HHMWMHH00UU"

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

plansza$(7) = "UHHHWWWHHHLLLHUHHHHHH##"
plansza$(8) = "#HHHHHHHHH...WWWHHHHH##"
plansza$(9) = "UUHHWHHHHWPPPHUUUUHHHUU"
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) = "UU00HHWWHHUUPPPH000UUUU"

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) = "UUPPPH00HH0000HHWWLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUPPP##"


END SUB
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Sob 14:44, 16 Sty 2021    Temat postu:

DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()

DIM SHARED pomoc$(0 TO 15)
DIM pamiec(0 TO 32) AS LONG
DIM SHARED plansza$(0 TO 48)

DIM SHARED cegla(0 TO 16) AS LONG
DIM SHARED tlo(0 TO 16) AS LONG

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 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 ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** (roomy-1)*7+(roomx-1)

REM SUB plansze - wypelnienie tablicy wygladu plansz
plansze

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 ************************* WYBOR POMIESZCZENIA

rysuj:

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

REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania



REM CLS
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;

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 + 7, y + 15), 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

k$ = INKEY$
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 k$ = CHR$(27) THEN END

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

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 > 166 THEN y = 4: ys = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 162: ys = 162: 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 15: xsuma = xsuma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: 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 7: ysuma = ysuma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: 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 + 7, y + 15), pamiec
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, y), vertg1, OR
IF przebiervert = 1 THEN PUT (x, y), vertg2, OR
IF przebiervert = 2 THEN PUT (x, y), vertg1, OR
IF przebiervert = 3 THEN PUT (x, y), vertg3, OR
END IF

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

IF vert = 1 THEN
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT (x, y), vertd1, OR
IF przebiervert = 1 THEN PUT (x, y), vertd2, OR
IF przebiervert = 2 THEN PUT (x, y), vertd1, OR
IF przebiervert = 3 THEN PUT (x, y), vertd3, OR
przebiervert = przebiervert + 1
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, 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 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, 11 * 65536 + 11 * 256 + 11
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) = "##PPPHWWHH00HHMWMHH00UU"

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) = "UU00HHHWHHUUPPPH000UUUU"

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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Sob 15:43, 16 Sty 2021    Temat postu:

DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()

DIM SHARED pomoc$(0 TO 15)
DIM pamiec(0 TO 32) 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 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
DIM vertd1(0 TO 32) 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 ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI

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

REM Ludzik idacy w dol lub w gore

vertd1(0) = &H100040

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


NEXT i

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



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 + 7, y + 15), 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$
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 k$ = CHR$(27) THEN END

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 > 166 THEN y = 4: ys = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 162: ys = 162: 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 15: xsuma = xsuma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: 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 7: ysuma = ysuma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: 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 + 7, y + 15), 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 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, 11 * 65536 + 11 * 256 + 11
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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Sob 18:30, 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 15)
DIM pamiec(0 TO 32) 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 32) AS LONG
DIM SHARED ZNAKL1(0 TO 32) AS LONG
DIM SHARED ZNAKP2(0 TO 32) AS LONG
DIM SHARED ZNAKL2(0 TO 32) AS LONG
DIM SHARED ZNAKP3(0 TO 32) AS LONG
DIM SHARED ZNAKL3(0 TO 32) AS LONG
DIM SHARED vertd1(0 TO 32) 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 + 7, y + 15), 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 > 166 THEN y = 4: ys = 4: roomy = roomy + 1: GOTO rysuj
IF y + dy < 2 THEN y = 162: ys = 162: 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 15: xsuma = xsuma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: 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 7: ysuma = ysuma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: 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 + 7, y + 15), 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) = &H100040
ZNAKL1(0) = &H100040

pomoc$(0) = "0000080808000000" + "0000000808080000"
pomoc$(1) = "00000F0F08000000" + "000000080F0F0000"
pomoc$(2) = "00000F0F0F000000" + "0000000F0F0F0000"
pomoc$(3) = "000000000F000000" + "000000000F000000"
pomoc$(4) = "0000000C0C000000" + "0000000C0C000000"
pomoc$(5) = "00000C0C0C0C0000" + "00000C0C0C0C0000"
pomoc$(6) = "00000C0C0C0C0000" + "00000C0C0C0C0000"
pomoc$(7) = "000C000C0C0C0C00" + "000C0C0C0C000C00"
pomoc$(8) = "000F000808080F00" + "000F080808000F00"
pomoc$(9) = "0000000B0B0B0000" + "00000B0B0B000000"
pomoc$(10) = "0000000B0B0B0000" + "00000B0B0B000000"
pomoc$(11) = "00000B00000B0000" + "00000B00000B0000"
pomoc$(12) = "00000B00000B0000" + "00000B00000B0000"
pomoc$(13) = "0000000B00000B00" + "000B00000B000000"
pomoc$(14) = "0000000B00070707" + "070707000B000000"
pomoc$(15) = "0000070700000000" + "0000000007070000"

FOR i = 1 TO 16
ZNAKP1(i * 2) = VAL("&H" + MID$(pomoc$(i - 1), 1, 8))
ZNAKP1(i * 2 - 1) = VAL("&H" + MID$(pomoc$(i - 1), 9, 8))
ZNAKL1(i * 2) = VAL("&H" + MID$(pomoc$(i - 1), 17, 8))
ZNAKL1(i * 2 - 1) = VAL("&H" + MID$(pomoc$(i - 1), 25, 8))
NEXT i

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

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

pomoc$(0) = "0000080808000000" + "0000000808080000"
pomoc$(1) = "00000F0F08000000" + "000000080F0F0000"
pomoc$(2) = "00000F0F0F000000" + "0000000F0F0F0000"
pomoc$(3) = "000000000F000000" + "000000000F000000"
pomoc$(4) = "0000000C0C000000" + "0000000C0C000000"
pomoc$(5) = "00000C0C0C0C0000" + "00000C0C0C0C0000"
pomoc$(6) = "00000C0C0C0C0000" + "00000C0C0C0C0000"
pomoc$(7) = "000C000C0C0C0C00" + "000C0C0C0C000C00"
pomoc$(8) = "000F000808080F00" + "000F080808000F00"
pomoc$(9) = "0000000B0B0B0000" + "00000B0B0B000000"
pomoc$(10) = "00000B0B0B0B0000" + "00000B0B0B0B0000"
pomoc$(11) = "000B0B000B000000" + "0000000B000B0B00"
pomoc$(12) = "00000B0B0B070700" + "0007070B0B0B0000"
pomoc$(13) = "000000000B000700" + "0007000B00000000"
pomoc$(14) = "000000000B000000" + "0000000B00000000"
pomoc$(15) = "0000000707070000" + "0000070707000000"

FOR i = 1 TO 16
ZNAKP2(i * 2) = VAL("&H" + MID$(pomoc$(i - 1), 1, 8))
ZNAKP2(i * 2 - 1) = VAL("&H" + MID$(pomoc$(i - 1), 9, 8))
ZNAKL2(i * 2) = VAL("&H" + MID$(pomoc$(i - 1), 17, 8))
ZNAKL2(i * 2 - 1) = VAL("&H" + MID$(pomoc$(i - 1), 25, 8))
NEXT i


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

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

pomoc$(0) = "0000080808000000" + "0000000808080000"
pomoc$(1) = "00000F0F08000000" + "000000080F0F0000"
pomoc$(2) = "00000F0F0F000000" + "0000000F0F0F0000"
pomoc$(3) = "000000000F000000" + "000000000F000000"
pomoc$(4) = "0000000C0C000000" + "0000000C0C000000"
pomoc$(5) = "00000C0C0C0C0000" + "00000C0C0C0C0000"
pomoc$(6) = "00000C0C0C0C0000" + "00000C0C0C0C0000"
pomoc$(7) = "000C000C0C0C0C00" + "000C0C0C0C000C00"
pomoc$(8) = "000F000808080F00" + "000F080808000F00"
pomoc$(9) = "0000000B0B0B0000" + "00000B0B0B000000"
pomoc$(10) = "00000B0B0B0B0000" + "00000B0B0B0B0000"
pomoc$(11) = "000B0B000B000000" + "0000000B000B0B00"
pomoc$(12) = "00000B0B0B000000" + "0000000B0B0B0000"
pomoc$(13) = "000007070B000000" + "0000000B07070000"
pomoc$(14) = "00000000000B0000" + "00000B0000000000"
pomoc$(15) = "0000000007070700" + "0007070700000000"

FOR i = 1 TO 16
ZNAKP3(i * 2) = VAL("&H" + MID$(pomoc$(i - 1), 1, 8))
ZNAKP3(i * 2 - 1) = VAL("&H" + MID$(pomoc$(i - 1), 9, 8))
ZNAKL3(i * 2) = VAL("&H" + MID$(pomoc$(i - 1), 17, 8))
ZNAKL3(i * 2 - 1) = VAL("&H" + MID$(pomoc$(i - 1), 25, 8))
NEXT i


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

REM Ludzik idacy w dol lub w gore

vertd1(0) = &H100040

pomoc$(0) = "0000000808080000"
pomoc$(1) = "0000000F0F0F0000"
pomoc$(2) = "0000000F0F0F0000"
pomoc$(3) = "000000000F000000"
pomoc$(4) = "00000C0C0C0C0C00"
pomoc$(5) = "000C0C0C0C0C0C0C"
pomoc$(6) = "000C0C0C0C0C0C0C"
pomoc$(7) = "000C000C0C0C000C"
pomoc$(8) = "000F00080808000F"
pomoc$(9) = "0000000B0B0B0000"
pomoc$(10) = "0000000B000B0000"
pomoc$(11) = "0000000B000B0000"
pomoc$(12) = "0000000B000B0000"
pomoc$(13) = "0000000B000B0000"
pomoc$(14) = "0000000B000B0000"
pomoc$(15) = "0000070700070700"

FOR i = 1 TO 16
vertd1(i * 2) = VAL("&H" + MID$(pomoc$(i - 1), 1, 8))
vertd1(i * 2 - 1) = VAL("&H" + MID$(pomoc$(i - 1), 9, 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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Sob 21:21, 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) = "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) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(8) = "0000000C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(9) = "00000C0C000C0C0C0C000000" + "0000000C0C0C0C000C0C0000"
pomoc$(10) = "00000C0C000C0C0C0C0C0000" + "00000C0C0C0C0C000C0C0000"
pomoc$(11) = "000C0C00000C0C0C0C0C0000" + "00000C0C0C0C0C00000C0C00"
pomoc$(12) = "000F0F00000808080F0F0000" + "00000F0F08080800000F0F00"
pomoc$(13) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(14) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(15) = "000000000B0B0B0B0B000000" + "0000000B0B0B0B0B00000000"
pomoc$(16) = "0000000B0B0B000B0B000000" + "0000000B0B000B0B0B000000"
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" + "000000000F0F0F0F00000000"
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) = "00000C0C000C0C0C0C0C0000" + "00000C0C0C0C0C000C0C0000"
pomoc$(11) = "00000C0C000C0C0C0C0C0000" + "00000C0C0C0C0C000C0C0000"
pomoc$(12) = "00000F0F000808080F0F0000" + "00000F0F080808000F0F0000"
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) = "00000C0C0C0C0C0C0C0C0000" + "00000C0C0C0C0C0C0C0C0000"
pomoc$(11) = "00000C0C000C0C0C0C0C0000" + "00000C0C0C0C0C000C0C0000"
pomoc$(12) = "00000F0F000808080F0F0000" + "00000F0F080808000F0F0000"
pomoc$(13) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(14) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(15) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(16) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(17) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(18) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(19) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(20) = "0000000B0B000B0B0B000000" + "0000000B0B0B000B0B000000"
pomoc$(21) = "000007070700000B0B000000" + "0000000B0B00000707070000"
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) = "00000C0C0C0C0C0C0C0C0000"
pomoc$(7) = "000C0C0C0C0C0C0C0C0C0C00"
pomoc$(8) = "000C0C0C0C0C0C0C0C0C0C00"
pomoc$(9) = "0C0C0C0C0C0C0C0C0C0C0C0C"
pomoc$(10) = "0C0C000C0C0C0C0C0C000C0C"
pomoc$(11) = "0C0C000C0C0C0C0C0C000C0C"
pomoc$(12) = "0F0F00080808080808000F0F"
pomoc$(13) = "0000000B0B0B0B0B0B000000"
pomoc$(14) = "0000000B0B0B0B0B0B000000"
pomoc$(15) = "0000000B0B00000B0B000000"
pomoc$(16) = "0000000B0B00000B0B000000"
pomoc$(17) = "0000000B0B00000B0B000000"
pomoc$(18) = "0000000B0B00000B0B000000"
pomoc$(19) = "0000000B0B00000B0B000000"
pomoc$(20) = "0000000B0B00000B0B000000"
pomoc$(21) = "0000000B0B00000B0B000000"
pomoc$(22) = "0000000B0B00000B0B000000"
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) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHHWHHHPPPP##"
plansza$(2) = "##PPPPHUHUHHHWHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHHWWHHQQ##"
plansza$(4) = "##HHHPPPPHHUUHHHUUHHHUU"
plansza$(5) = "##LLLLHHMWWWWWWWWWHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"

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

plansza$(7) = "UHHHWWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHWHHHWPPPPUUUUHHHUU"
plansza$(10) = "###WWWLLLLHHWWWHHHHHWWW"
plansza$(11) = "UUQQHHPPPPHHUHHHWWHHH##"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH###"
plansza$(13) = "UUUUUUUUUHHHHHUUUUUUUUU"

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

plansza$(14) = "####HHHHHMWMHHHVUVHHHWW"
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) = "UUUUQQQPPPPQQWQQQUUUUUU": 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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Sob 22:54, 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) = "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) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(8) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(9) = "0000000C0C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(10) = "0000000C0C0C0C0C0C0C0000" + "00000C0C0C0C0C0C0C000000"
pomoc$(11) = "00000C0C000C0C0C0C0C0000" + "00000C0C0C0C0C000C0C0000"
pomoc$(12) = "00000C0C00080808080C0C00" + "000C0C08080808000C0C0000"
pomoc$(13) = "00000F0F000B0B0B0B0F0F00" + "000F0F0B0B0B0B000F0F0000"
pomoc$(14) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(15) = "000000000B0B0B0B0B000000" + "0000000B0B0B0B0B00000000"
pomoc$(16) = "0000000B0B0B000B0B000000" + "0000000B0B000B0B0B000000"
pomoc$(17) = "0000000B0B00000B0B000000" + "0000000B0B00000B0B000000"
pomoc$(18) = "0000000B0B00000B0B000000" + "0000000B0B00000B0B000000"
pomoc$(19) = "000000000B0B00000B0B0000" + "00000B0B00000B0B00000000"
pomoc$(20) = "000000000B0B00000B0B0000" + "00000B0B00000B0B00000000"
pomoc$(21) = "000000000B0B000707070000" + "0000070707000B0B00000000"
pomoc$(22) = "000000000B0B000000000000" + "0000000000000B0B00000000"
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" + "000000000F0F0F0F00000000"
pomoc$(4) = "00000000000F0F0000000000" + "00000000000F0F0000000000"
pomoc$(5) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(6) = "00000000000C0C0C00000000" + "000000000C0C0C0000000000"
pomoc$(7) = "00000000000C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(8) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(9) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(10) = "0000000C0C0C0C0C0C0C0000" + "00000C0C0C0C0C0C0C000000"
pomoc$(11) = "00000C0C0C0C0C0C0C0C0000" + "00000C0C0C0C0C0C0C0C0000"
pomoc$(12) = "00000C0C00080808080C0C00" + "000C0C08080808000C0C0000"
pomoc$(13) = "00000F0F000B0B0B0B0F0F00" + "000F0F0B0B0B0B000F0F0000"
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) = "0000000000000B0B00070700" + "000707000B0B000000000000"
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) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C00000000"
pomoc$(9) = "000000000C0C0C0C0C000000" + "0000000C0C0C0C0C0C000000"
pomoc$(10) = "0000000C0C0C0C0C0C0C0000" + "00000C0C0C0C0C0C0C000000"
pomoc$(11) = "00000C0C0C0C0C0C0C0C0000" + "00000C0C0C0C0C0C0C000000"
pomoc$(12) = "00000C0C00080808080C0C00" + "000C0C08080808000C0C0000"
pomoc$(13) = "00000F0F000B0B0B0B0F0F00" + "000F0F0B0B0B0B000F0F0000"
pomoc$(14) = "00000000000B0B0B0B000000" + "0000000B0B0B0B0000000000"
pomoc$(15) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(16) = "000000000B0B0B0B00000000" + "000000000B0B0B0B00000000"
pomoc$(17) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(18) = "0000000B0B000B0B00000000" + "000000000B0B000B0B000000"
pomoc$(19) = "0000000B0B000B0B0B000000" + "0000000B0B0B000B0B000000"
pomoc$(20) = "0000000B0B00000B0B000000" + "0000000B0B00000B0B000000"
pomoc$(21) = "000007070700000B0B000000" + "0000000B0B00000707070000"
pomoc$(22) = "00000000000000000B0B0000" + "00000B0B0000000000000000"
pomoc$(23) = "000000000000070707070000" + "000007070707000000000000"


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) = "000000000808080000000000"
pomoc$(1) = "000000080F0F0F0800000000"
pomoc$(2) = "0000000F0F0F0F0F000000000"
pomoc$(3) = "000000000F0F0F0000000000"
pomoc$(4) = "00000000080F080000000000"
pomoc$(5) = "00000C0C0C0C0C0C0C000000"
pomoc$(6) = "00000C0C0C0C0C0C0C000000"
pomoc$(7) = "000C0C0C0C0C0C0C0C0C0000"
pomoc$(8) = "000C0C0C0C0C0C0C0C0C0000"
pomoc$(9) = "0C0C0C0C0C0C0C0C0C0C0C00"
pomoc$(10) = "0C0C000C0C0C0C0C000C0C00"
pomoc$(11) = "0C0C000C0C0C0C0C000C0C00"
pomoc$(12) = "0C0C000808080808000C0C00"
pomoc$(13) = "0F0F000B0B0B0B0B000F0F00"
pomoc$(14) = "0000000B0B0B0B0B00000000"
pomoc$(15) = "0000000B0B000B0B00000000"
pomoc$(16) = "0000000B0B000B0B00000000"
pomoc$(17) = "0000000B0B000B0B00000000"
pomoc$(18) = "0000000B0B000B0B00000000"
pomoc$(19) = "0000000B0B000B0B00000000"
pomoc$(20) = "0000000B0B000B0B00000000"
pomoc$(21) = "0000000B0B000B0B00000000"
pomoc$(22) = "0000000B0B000B0B00000000"
pomoc$(23) = "000807070700070707080000"


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
PALETTE 15, 46 * 65536 + 57 * 256 + 63: REM SKORA
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) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHHWHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHHWWHHQQ##"
plansza$(4) = "##HHHPPPPHHUUHHHUUHHHUU"
plansza$(5) = "##LLLLHHMWWWWWWWWWHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"

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

plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHWHHHWPPPPUUUUHHHUU"
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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Nie 13:25, 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
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) = "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) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
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) = "000000003F3F3F3F00000000" + "000000003F3F3F3F00000000"
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) = "003F3F3F3F003F3F3F3F0000"


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 - 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
REM PALETTE 13, 0 * 65536 + 0 * 256 + 48: REM sweter
REM PALETTE 12, 0 * 65536 + 0 * 256 + 48: REM sweter

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 + 57 * 256 + 63: REM SKORA

PALETTE 15, 46 * 65536 + 57 * 256 + 63: REM SKORA

REM rejestry przeszkod powinny byc od &HFF wstecz
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) = "##LLLLHUHHHHHHUHHLLLLUU"
plansza$(1) = "##....UUHHHHHWHHHPPPP##"
plansza$(2) = "##PPPPHHHUHHHHHWHHHHHUU"
plansza$(3) = "##QQHLLLLHHHHHHWWHHQQ##"
plansza$(4) = "##HHHPPPPHHUUHHHUUHHHUU"
plansza$(5) = "##LLLLHHMWWWWWWWWWHHHUU"
plansza$(6) = "##PPPPWWHHHHHH0HHHH00UU"

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

plansza$(7) = "UHHHHWWHHHLLLLUHHHHHH##"
plansza$(8) = "#HHHHHHHHH....WWHHHHH##"
plansza$(9) = "UUHHHWHHHWPPPPUUUUHHHUU"
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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysł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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysł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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysł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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysł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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysł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
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysł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
Powrót do góry
Wyświetl posty z ostatnich:   
Napisz nowy temat   Odpowiedz do tematu    Forum Życie Wieczne Strona Główna -> Offtopic Wszystkie czasy w strefie EET (Europa)
Idź do strony Poprzedni  1, 2, 3, 4, 5  Następny
Strona 4 z 5

 
Skocz do:  
Możesz pisać nowe tematy
Możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach

fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group
Regulamin