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: Wto 17:08, 12 Sty 2021    Temat postu:

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

SCREEN 13
DEF SEG = 0

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

DIM plansza$(0 TO 35)

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

plansza$(0) = "#LL0HHHUHHHHHHU3333WLLU"
plansza$(1) = "#..UUUUU44444WHHHHHUPP#"
plansza$(2) = "#PPHHHHUHUHHHWHWHHHUHHU"
plansza$(3) = "#HHHHLLHHHHHHHWWHHHHHH#"
plansza$(4) = "#HHHHPPHHHHUUHHHHUUUHHU"
plansza$(5) = "##000HHHWWWWWWWWWWWHHHU"

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

plansza$(6) = "UHHWWWWWHHLLHHUHHHHUHH#"
plansza$(7) = "#HHHHHHHHH..HWHWHWHWHH#"
plansza$(8) = "UU33W3333WPPHHUUUUUHHHU"
plansza$(9) = "###WWWLLHHHWWWWHHHHHWWW"
plansza$(10) = "UHHHHHPPHHHHU44WWHHHHH#"
plansza$(11) = "UUHHHHHHHHH00HHHHHHHHHU"

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

plansza$(12) = "####HHHHHHWHHHHHHUUHHHW"
plansza$(13) = "#HHHHW444WWHHLLHHHHHHHW"
plansza$(14) = "UU00000000000..000000##": REM startowa
plansza$(15) = "WWWWWWWWWWWWWPP########"
plansza$(16) = "#3333333333333WWHHHHHHW"
plansza$(17) = "UU0004444UUU3333000HHUU"

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

plansza$(18) = "WWWHHHWWWWLLUUUUUUUUUUU"
plansza$(19) = "W33333WWHHZZHHWW44WWHH#"
plansza$(20) = "##00HHHLLHHW44WHHHWWWWW"
plansza$(21) = "#######PPUUUUUUHHUUUUUU"
plansza$(22) = "#HHWWWW3333WWHHUUUUUUUU"
plansza$(23) = "UUUUHHHHWWWWHHHWWWHHUUU"

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

plansza$(24) = "UULLHHHHWWWWWHHHHHHLLH#"
plansza$(25) = "##..###############..##"
plansza$(26) = "WHPPHHHHHUUUUUHHHHHPPUU"
plansza$(27) = "UUUHHHHUUHHHLLHWWHHHHH#"
plansza$(28) = "U3333WWHHHHHPP#########"
plansza$(29) = "UUUU0000UUUU0000UUUUUUU"

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

plansza$(30) = "##000000UUUULLUUUU00###"
plansza$(31) = "#######UUUUUPPHHWWLL###"
plansza$(32) = "UU000HHWWHHUUU0000..HH#"
plansza$(33) = "##LLUUU00000000UUUPP###"
plansza$(34) = "##PPHHWWLLWWHHH000HH###"
plansza$(35) = "UUUUUU00ZZ00###########"

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

REM Ludzik idacy w dol lub w gore faza 1

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

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

NEXT i

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

REM Ludzik idacy w dol lub w gore faza 2

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

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

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


REM Ludzik idacy w dol lub w gore faza 3

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

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

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





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

DIM wiersz$(35 TO 90):

DEF SEG = 0: REM to dla pomiarow predkosci

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

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

PALETTE 100, 63 * 65536 + 31 * 256 + 15
PALETTE 101, 63 * 65536 + 15 * 256 + 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rysuj:

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

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

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



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


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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

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






PostWysłany: Wto 19:25, 12 Sty 2021    Temat postu:

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

SCREEN 13
DEF SEG = 0

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

DIM plansza$(0 TO 48)

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

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

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

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

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

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

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

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

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

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

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

plansza$(35) = "##000000UUUULLUUUU00###"
plansza$(36) = "#######UUUUUPPHHWWLL###"
plansza$(37) = "UU000HHWWHHUUU0000..HH#"
plansza$(38) = "##LLUUU00000000UUUPP###"
plansza$(39) = "##PPHHWWLLWWHHH000HH###"
plansza$(40) = "UUUUUU00ZZ00###########"
plansza$(41) = "UUHHWWHH000000000000UUU"


REM ******************* plansze wiersza roomy=7
plansza$(42) = "######00LL00###########"
plansza$(43) = "######UU..UU###########"
plansza$(44) = "####LL00PP#############"
plansza$(45) = "####PP0000LL###########"
plansza$(46) = "##LLUU0000PP###########"
plansza$(47) = "##PPHH00HH00000HHWWLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUUPP##"

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

REM Ludzik idacy w dol lub w gore faza 1

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

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

NEXT i

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

REM Ludzik idacy w dol lub w gore faza 2

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

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

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


REM Ludzik idacy w dol lub w gore faza 3

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

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

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





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

DIM wiersz$(35 TO 90):

DEF SEG = 0: REM to dla pomiarow predkosci

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

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

PALETTE 100, 63 * 65536 + 31 * 256 + 15
PALETTE 101, 63 * 65536 + 15 * 256 + 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rysuj:

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

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

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



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


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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

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






PostWysłany: Wto 21:19, 12 Sty 2021    Temat postu:

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

SCREEN 13
DEF SEG = 0

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

DIM plansza$(0 TO 48)

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

REM Ludzik idacy w dol lub w gore faza 1

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

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

NEXT i

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

REM Ludzik idacy w dol lub w gore faza 2

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

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

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


REM Ludzik idacy w dol lub w gore faza 3

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

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

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





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

DIM wiersz$(35 TO 90):

DEF SEG = 0: REM to dla pomiarow predkosci

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

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

PALETTE 100, 63 * 65536 + 31 * 256 + 15
PALETTE 101, 63 * 65536 + 15 * 256 + 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rysuj:

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

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

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



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


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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

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






PostWysłany: Śro 14:04, 13 Sty 2021    Temat postu:

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

SCREEN 13
DEF SEG = 0

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

cegla(0) = &H80040

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

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

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

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

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

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

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

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




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

DIM plansza$(0 TO 4Cool

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

REM Ludzik idacy w dol lub w gore faza 1

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

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

NEXT i

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

REM Ludzik idacy w dol lub w gore faza 2

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

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

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


REM Ludzik idacy w dol lub w gore faza 3

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

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

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





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

DIM wiersz$(35 TO 90):

DEF SEG = 0: REM to dla pomiarow predkosci

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
PRINT wiersz$(ASC(MID$(kod$, 1, 1)))
PUT (0, 0), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 2, 1)))
PUT (0, Cool, czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 3, 1)))
PUT (0, 16), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 4, 1)))
PUT (0, 24), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 5, 1)))
PUT (0, 32), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 6, 1)))
PUT (0, 40), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 7, 1)))
PUT (0, 4Cool, czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 8, 1)))
PUT (0, 56), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 9, 1)))
PUT (0, 64), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 10, 1)))
PUT (0, 72), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 11, 1)))
PUT (0, 80), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 12, 1)))
PUT (0, 8Cool, czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 13, 1)))
PUT (0, 96), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 14, 1)))
PUT (0, 104), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 15, 1)))
PUT (0, 112), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 16, 1)))
PUT (0, 120), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 17, 1)))
PUT (0, 128), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 18, 1)))
PUT (0, 136), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 19, 1)))
PUT (0, 144), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 20, 1)))
PUT (0, 152), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 21, 1)))
PUT (0, 160), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 22, 1)))
PUT (0, 168), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 23, 1)))
PUT (0, 176), czterdziescicegiel, OR

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

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

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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * Cool, ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * Cool, ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * Cool, ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * Cool, ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * Cool, ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * Cool, ZNAKP3, PSET
END IF

xs = x: ys = y

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






PostWysłany: Śro 14:05, 13 Sty 2021    Temat postu:

poprawka - bez emotikonow

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

SCREEN 13
DEF SEG = 0

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

cegla(0) = &H80040

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

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

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

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

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

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

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

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




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

DIM plansza$(0 TO 48)

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

REM Ludzik idacy w dol lub w gore faza 1

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

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

NEXT i

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

REM Ludzik idacy w dol lub w gore faza 2

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

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

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


REM Ludzik idacy w dol lub w gore faza 3

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

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

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





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

DIM wiersz$(35 TO 90):

DEF SEG = 0: REM to dla pomiarow predkosci

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
PRINT wiersz$(ASC(MID$(kod$, 1, 1)))
PUT (0, 0), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 2, 1)))
PUT (0, 8), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 3, 1)))
PUT (0, 16), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 4, 1)))
PUT (0, 24), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 5, 1)))
PUT (0, 32), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 6, 1)))
PUT (0, 40), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 7, 1)))
PUT (0, 48), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 8, 1)))
PUT (0, 56), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 9, 1)))
PUT (0, 64), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 10, 1)))
PUT (0, 72), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 11, 1)))
PUT (0, 80), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 12, 1)))
PUT (0, 88), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 13, 1)))
PUT (0, 96), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 14, 1)))
PUT (0, 104), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 15, 1)))
PUT (0, 112), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 16, 1)))
PUT (0, 120), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 17, 1)))
PUT (0, 128), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 18, 1)))
PUT (0, 136), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 19, 1)))
PUT (0, 144), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 20, 1)))
PUT (0, 152), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 21, 1)))
PUT (0, 160), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 22, 1)))
PUT (0, 168), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 23, 1)))
PUT (0, 176), czterdziescicegiel, OR

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

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

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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

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






PostWysłany: Śro 15:29, 13 Sty 2021    Temat postu:

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

SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
REM ************************* cegly

DIM cegla(0 TO 16) AS LONG
DIM czterdziescicegiel(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 "01010101","01010001"
DATA "01010101","01010001"
DATA "01010101","01010001"
DATA "00000000","00000000"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "00000000","00000000"

FOR i = 0 TO 39
PUT (i * 8, 0), cegla, PSET
NEXT i

GET (0, 0)-(319, 7), czterdziescicegiel


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

DIM plansza$(0 TO 48)

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

REM Ludzik idacy w dol lub w gore faza 1

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

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

NEXT i

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

REM Ludzik idacy w dol lub w gore faza 2

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

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

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


REM Ludzik idacy w dol lub w gore faza 3

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

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

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





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

DIM wiersz$(35 TO 90):

x = 20: y = 10: xs = 20: ys = 10: REM wspolrzedne poczatkowe gracza na ekranie
licz = -1
roomx = 4: roomy = 4: REM plansza startowa

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

PALETTE 1, 0
PALETTE 2, 15 * 65536 + 15 * 256 + 15
PALETTE 3, 31 * 65536 + 31 * 256 + 35

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
PRINT wiersz$(ASC(MID$(kod$, 1, 1)))
PUT (0, 0), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 2, 1)))
PUT (0, 8), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 3, 1)))
PUT (0, 16), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 4, 1)))
PUT (0, 24), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 5, 1)))
PUT (0, 32), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 6, 1)))
PUT (0, 40), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 7, 1)))
PUT (0, 48), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 8, 1)))
PUT (0, 56), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 9, 1)))
PUT (0, 64), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 10, 1)))
PUT (0, 72), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 11, 1)))
PUT (0, 80), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 12, 1)))
PUT (0, 88), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 13, 1)))
PUT (0, 96), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 14, 1)))
PUT (0, 104), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 15, 1)))
PUT (0, 112), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 16, 1)))
PUT (0, 120), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 17, 1)))
PUT (0, 128), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 18, 1)))
PUT (0, 136), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 19, 1)))
PUT (0, 144), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 20, 1)))
PUT (0, 152), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 21, 1)))
PUT (0, 160), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 22, 1)))
PUT (0, 168), czterdziescicegiel, OR

PRINT wiersz$(ASC(MID$(kod$, 23, 1)))
PUT (0, 176), czterdziescicegiel, OR

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

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

REM ustawienie gracza na planszy
PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET

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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

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






PostWysłany: Śro 18:07, 13 Sty 2021    Temat postu:

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

SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci
REM ************************* cegly

DIM cegla(0 TO 16) AS LONG
DIM ceg40(0 TO 640) AS LONG
DIM ceg17plus17(0 TO 640) AS LONG
DIM ceg13plus13(0 TO 640) AS LONG
DIM ceg4plus20plus4(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 "01010101","01010001"
DATA "01010101","01010001"
DATA "01010101","01010001"
DATA "00000000","00000000"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "00000000","00000000"

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


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

DIM plansza$(0 TO 48)

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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


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

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

REM Ludzik idacy w dol lub w gore faza 1

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

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

NEXT i

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

REM Ludzik idacy w dol lub w gore faza 2

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

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

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


REM Ludzik idacy w dol lub w gore faza 3

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

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

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





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

DIM wiersz$(35 TO 90):

x = 20: y = 10: xs = 20: ys = 10: REM wspolrzedne poczatkowe gracza na ekranie
licz = -1
roomx = 4: roomy = 4: REM plansza startowa

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

PALETTE 1, 0
PALETTE 2, 15 * 65536 + 15 * 256 + 15
PALETTE 3, 31 * 65536 + 31 * 256 + 35

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
FOR i = 0 TO 22
el$ = MID$(kod$, i + 1, 1)
PRINT wiersz$(ASC(el$))
IF el$ = "#" THEN PUT (0, i * 8), ceg40, OR
IF el$ = "U" THEN PUT (0, i * 8), ceg17plus17, OR
IF el$ = "0" THEN PUT (0, i * 8), ceg13plus13, OR
IF el$ = "W" THEN PUT (0, i * 8), ceg4plus20plus4, OR
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
PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET

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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

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






PostWysłany: Śro 21:20, 13 Sty 2021    Temat postu:

DECLARE SUB wiersze ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
REM ************************* DANE STARTOWE

SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci

x = 20: y = 10: xs = 20: ys = 10: REM wspolrzedne poczatkowe gracza na ekranie
licz = -1: REM wartosc startowa zegara
roomx = 4: roomy = 4: REM plansza startowa

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

PALETTE 1, 0
PALETTE 2, 15 * 65536 + 15 * 256 + 15
PALETTE 3, 31 * 65536 + 31 * 256 + 35

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

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 "01010101","01010001"
DATA "01010101","01010001"
DATA "01010101","01010001"
DATA "00000000","00000000"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "00000000","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 ********************* Kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM SHARED wiersz$(35 TO 90):

REM ********** dane poszczegolnych elementow
REM SUB wiersze - zapelnienie tablicy elementow strony
wiersze


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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
FOR i = 0 TO 22
el$ = MID$(kod$, i + 1, 1)
PRINT wiersz$(ASC(el$))
IF el$ = "#" THEN PUT (0, i * 8), ceg40, OR
IF el$ = "U" THEN PUT (0, i * 8), ceg17plus17, OR
IF el$ = "0" THEN PUT (0, i * 8), ceg13plus13, OR
IF el$ = "W" THEN PUT (0, i * 8), ceg4plus20plus4, OR
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
PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET

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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

GOTO petla











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


END SUB

SUB plansze

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

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

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

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

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

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

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

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

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

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

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

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


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

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


END SUB

SUB wiersze

mur2$ = CHR$(219) + CHR$(219):
mur4$ = mur2$ + mur2$: mur8$ = mur4$ + mur4$: mur16$ = mur8$ + mur8$

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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






PostWysłany: Śro 23:06, 13 Sty 2021    Temat postu:

DECLARE SUB wiersze ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
REM ************************* DANE STARTOWE

SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci

x = 20: y = 10: xs = 20: ys = 10: REM wspolrzedne poczatkowe gracza na ekranie
licz = -1: REM wartosc startowa zegara
roomx = 4: roomy = 4: REM plansza startowa

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

PALETTE 1, 0
PALETTE 2, 15 * 65536 + 15 * 256 + 15
PALETTE 3, 31 * 65536 + 31 * 256 + 35

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

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 "01010101","01010001"
DATA "01010101","01010001"
DATA "01010101","01010001"
DATA "00000000","00000000"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "00000000","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 ********************* Kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM SHARED wiersz$(35 TO 90):

REM ********** dane poszczegolnych elementow
REM SUB wiersze - zapelnienie tablicy elementow strony
wiersze


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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
FOR i = 0 TO 22
el$ = MID$(kod$, i + 1, 1)
PRINT wiersz$(ASC(el$))
IF el$ = "#" THEN PUT (0, i * 8), ceg40, OR
IF el$ = "U" THEN PUT (0, i * 8), ceg17plus17, OR
IF el$ = "0" THEN PUT (0, i * 8), ceg13plus13, OR
IF el$ = "W" THEN PUT (0, i * 8), ceg4plus20plus4, OR
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
PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET

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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

GOTO petla

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


END SUB

SUB plansze

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

plansza$(0) = "#%LLHHHUHHHHHHU3333LLVU"
plansza$(1) = "#%..VUUU44444WHHHHHPP%#"
plansza$(2) = "#%PPHHHUHUHHHWHWHHHHHVU"
plansza$(3) = "#%QQHHLLHHHHHHHWWHHQQ%#"
plansza$(4) = "#%HHHPPHHHHVUVHHVUVHHVU"
plansza$(5) = "#%LL0HHHMWWWWWWWWWMHHVU"
plansza$(6) = "#%PPHHWWHH00HHMWMHH00VU"

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

plansza$(7) = "UHHWWWWWHHLLHHUHHHHHH%#"
plansza$(8) = "#HHHHHHHHH..HWHWHWHWH%#"
plansza$(9) = "UU33W3333WPPHHUUUUUHHVU"
plansza$(10) = "##%WWMLLHHHMWWMHHHHHMWW"
plansza$(11) = "UUQQHHPPHHHHU44WWHHHH%#"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH%##"
plansza$(13) = "UUUUUUUUVHHHHHVUUUUUUUU"

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

plansza$(14) = "###%HHHHHMWMHHHHVUVHHMW"
plansza$(15) = "#HHHHW444WWHHLLHHHHHHHW"
plansza$(16) = "UU00000000000..000000##"
plansza$(17) = "WWWWWWWWWWWWMPPVUUUUUUU"
plansza$(18) = "#333333333333MWWMHHHHMW"
plansza$(19) = "##0004444UUULL33000HHVU"
plansza$(20) = "UV00HHWWHHUUPPHH000VUUU"

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

plansza$(21) = "WWMHHHMWWMLLVUUUUUUUUUU"
plansza$(22) = "W33333WWHHZZHHWW44WWH%#"
plansza$(23) = "##%0HHHLLHHM44MHHHMWWWW"
plansza$(24) = "UUUVQQQXXQQQQMQQQVUUUUU": REM startowa
plansza$(25) = "#HHWWWM333MWMHHVUUUUUUU"
plansza$(26) = "UUUVHHHHMWWMHHHMWMHHVUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"

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

plansza$(28) = "UVLLHHHHMWWWMHHHHHHLL%#"
plansza$(29) = "#%..%#############%..%#"
plansza$(30) = "WMPPHHHHHVUUUUVHHHVPPVU"
plansza$(31) = "UUUVHHHVUVHHLLHMMHHHH%#"
plansza$(32) = "U3333WWHHHHHPP%########"
plansza$(33) = "UUUV0000VUUV0000VUUUUUU"
plansza$(34) = "UUUV0000HHHWHHH0000%###"

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

plansza$(35) = "##%00000UUUULLUUUU00UUU"
plansza$(36) = "######%UUUUVPPHHWWLL###"
plansza$(37) = "UU000HHMWMHHVUV000..HH#"
plansza$(38) = "##LLUUU00000000UUUPP%##"
plansza$(39) = "#%PPHHWWLLWWHHH000HH%##"
plansza$(40) = "UUUUUV00ZZ00VUUUUUUUUUU"
plansza$(41) = "##HHMWMH000000000000VUU"


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

plansza$(42) = "UUUUUV00LL00%##########"
plansza$(43) = "#####%UV..VU%##########"
plansza$(44) = "###%LL00PP%############"
plansza$(45) = "###%PP0000%############"
plansza$(46) = "#%LLUU0000%############"
plansza$(47) = "UVPPHH00HH00000HMWMLL%#"
plansza$(48) = "UUUUUUUUUUUUUUUUUUVPP%#"


END SUB

SUB wiersze

mur2$ = CHR$(219) + CHR$(219):
mur4$ = mur2$ + mur2$: mur8$ = mur4$ + mur4$: mur16$ = mur8$ + mur8$

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

REM kod elementu "#" - mur na cal szerokosc ekranu
wiersz$(35) = mur16$ + mur16$ + mur8$
REM "%" 37 -ten sam element bez cegiel
wiersz$(37) = wiersz$(35)

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

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

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

REM kod elementu "U" - dziura na srodku muru
wiersz$(85) = mur16$ + mur2$ + spc4$ + mur2$ + mur16$
REM "V" ten sam element bez cegiel
wiersz$(86) = wiersz$(85)

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

REM kod elementu "W" - dwie dziury w murze
wiersz$(87) = CHR$(219) + mur4$ + spc4$ + mur16$ + mur4$ + mur2$ + spc4$ + mur4$ + CHR$(219)
REM "M" -77 - ten sam element bez cegiel
wiersz$(77) = wiersz$(87)

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

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

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

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

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

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

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

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


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






PostWysłany: Czw 10:29, 14 Sty 2021    Temat postu:

DECLARE SUB wiersze ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
REM ************************* DANE STARTOWE

SCREEN 13
DEF SEG = 0: REM - to dla pomiaru predkosci

x = 20: y = 10: xs = 20: ys = 10: REM wspolrzedne poczatkowe gracza na ekranie
licz = -1: REM wartosc startowa zegara
roomx = 4: roomy = 4: REM plansza startowa

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


PALETTE 2, 15 * 65536 + 15 * 256 + 15
PALETTE 3, 31 * 65536 + 31 * 256 + 35

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

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 "01010101","01010001"
DATA "01010101","01010001"
DATA "01010101","01010001"
DATA "00000000","00000000"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "00000000","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 ********************* Kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM SHARED wiersz$(35 TO 90):

REM ********** dane poszczegolnych elementow
REM SUB wiersze - zapelnienie tablicy elementow strony
wiersze


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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
FOR i = 0 TO 22
el$ = MID$(kod$, i + 1, 1)
PRINT wiersz$(ASC(el$))
IF el$ = "#" THEN PUT (0, i * 8), ceg40, OR
IF el$ = "U" THEN PUT (0, i * 8), ceg17plus17, OR
IF el$ = "0" THEN PUT (0, i * 8), ceg13plus13, OR
IF el$ = "W" THEN PUT (0, i * 8), ceg4plus20plus4, OR
IF el$ = "Q" THEN PUT (0, i * 8), ceg4spc32plus4, OR
IF el$ = "H" THEN PUT (0, i * 8), ceg1spc38ceg1, OR
IF el$ = "L" THEN PUT (0, i * 8), ceg1spc39, OR
IF el$ = "P" THEN PUT (0, i * 8), spc39ceg1, OR

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
PUT ((x - 1) * 8, (y - 1) * 8), vertd1, PSET

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

petla:

REM ******************* czas gry w sekundach

se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;

REM ************************ petla opozniajaca
FOR delay = 1 TO 300: NEXT delay
REM ************************ sprawdzenie klawiszy

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

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

IF k$ = CHR$(27) THEN END

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

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

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

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

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


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

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

REM sprawdzenie przeszkody

IF pobrany1 = 32 AND pobrany2 = 32 THEN GOTO ruch

x = xs: y = ys
GOTO petla

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

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

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

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

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

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

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT ((x - 1) * 8, (y - 1) * 8), ZNAKP3, PSET
END IF

xs = x: ys = y

GOTO petla

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 (312, 40), cegla, PSET
GET (0, 40)-(319, 47), ceg1spc38ceg1

PUT (0, 48), cegla, PSET
GET (0, 48)-(319, 55), ceg1spc39

PUT (312, 56), cegla, PSET
GET (0, 56)-(319, 63), spc39ceg1
END SUB

SUB plansze

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

plansza$(0) = "#%LLHHHUHHHHHHU3333LLVU"
plansza$(1) = "#%..VUUU44444WHHHHHPP%#"
plansza$(2) = "#%PPHHHUHUHHHWHWHHHHHVU"
plansza$(3) = "#%QQHHLLHHHHHHHWWHHQQ%#"
plansza$(4) = "#%HHHPPHHHHVUVHHVUVHHVU"
plansza$(5) = "#%LL0HHHMWWWWWWWWWMHHVU"
plansza$(6) = "#%PPHHWWHH00HHMWMHH00VU"

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

plansza$(7) = "UHHWWWWWHHLLHHUHHHHHH%#"
plansza$(8) = "#HHHHHHHHH..HWHWHWHWH%#"
plansza$(9) = "UU33W3333WPPHHUUUUUHHVU"
plansza$(10) = "##%WWMLLHHHMWWMHHHHHMWW"
plansza$(11) = "UUQQHHPPHHHHU44WWHHHH%#"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH%##"
plansza$(13) = "UUUUUUUUVHHHHHVUUUUUUUU"

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

plansza$(14) = "###%HHHHHMWMHHHHVUVHHMW"
plansza$(15) = "#HHHHW444WWHHLLHHHHHHHW"
plansza$(16) = "UU00000000000..000000##"
plansza$(17) = "WWWWWWWWWWWWMPPVUUUUUUU"
plansza$(18) = "#333333333333MWWMHHHHMW"
plansza$(19) = "##0004444UUULL33000HHVU"
plansza$(20) = "UV00HHWWHHUUPPHH000VUUU"

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

plansza$(21) = "WWMHHHMWWMLLVUUUUUUUUUU"
plansza$(22) = "W33333WWHHZZHHWW44WWH%#"
plansza$(23) = "##%0HHHLLHHM44MHHHMWWWW"
plansza$(24) = "UUUVQQRXXRQQQMQQQVUUUUU": REM startowa
plansza$(25) = "#%HHWWM333MWMHHVUUUUUUU"
plansza$(26) = "UUUVHHHHMWWMHHHMWMHHVUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"

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

plansza$(28) = "UVLLHHHHMWWWMHHHHHHLL%#"
plansza$(29) = "#%..%#############%..%#"
plansza$(30) = "WMPPHHHHHVUUUUVHHHVPPVU"
plansza$(31) = "UUUVHHHVUVHHLLHMMHHHH%#"
plansza$(32) = "U3333WWHHHHHPP%########"
plansza$(33) = "UUUV0000VUUV0000VUUUUUU"
plansza$(34) = "UUUV0000HHHWHHH0000%###"

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

plansza$(35) = "##%00000UUUULLUUUU00UUU"
plansza$(36) = "######%UUUUVPPHHWWLL###"
plansza$(37) = "UU000HHMWMHHVUV000..HH#"
plansza$(38) = "##LLUUU00000000UUUPP%##"
plansza$(39) = "#%PPHHWWLLWWHHH000HH%##"
plansza$(40) = "UUUUUV00ZZ00VUUUUUUUUUU"
plansza$(41) = "##HHMWMH000000000000VUU"


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

plansza$(42) = "UUUUUV00LL00%##########"
plansza$(43) = "#####%UV..VU%##########"
plansza$(44) = "###%LL00PP%############"
plansza$(45) = "###%PP0000%############"
plansza$(46) = "#%LLUU0000%############"
plansza$(47) = "UVPPHH00HH00000HMWMLL%#"
plansza$(48) = "UUUUUUUUUUUUUUUUUUVPP%#"


END SUB

SUB wiersze

mur2$ = CHR$(219) + CHR$(219):
mur4$ = mur2$ + mur2$: mur8$ = mur4$ + mur4$: mur16$ = mur8$ + mur8$

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

REM kod elementu "#" - mur na cal szerokosc ekranu
wiersz$(35) = mur16$ + mur16$ + mur8$
REM "%" 37 -ten sam element bez cegiel
wiersz$(37) = wiersz$(35)

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

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

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

REM kod elementu "U" - dziura na srodku muru
wiersz$(85) = mur16$ + mur2$ + spc4$ + mur2$ + mur16$
REM "V" ten sam element bez cegiel
wiersz$(86) = wiersz$(85)

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

REM kod elementu "W" - dwie dziury w murze
wiersz$(87) = CHR$(219) + mur4$ + spc4$ + mur16$ + mur4$ + mur2$ + spc4$ + mur4$ + CHR$(219)
REM "M" -77 - ten sam element bez cegiel
wiersz$(77) = wiersz$(87)

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

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

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

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

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

REM kod elementu "Q" - srednia przestrzen posrodku
wiersz$(81) = CHR$(219) + mur4$ + spc16$ + spc8$ + spc4$ + spc2$ + mur4$ + CHR$(219)
REM "R" - ten sam element bez cegiel
wiersz$(82) = wiersz$(81)

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

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


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






PostWysłany: Czw 14:56, 14 Sty 2021    Temat postu:

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

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


PALETTE 2, 15 * 65536 + 15 * 256 + 15
PALETTE 3, 31 * 65536 + 31 * 256 + 35

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

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 "01010101","01010001"
DATA "01010101","01010001"
DATA "01010101","01010001"
DATA "00000000","00000000"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "01000101","01010101"
DATA "00000000","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 ********************* Kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM SHARED wiersz$(35 TO 90):

REM ********** dane poszczegolnych elementow
REM SUB wiersze - zapelnienie tablicy elementow strony
wiersze


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

rysuj:

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

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

REM CLS - wylaczenie CLS zapobiega miganiu ekranu

COLOR 2

LOCATE 1, 1
FOR i = 0 TO 22
el$ = MID$(kod$, i + 1, 1)
PRINT wiersz$(ASC(el$))
IF el$ = "#" THEN PUT (0, i * 8), ceg40, OR
IF el$ = "U" THEN PUT (0, i * 8), ceg17plus17, OR
IF el$ = "0" THEN PUT (0, i * 8), ceg13plus13, OR
IF el$ = "W" THEN PUT (0, i * 8), ceg4plus20plus4, OR
IF el$ = "Q" THEN PUT (0, i * 8), ceg4spc32plus4, OR
IF el$ = "H" THEN PUT (0, i * 8), ceg1spc38ceg1, OR
IF el$ = "L" THEN PUT (0, i * 8), ceg1spc39, OR
IF el$ = "P" THEN PUT (0, i * 8), spc39ceg1, OR

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
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 GOTO petla

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

IF k$ = CHR$(27) THEN END

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

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
suma = 0
IF dx > 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x + 10, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x - 3, y + i): NEXT i

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


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
IF suma = 0 THEN GOTO ruch

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 - metoda tekstowa

REM LOCATE ys, xs: PRINT " ";
REM LOCATE ys + 1, xs: PRINT " ";
LINE (xs, ys)-(xs + 7, ys + 15), 0, BF

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, PSET
IF przebiervert = 1 THEN PUT (x, y), vertg2, PSET
IF przebiervert = 2 THEN PUT (x, y), vertg1, PSET
IF przebiervert = 3 THEN PUT (x, y), vertg3, PSET
END IF

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT (x, y), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT (x, y), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT (x, y), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT (x, y), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT (x, y), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT (x, y), ZNAKP3, PSET
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 (312, 40), cegla, PSET
GET (0, 40)-(319, 47), ceg1spc38ceg1

PUT (0, 48), cegla, PSET
GET (0, 48)-(319, 55), ceg1spc39

PUT (312, 56), cegla, PSET
GET (0, 56)-(319, 63), spc39ceg1
END SUB

SUB plansze

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

plansza$(0) = "#%LLLHHUHHHHHHUHHHLLLVU"
plansza$(1) = "#%...UUUHHHHHWHHHHPPP%#"
plansza$(2) = "#%PPPHHUHUHHHWHWHHHHHVU"
plansza$(3) = "#%QQHLLLHHHHHHHWWHHQQ%#"
plansza$(4) = "#%HHHPPPHHHVUVHHVUVHHVU"
plansza$(5) = "#%LLLHHHMWWWWWWWWWMHHVU"
plansza$(6) = "#%PPPHWWHH00HHMWMHH00VU"

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

plansza$(7) = "UHHHWWWHHHLLLHUHHHHHH%#"
plansza$(8) = "#HHHHHHHHH...WHWHWHWH%#"
plansza$(9) = "UUHHWHHHHWPPPHUUUUHHHVU"
plansza$(10) = "##%WWMLLLHHMWWMHHHHHMWW"
plansza$(11) = "UUQQHHPPPHHHUHHWWHHHH%#"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH%##"
plansza$(13) = "UUUUUUUUVHHHHHVUUUUUUUU"

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

plansza$(14) = "###%HHHHHMWMHHHVUVHHHMW"
plansza$(15) = "#HHHHWHHHWWHLLLHHHHHHHW"
plansza$(16) = "UU0000000000...000000##"
plansza$(17) = "WWWWWWWWWWWMPPPVUUUUUUU"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHMW"
plansza$(19) = "##000HHHHUUULLLH000HHVU"
plansza$(20) = "UV00HHWWHHUUPPPH000VUUU"

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

plansza$(21) = "WWMHHHMWWMLLLUUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHZZZHWWHHWWH%#"
plansza$(23) = "##%0HHHLLLHMHHMHHHMWWWW"
plansza$(24) = "UUUVQQRXXXRQQMQQQVUUUUU": REM startowa
plansza$(25) = "#%HHWWMHHHMWMHHVUUUUUUU"
plansza$(26) = "UUUVHHHHMWWMHHHMWMHHVUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"

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

plansza$(28) = "UVLLLHHHMWWWMHHHHHLLL%#"
plansza$(29) = "#%...%###########%...%#"
plansza$(30) = "WMPPPHHHHVUUUUVHHVPPPVU"
plansza$(31) = "UUUVHHHVUVHLLLHMMHHHH%#"
plansza$(32) = "UHHHHWWHHHHPPP%########"
plansza$(33) = "UUUV0000VUUV0000VUUUUUU"
plansza$(34) = "UUUV0000HHHWHHH0000%###"

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

plansza$(35) = "##%00000UUUULLLUUU00UUU"
plansza$(36) = "######%UUUUVPPPHWWLL###"
plansza$(37) = "UU000HHMWMHHVUV00...HH#"
plansza$(38) = "##LLLUU00000000UUPPP%##"
plansza$(39) = "#%PPPHWWLLLWHHH000HH%##"
plansza$(40) = "UUUUUV00ZZZ0VUUUUUUUUUU"
plansza$(41) = "##HHMWMH000000000000VUU"


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

plansza$(42) = "UUUUUV00LLL0%##########"
plansza$(43) = "#####%UV...U%##########"
plansza$(44) = "###%LLL0PPP%###########"
plansza$(45) = "###%PPP000%############"
plansza$(46) = "#%LLLU0000%############"
plansza$(47) = "UVPPPH00HH0000HHWMLLL%#"
plansza$(48) = "UUUUUUUUUUUUUUUUUVPPP%#"


END SUB

SUB wiersze

mur2$ = CHR$(219) + CHR$(219):
mur4$ = mur2$ + mur2$: mur8$ = mur4$ + mur4$: mur16$ = mur8$ + mur8$

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

REM kod elementu "#" - mur na cal szerokosc ekranu
wiersz$(35) = mur16$ + mur16$ + mur8$
REM "%" 37 -ten sam element bez cegiel
wiersz$(37) = wiersz$(35)

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

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

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

REM kod elementu "U" - dziura na srodku muru
wiersz$(85) = mur16$ + mur2$ + spc4$ + mur2$ + mur16$
REM "V" ten sam element bez cegiel
wiersz$(86) = wiersz$(85)

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

REM kod elementu "W" - dwie dziury w murze
wiersz$(87) = CHR$(219) + mur4$ + spc4$ + mur16$ + mur4$ + mur2$ + spc4$ + mur4$ + CHR$(219)
REM "M" -77 - ten sam element bez cegiel
wiersz$(77) = wiersz$(87)

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

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

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

REM kod elementu "Q" - srednia przestrzen posrodku
wiersz$(81) = CHR$(219) + mur4$ + spc16$ + spc8$ + spc4$ + spc2$ + mur4$ + CHR$(219)
REM "R" - ten sam element bez cegiel
wiersz$(82) = wiersz$(81)

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

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


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






PostWysłany: Czw 16:06, 14 Sty 2021    Temat postu:

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

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

PALETTE 1, 31 * 65536 + 31 * 256 + 35
PALETTE 2, 15 * 65536 + 15 * 256 + 15
REM PALETTE 3, 31 * 65536 + 31 * 256 + 35

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 "01010101","01010201"
DATA "01010101","01010201"
DATA "01010101","01010201"
DATA "02020202","02020202"
DATA "01020101","01010101"
DATA "01020101","01010101"
DATA "01020101","01010101"
DATA "02020202","02020202"

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 ********************* Kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM SHARED wiersz$(35 TO 90):

REM ********** dane poszczegolnych elementow
REM SUB wiersze - zapelnienie tablicy elementow strony
wiersze


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

rysuj:

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

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



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
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 GOTO petla

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

IF k$ = CHR$(27) THEN END

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

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
suma = 0
IF dx > 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x - 3, y + i): NEXT i

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


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
IF suma = 0 THEN GOTO ruch

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 - metoda tekstowa

REM LOCATE ys, xs: PRINT " ";
REM LOCATE ys + 1, xs: PRINT " ";
LINE (xs, ys)-(xs + 7, ys + 15), 0, BF

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, PSET
IF przebiervert = 1 THEN PUT (x, y), vertg2, PSET
IF przebiervert = 2 THEN PUT (x, y), vertg1, PSET
IF przebiervert = 3 THEN PUT (x, y), vertg3, PSET
END IF

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

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

END IF

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

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT (x, y), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT (x, y), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT (x, y), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT (x, y), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT (x, y), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT (x, y), ZNAKP3, PSET
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) = "#%LLLHHUHHHHHHUHHHLLLVU"
plansza$(1) = "#%...UUUHHHHHWHHHHPPP%#"
plansza$(2) = "#%PPPHHUHUHHHWHWHHHHHVU"
plansza$(3) = "#%QQHLLLHHHHHHHWWHHQQ%#"
plansza$(4) = "#%HHHPPPHHHVUVHHVUVHHVU"
plansza$(5) = "#%LLLHHHMWWWWWWWWWMHHVU"
plansza$(6) = "#%PPPHWWHH00HHMWMHH00VU"

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

plansza$(7) = "UHHHWWWHHHLLLHUHHHHHH%#"
plansza$(8) = "#HHHHHHHHH...WHWHWHWH%#"
plansza$(9) = "UUHHWHHHHWPPPHUUUUHHHVU"
plansza$(10) = "##%WWMLLLHHMWWMHHHHHMWW"
plansza$(11) = "UUQQHHPPPHHHUHHWWHHHH%#"
plansza$(12) = "UUHHHHHHHHH00HHHHHHH%##"
plansza$(13) = "UUUUUUUUVHHHHHVUUUUUUUU"

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

plansza$(14) = "###%HHHHHMWMHHHVUVHHHMW"
plansza$(15) = "#HHHHWHHHWWHLLLHHHHHHHW"
plansza$(16) = "UU000000000.....00000##"
plansza$(17) = "WWWWWWWWWWWPPPPPUUUUUUU"
plansza$(18) = "#HHHHHHHHHHHHMWWMHHHHMW"
plansza$(19) = "##000HHHHUUULLLH000HHVU"
plansza$(20) = "UV00HHWWHHUUPPPH000VUUU"

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

plansza$(21) = "WWMHHHMWWMLLLUUUUUUUUUU"
plansza$(22) = "WHHHHHWWHHZZZHWWHHWWH%#"
plansza$(23) = "##00HHHLLLHHHHHHHHHWWWW"
plansza$(24) = "UUUUQQQPPPQQQWQQQUUUUUU": REM startowa
plansza$(25) = "#%HHWWMHHHMWMHHVUUUUUUU"
plansza$(26) = "UUUVHHHHMWWMHHHMWMHHVUU"
plansza$(27) = "UUUUUUUUUUUUUUUUUUUUUUU"

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

plansza$(28) = "UVLLLHHHMWWWMHHHHHLLL%#"
plansza$(29) = "#%...%###########%...%#"
plansza$(30) = "WMPPPHHHHVUUUUVHHVPPPVU"
plansza$(31) = "UUUVHHHVUVHLLLHMMHHHH%#"
plansza$(32) = "UHHHHWWHHHHPPP%########"
plansza$(33) = "UUUV0000VUUV0000VUUUUUU"
plansza$(34) = "UUUV0000HHHWHHH0000%###"

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

plansza$(35) = "##%00000UUUULLLUUU00UUU"
plansza$(36) = "######%UUUUVPPPHWWLL###"
plansza$(37) = "UU000HHMWMHHVUV00...HH#"
plansza$(38) = "##LLLUU00000000UUPPP%##"
plansza$(39) = "#%PPPHWWLLLWHHH000HH%##"
plansza$(40) = "UUUUUV00ZZZ0VUUUUUUUUUU"
plansza$(41) = "##HHMWMH000000000000VUU"


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

plansza$(42) = "UUUUUV00LLL0%##########"
plansza$(43) = "#####%UV...U%##########"
plansza$(44) = "###%LLL0PPP%###########"
plansza$(45) = "###%PPP000%############"
plansza$(46) = "#%LLLU0000%############"
plansza$(47) = "UVPPPH00HH0000HHWMLLL%#"
plansza$(48) = "UUUUUUUUUUUUUUUUUVPPP%#"


END SUB

SUB wiersze

mur2$ = CHR$(219) + CHR$(219):
mur4$ = mur2$ + mur2$: mur8$ = mur4$ + mur4$: mur16$ = mur8$ + mur8$

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

REM kod elementu "#" - mur na cal szerokosc ekranu
wiersz$(35) = mur16$ + mur16$ + mur8$
REM "%" 37 -ten sam element bez cegiel
wiersz$(37) = wiersz$(35)

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

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

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

REM kod elementu "U" - dziura na srodku muru
wiersz$(85) = mur16$ + mur2$ + spc4$ + mur2$ + mur16$
REM "V" ten sam element bez cegiel
wiersz$(86) = wiersz$(85)

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

REM kod elementu "W" - dwie dziury w murze
wiersz$(87) = CHR$(219) + mur4$ + spc4$ + mur16$ + mur4$ + mur2$ + spc4$ + mur4$ + CHR$(219)
REM "M" -77 - ten sam element bez cegiel
wiersz$(77) = wiersz$(87)

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

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

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

REM kod elementu "Q" - srednia przestrzen posrodku
wiersz$(81) = CHR$(219) + mur4$ + spc16$ + spc8$ + spc4$ + spc2$ + mur4$ + CHR$(219)
REM "R" - ten sam element bez cegiel
wiersz$(82) = wiersz$(81)

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

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


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






PostWysłany: Czw 16:38, 14 Sty 2021    Temat postu:

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

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

PALETTE 1, 31 * 65536 + 31 * 256 + 35
PALETTE 2, 15 * 65536 + 15 * 256 + 15
REM PALETTE 3, 31 * 65536 + 31 * 256 + 35

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 "01010101","01010201"
DATA "01010101","01010201"
DATA "01010101","01010201"
DATA "02020202","02020202"
DATA "01020101","01010101"
DATA "01020101","01010101"
DATA "01020101","01010101"
DATA "02020202","02020202"

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 ********************* Kody elementow planszy
REM ********* beda wywolane przez numer kodu ascii

DIM SHARED wiersz$(35 TO 90):

REM ********** dane poszczegolnych elementow
REM SUB wiersze - zapelnienie tablicy elementow strony
wiersze


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
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 GOTO petla

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

IF k$ = CHR$(27) THEN END

IF k$ = CHR$(0) + "K" THEN dx = -4: obrot = -1: vert = 0
IF k$ = CHR$(0) + "M" THEN dx = 4: obrot = 1: vert = 0
IF k$ = CHR$(0) + "H" THEN dy = -4: obrot = 0: vert = -1
IF k$ = CHR$(0) + "P" THEN dy = 4: obrot = 0: vert = 1

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
suma = 0
IF dx > 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x - 3, y + i): NEXT i

IF dy > 0 THEN FOR i = 0 TO 7: suma = suma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: suma = suma + POINT(x + i, y - 3): NEXT i


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
IF suma = 0 THEN GOTO ruch

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 - metoda tekstowa

REM LOCATE ys, xs: PRINT " ";
REM LOCATE ys + 1, xs: PRINT " ";
LINE (xs, ys)-(xs + 7, ys + 15), 0, BF

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, PSET
IF przebiervert = 1 THEN PUT (x, y), vertg2, PSET
IF przebiervert = 2 THEN PUT (x, y), vertg1, PSET
IF przebiervert = 3 THEN PUT (x, y), vertg3, PSET
END IF

REM ************************** ruch w dol

IF vert = 1 THEN
przebiervert = przebiervert + 1
IF przebiervert = 4 THEN przebiervert = 0
IF przebiervert = 0 THEN PUT (x, y), vertd1, PSET
IF przebiervert = 1 THEN PUT (x, y), vertd2, PSET
IF przebiervert = 2 THEN PUT (x, y), vertd1, PSET
IF przebiervert = 3 THEN PUT (x, y), vertd3, PSET

END IF

REM ************************** ruch w lewo

IF obrot = -1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT (x, y), ZNAKL1, PSET
IF PRZEBIERANIE = 1 THEN PUT (x, y), ZNAKL2, PSET
IF PRZEBIERANIE = 2 THEN PUT (x, y), ZNAKL3, PSET
END IF

REM ****************** ruch w prawo

IF obrot = 1 THEN
PRZEBIERANIE = PRZEBIERANIE + 1
IF PRZEBIERANIE = 3 THEN PRZEBIERANIE = 0
IF PRZEBIERANIE = 0 THEN PUT (x, y), ZNAKP1, PSET
IF PRZEBIERANIE = 1 THEN PUT (x, y), ZNAKP2, PSET
IF PRZEBIERANIE = 2 THEN PUT (x, y), ZNAKP3, PSET
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) = "##PPPHHUHUHHHWHWHHHHHVU"
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) = "UUQQHHPPPHHHUHHWWHHHH##"
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) = "##000HHHHUUULLLH000HHVU"
plansza$(20) = "UV00HHWWHHUUPPPH000VUUU"

REM ************ plansze wiersza roomy=4

plansza$(21) = "WWMHHHMWWMLLLUUUUUUUUUU"
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) = "#######UUUUUPPPHWWLL###"
plansza$(37) = "UU000HHMWMHHVUV00...HH#"
plansza$(38) = "##LLLUU00000000UUPPP###"
plansza$(39) = "#%PPPHWWLLLWHHH000HH###"
plansza$(40) = "UUUUUU00ZZZ0UUUUUUUUUUU"
plansza$(41) = "##HHMWMH000000000000UUU"


REM ******************* plansze wiersza roomy=7

plansza$(42) = "UUUUUU00LLL0###########"
plansza$(43) = "######UU...U###########"
plansza$(44) = "####LLL0PPP############"
plansza$(45) = "####PPP000#############"
plansza$(46) = "##LLLU0000#############"
plansza$(47) = "UUPPPH00HH0000HHWMLLL##"
plansza$(48) = "UUUUUUUUUUUUUUUUUUPPP##"


END SUB

SUB wiersze

REM do skasowania

END SUB
Powrót do góry
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Piotr-246
Gość






PostWysłany: Czw 18:12, 14 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 GOTO petla

POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury

IF k$ = CHR$(27) THEN END

IF k$ = CHR$(0) + "K" THEN dx = -4: obrot = -1: vert = 0
IF k$ = CHR$(0) + "M" THEN dx = 4: obrot = 1: vert = 0
IF k$ = CHR$(0) + "H" THEN dy = -4: obrot = 0: vert = -1
IF k$ = CHR$(0) + "P" THEN dy = 4: obrot = 0: vert = 1

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
suma = 0
IF dx > 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x - 3, y + i): NEXT i

IF dy > 0 THEN FOR i = 0 TO 7: suma = suma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: suma = suma + POINT(x + i, y - 3): NEXT i


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 ponizej
REM okreslonej sumy rejestru koloru

IF suma < 20 THEN GOTO ruch

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
przebiervert = przebiervert + 1
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

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: Pią 20:49, 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 GOTO petla

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: obrot = -1: vert = 0
IF k$ = CHR$(0) + "M" OR k$ = "6" THEN dx = 4: 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



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
suma = 0
IF dx > 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x + 11, y + i): NEXT i
IF dx < 0 THEN FOR i = 0 TO 15: suma = suma + POINT(x - 3, y + i): NEXT i

IF dy > 0 THEN FOR i = 0 TO 7: suma = suma + POINT(x + i, y + 18): NEXT i
IF dy < 0 THEN FOR i = 0 TO 7: suma = suma + POINT(x + i, y - 3): NEXT i


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 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
przebiervert = przebiervert + 1
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

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
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 3 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