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 

Bulder - gra
Idź do strony Poprzedni  1, 2, 3
 
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: Pon 18:18, 28 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy
beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

spadk = 0: spadd = 0

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF
NEXT xb
NEXT yb

REM ****************** ruch motyli ***********************

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 64: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 32: OUT 66, 0
NEXT i
FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 54: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 60: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.###"
pomoc$(1) = ".###.###"
pomoc$(2) = ".###.###"
pomoc$(3) = "........"
pomoc$(4) = "##.###.#"
pomoc$(5) = "##.###.#"
pomoc$(6) = "##.###.#"
pomoc$(7) = "........"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+OAOAA.AAA%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%OA.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+A+A+++AO+AOAAO+AA%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%AA+++AO++AAOAA+A+A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A+A+AO+AO+AAOAA+OA%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+++O+++++O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%++++++OA+++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++.O...O.AO++OM..........++A+AO+++O+O%"
tablica$(2) = "%.A.++++.+A+.+++M+O++O+M++++++++++A+AA+%"
tablica$(3) = "%++O++A+.O.AO+++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++O.++O...++++MA....AM+++++A.A+AO+AOA%"
tablica$(5) = "%.A++.AO++A.O+++M+....+M++++A+A+++AAO++%"
tablica$(6) = "%+O+.MMMMMMMO+++M.A..A.M++++OA+AO+A++++%"
tablica$(7) = "%A+.+A.A++AO.+++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%A..AO...O++.++OM..OO..M+++AO+++A+O+A+A%"
tablica$(9) = "%AA.A+.O.+.+O+++M..++..M+++++OA.OAO+A.A%"

tablica$(10) = "%++O+A.OA.A+O+++M.O++O.M+++AAOAAOAA.AAA%"
tablica$(11) = "%A+.O.+A.OA.++++M.++++.M+++.OAA+++O++OA%"
tablica$(12) = "%+++O..O.++OA+++MO+..+OM++++++.AA+A..O.%"
tablica$(13) = "%+A+A.+.OA.O.+++M+....+M++++AA.O..+++.+%"
tablica$(14) = "%MMMMMMMMM+.O+++MA....AM+++MM..++.MMMMM%"
tablica$(15) = "%++++A+++A.A++++M+A..A+M+++O.....AA..++%"
tablica$(16) = "%+A.++.O+++..+++M++AA++M++++++AA++AA..+%"
tablica$(17) = "%+.++A.AOA++O+++M..AA..M+++.A.++++++.A.%"
tablica$(18) = "%+AA+.O+A+.+A+++M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++++++++++MA++++AM+++++++++++++++%"
tablica$(20) = "%%%%%%%%%%%+++++MMMMMMMMMMMMM%%%%%%%%%%%"
tablica$(21) = "%AAAA......++++++++++++++++++%AAAAAAAAA%"
tablica$(22) = "%MMMMMMMMMM++++++++++++++++++%AOOOOOOOA%"
tablica$(23) = "%AAAA......+++++++++++++++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 22: ilemot = 2
motx(0) = 8: moty(0) = 21
motx(1) = 8: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.AAA.AAO++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O.....+AOA+MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.AOOA++++..AOAM+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.++++++++OAAM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.OAA++......++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AMMO+.+++++++.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+MO.O..+++++++++OOM+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O...+..+++++++MAM.++%+++++%"
tablica$(9) = "%MMMMMMMM+M+O+..++..++++MMMM+M.++%+++++%"

tablica$(10) = "%+++++++++M+O..++++..+++AAOM+M.++%+++++%"
tablica$(11) = "%+++++++++M.+..+++++++++AO.MAM.++%+++++%"
tablica$(12) = "%+++++++++MOA....+++++.+O.OM+M.++%+++++%"
tablica$(13) = "%+++++++++MO.+++++....++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++++M.OAO.+A....A++++MAM.++++++++%"
tablica$(15) = "%+++++++++MA+++.O++..++++++M+M.++++++++%"
tablica$(16) = "%++MMMMMMMM...+.+++++++OO+AM+M.++++++++%"
tablica$(17) = "%+.++AA+++M+OAO.O..++.+++..MAM.MMMMMMMM%"
tablica$(18) = "%+AA+.O+++M+A.+.+.A++A.+.AOM+M.++++++++%"
tablica$(19) = "%+++++++++M++++++++++++++++M+M+++++++++%"
tablica$(20) = "%+++++++++M++++++++++++++++MAM+...+...+%"
tablica$(21) = "%.......++M+++++O++++++++++M+M+...+...+%"
tablica$(22) = "%.......++M++++++++++++OOMMM+M+...+...+%"
tablica$(23) = "%.......++++++++++++++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O.......O..........O....O.......O%"
tablica$(2) = "%O....+.......+.......O..+....+....O..+%"
tablica$(3) = "%+......O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+.............O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O....+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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






PostWysłany: Pon 20:42, 28 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy
beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

spadk = 0: spadd = 0

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF
NEXT xb
NEXT yb

REM ****************** ruch motyli ***********************

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 64: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 32: OUT 66, 0
NEXT i
FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 54: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 60: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.###"
pomoc$(1) = ".###.###"
pomoc$(2) = ".###.###"
pomoc$(3) = "........"
pomoc$(4) = "##.###.#"
pomoc$(5) = "##.###.#"
pomoc$(6) = "##.###.#"
pomoc$(7) = "........"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+OAO+A.++A%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%OA.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+++A+++AO+AO+AO+AA%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%AA++.AO++.AO.++A+A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A+A++O+AO+A+O+A+O+%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+.+O+.+A+O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%+++.++O++++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%++++++OM...O+.............++A+AO+++O+O%"
tablica$(2) = "%+++++++M+A+.+++M+O++O+M+++.++++++++.A+%"
tablica$(3) = "%+++++++MO.AO+++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++++++M...++++MA....AM+++++A.A+A+++OA%"
tablica$(5) = "%+++++++M+A.O+++M+....+M+.++A+A+++++O++%"
tablica$(6) = "%+++++++M+++O+++M.A..A.M++++OA+.++A.+++%"
tablica$(7) = "%+++++++M+AO.+++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%++++++OM+++.++OM..OO..M+++AO+++A+++++A%"
tablica$(9) = "%+++++++M+.+O+++M..++..M++.++OA.OAO+A.A%"

tablica$(10) = "%+++++++M.A+O+++M.O++O.M+++AAO+++.A.+++%"
tablica$(11) = "%+++++++MOA.++++M.++++.M+++.OAA+++O++OA%"
tablica$(12) = "%+++++++M++OA+++MO+..+OM++.+++.AA+A..O.%"
tablica$(13) = "%+++++++MA.O.+++M+....+M++++AA.O..+++.+%"
tablica$(14) = "%+++++++MM+.O+++MA....AM+++MM..++.MMMMM%"
tablica$(15) = "%+++++++MA.A++++M+A..A+M+++O.....AA..++%"
tablica$(16) = "%+++++++M++..+++M++AA++M+.++++AA++AA..+%"
tablica$(17) = "%+++++++MA++O+++M..AA..M+++.A.++++++.A.%"
tablica$(18) = "%+++++++M+.+A+++M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++M+++++++MA++++AM+++++++++++++++%"
tablica$(20) = "%++MMMMMM..MMMMMM++++++M+++++%%%%%%%%%%%"
tablica$(21) = "%++.....M.......M++++++M+++++%AAAAAAAAA%"
tablica$(22) = "%++MMMMMM..MMMMMM++++++M+++++%AOOOOOOOA%"
tablica$(23) = "%++.....M.......M++++++M++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 5: y = 15: ilemot = 2
motx(0) = 6: moty(0) = 21
motx(1) = 6: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.AAA.AAO++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O.....+AOA+MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.AOOA++++..AOAM+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.++++++++OAAM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.OAA++......++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AMMO+.+++++++.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+MO.O..+++++++++OOM+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O...+..+++++++MAM.++%+++++%"
tablica$(9) = "%MMMMMMMM+M+O+..++..++++MMMM+M.++%+++++%"

tablica$(10) = "%+++++++++M+O..++++..+++AAOM+M.++%+++++%"
tablica$(11) = "%+++++++++M.+..+++++++++AO.MAM.++%+++++%"
tablica$(12) = "%+++++++++MOA....+++++.+O.OM+M.++%+++++%"
tablica$(13) = "%+++++++++MO.+++++....++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++++M.OAO.+A....A++++MAM.++++++++%"
tablica$(15) = "%+++++++++MA+++.O++..++++++M+M.++++++++%"
tablica$(16) = "%++MMMMMMMM...+.+++++++OO+AM+M.++++++++%"
tablica$(17) = "%+.++AA+++M+OAO.O..++.+++..MAM.MMMMMMMM%"
tablica$(18) = "%+AA+.O+++M+A.+.+.A++A.+.AOM+M.++++++++%"
tablica$(19) = "%+++++++++M++++++++++++++++M+M+++++++++%"
tablica$(20) = "%+++++++++M++++++++++++++++MAM+...+...+%"
tablica$(21) = "%.......++M+++++O++++++++++M+M+...+...+%"
tablica$(22) = "%.......++M++++++++++++OOMMM+M+...+...+%"
tablica$(23) = "%.......++++++++++++++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O.......O..........O....O.......O%"
tablica$(2) = "%O....+.......+.......O..+....+....O..+%"
tablica$(3) = "%+......O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+.............O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O....+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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






PostWysłany: Pon 22:13, 28 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy
beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

spadk = 0: spadd = 0

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF
NEXT xb
NEXT yb

REM ****************** ruch motyli ***********************

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2
IF k$ = "6" THEN plansza (6): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 64: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 32: OUT 66, 0
NEXT i
FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 54: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 60: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.###"
pomoc$(1) = ".###.###"
pomoc$(2) = ".###.###"
pomoc$(3) = "........"
pomoc$(4) = "##.###.#"
pomoc$(5) = "##.###.#"
pomoc$(6) = "##.###.#"
pomoc$(7) = "........"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5
IF ktora = 6 THEN GOTO plansza6


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+OAO+A.++A%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%OA.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+++A+++AO+AO+AO+AA%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%AA++.AO++.AO.++A+A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A+A++O+AO+A+O+A+O+%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+.+O+.+A+O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%+++.++O++++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%++++++OM...O+.............++A+AO+++O+O%"
tablica$(2) = "%+++++++M+A+.+++M+O++O+M+++.++++++++.A+%"
tablica$(3) = "%+++++++MO.AO+++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++++++M...++++MA....AM+++++A.A+A+++OA%"
tablica$(5) = "%+++++++M+A.O+++M+....+M+.++A+A+++++O++%"
tablica$(6) = "%+++++++M+++O+++M.A..A.M++++OA+.++A.+++%"
tablica$(7) = "%+++++++M+AO.+++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%++++++OM+++.++OM..OO..M+++AO+++A+++++A%"
tablica$(9) = "%+++++++M+.+O+++M..++..M++.++OA.OAO+A.A%"

tablica$(10) = "%+++++++M.A+O+++M.O++O.M+++AAO+++.A.+++%"
tablica$(11) = "%+++++++MOA.++++M.++++.M+++.OAA+++O++OA%"
tablica$(12) = "%+++++++M++OA+++MO+..+OM++.+++.AA+A..O.%"
tablica$(13) = "%+++++++MA.O.+++M+....+M++++AA.O..+++.+%"
tablica$(14) = "%+++++++MM+.O+++MA....AM+++MM..++.MMMMM%"
tablica$(15) = "%+++++++MA.A++++M+A..A+M+++O.....AA..++%"
tablica$(16) = "%+++++++M++..+++M++AA++M+.++++AA++AA..+%"
tablica$(17) = "%+++++++MA++O+++M..AA..M+++.A.++++++.A.%"
tablica$(18) = "%+++++++M+.+A+++M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++M+++++++MA++++AM+++++++++++++++%"
tablica$(20) = "%++MMMMMM..MMMMMM++++++M+++++%%%%%%%%%%%"
tablica$(21) = "%++.....M.......M++++++M+++++%AAAAAAAAA%"
tablica$(22) = "%++MMMMMM..MMMMMM++++++M+++++%AOOOOOOOA%"
tablica$(23) = "%++.....M.......M++++++M++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 5: y = 15: ilemot = 2
motx(0) = 6: moty(0) = 21
motx(1) = 6: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.AAA.AAO++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O.....+AOA+MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.AOOA++++..AOAM+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.++++++++OAAM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.OAA++......++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AMMO+.+++++++.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+MO.O..+++++++++OOM+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O...+..+++++++MAM.++%+++++%"
tablica$(9) = "%MMMMMMMM+M+O+..++..++++MMMM+M.++%+++++%"

tablica$(10) = "%+++++++++M+O..++++..+++AAOM+M.++%+++++%"
tablica$(11) = "%+++++++++M.+..+++++++++AO.MAM.++%+++++%"
tablica$(12) = "%+++++++++MOA....+++++.+O.OM+M.++%+++++%"
tablica$(13) = "%+++++++++MO.+++++....++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++++M.OAO.+A....A++++MAM.++++++++%"
tablica$(15) = "%+++++++++MA+++.O++..++++++M+M.++++++++%"
tablica$(16) = "%++MMMMMMMM...+.+++++++OO+AM+M.++++++++%"
tablica$(17) = "%+.++AA+++M+OAO.O..++.+++..MAM.MMMMMMMM%"
tablica$(18) = "%+AA+.O+++M+A.+.+.A++A.+.AOM+M.++++++++%"
tablica$(19) = "%+++++++++M++++++++++++++++M+M+++++++++%"
tablica$(20) = "%+++++++++M++++++++++++++++MAM+...+...+%"
tablica$(21) = "%.......++M+++++O++++++++++M+M+...+...+%"
tablica$(22) = "%.......++M++++++++++++OOMMM+M+...+...+%"
tablica$(23) = "%.......++++++++++++++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O.......O..........O....O.......O%"
tablica$(2) = "%O....+.......+.......O..+....+....O..+%"
tablica$(3) = "%+......O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+.............O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O....+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

plansza6:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%......................................%"
tablica$(2) = "%......................................%"
tablica$(3) = "%......................................%"
tablica$(4) = "%......................................%"
tablica$(5) = "%..................AO..................%"
tablica$(6) = "%.................AAAO.................%"
tablica$(7) = "%................OAOAAA................%"
tablica$(8) = "%...............AAAAOAAO...............%"
tablica$(9) = "%..............AOAOAAAOAO..............%"

tablica$(10) = "%.............AOAAAAAOAAOA.............%"
tablica$(11) = "%............AAOAAAOAAOAAAA............%"
tablica$(12) = "%...........OAAAAOAAOAAOAOAO...........%"
tablica$(13) = "%..........AAAOAAAAOAAAAAAAAO..........%"
tablica$(14) = "%.........OAOAAOAAOAOAAOAOAAOA.........%"
tablica$(15) = "%........AAOAAOOAOAAAAOAOAOAAAA........%"
tablica$(16) = "%.......OAAAAOAAOAOAOAAAAAAAAAOA.......%"
tablica$(17) = "%......AOAOAAOAAAAOAAOAOOAOAOAAAO......%"
tablica$(18) = "%.....AOAOAAOAOAOAAOAAAOAOAAAAAOAA.....%"
tablica$(19) = "%....OAOAAOAAOAOAAOAAOAOAOAOAOAAAOA....%"
tablica$(20) = "%...OAOAAAOAOAOAAOAAOAOAOAAAOAOAOAAA...%"
tablica$(21) = "%..AAOAOAAAOAOAAOAAOAAAAOAOAAAAOAAOAA..%"
tablica$(22) = "%.OAAAOAAAOAOAOAAAAAOAAAAOAAAOAAAAAAOA.%"
tablica$(23) = "%AOAAAOOAOAAOAAOOAOAOOAOAAAOAOAOAOAAAOA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 2
ilemot = 0

wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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






PostWysłany: Wto 12:35, 29 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy
beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

spadk = 0: spadd = 0

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 1) = ASC("X") THEN xdz = xb: ydz = yb + 1: GOSUB dziewiatka: GOTO skok11
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
skok11:
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 1) = ASC("X") THEN xdz = xb: ydz = yb + 1: GOSUB dziewiatka: GOTO skok12
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
skok12:
END IF
NEXT xb
NEXT yb

REM ****************** ruch motyli ***********************

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2: REM faza a nie fazamotyla bo ma byc 4
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2
IF k$ = "6" THEN plansza (6): GOTO restart2
IF k$ = "7" THEN plansza (7): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 64: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 32: OUT 66, 0
NEXT i
FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 54: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 60: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.###"
pomoc$(1) = ".###.###"
pomoc$(2) = ".###.###"
pomoc$(3) = "........"
pomoc$(4) = "##.###.#"
pomoc$(5) = "##.###.#"
pomoc$(6) = "##.###.#"
pomoc$(7) = "........"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5
IF ktora = 6 THEN GOTO plansza6
IF ktora = 7 THEN GOTO plansza7


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+OAO+A.++A%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%O+.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+++A++++O+AO+AO+A+%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%+A++.+O++.+O.++++A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A+A++O+AO+A+O+A+O+%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+.+O+.+A+O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%+++.++O++++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%++++++OM...O+.............++A++O+++O+O%"
tablica$(2) = "%+++++++M+A+.+++M+O++O+M+++.++++++++.A+%"
tablica$(3) = "%+++++++MO.+O+++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++++++M.+.++.+MA....AM+++++A.++A+++OA%"
tablica$(5) = "%+++++++M+A.++++M+....+M+.++A+A+++++O++%"
tablica$(6) = "%+++++++M+++++A+M.A..A.M+++++A+.++A.+++%"
tablica$(7) = "%+++++++M+AO.+++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%++++++OM+++.++OM..OO..M+++AO+++A+++++A%"
tablica$(9) = "%+++++++M+.+O+++M..++..M++.++OA.OA++A.+%"

tablica$(10) = "%+++++++M.A+O+++M.O++O.M+++A+++++.A.+++%"
tablica$(11) = "%+++++++MO+.++++M.++++.M+++.OA++++O++OA%"
tablica$(12) = "%+++++++M+++A+++MO+..+OM++.+++.AA+A..O.%"
tablica$(13) = "%+++++++MA.O.+++M+....+M++++AA.O..+++.+%"
tablica$(14) = "%+++++++M++.++++MA....AM++++++.++.MMMMM%"
tablica$(15) = "%+++++++M+.A++++M+A..A+M+++O.....A++.++%"
tablica$(16) = "%+++++++M++..+++M++AA++M+.++++A++++A..+%"
tablica$(17) = "%+++++++MA++O+++M..AA..M+++.A.++++++.A.%"
tablica$(18) = "%+++++++M+.+A+++M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++M+++++++MA++++AM+++++++++++++++%"
tablica$(20) = "%++MMMMMM..MMMMMM++++++M+++++%%%%%%%%%%%"
tablica$(21) = "%++.....M.......M++++++M+++++%AAAAAAAAA%"
tablica$(22) = "%++MMMMMM..MMMMMM++++++M+++++%AOOOOOOOA%"
tablica$(23) = "%++.....M.......M++++++M++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 5: y = 15: ilemot = 2
motx(0) = 6: moty(0) = 21
motx(1) = 6: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.A++.A+O++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O.....+A+++MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.AO++++++..A++M+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.++++++++++AM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.O+A++......++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AM+++.+++++++.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+MO.O..+++++++++OOM+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O...+..+++++++MAM.++%+++++%"
tablica$(9) = "%MMMMMMMM+M+O+..++..++++MMMM+M.++%+++++%"

tablica$(10) = "%+++++++++M+O..++++..+++AAOM+M.++%+++++%"
tablica$(11) = "%+++++++++M.+..+++++++++AO.MAM.++%+++++%"
tablica$(12) = "%+++++++++M++....+++++.+O.OM+M.++%+++++%"
tablica$(13) = "%+++++++++MO.+++++....++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++++M.+AO.+A....A++++MAM.++++++++%"
tablica$(15) = "%+++++++++M++++.O++..++++++M+M.++++++++%"
tablica$(16) = "%++MMMMMMMM...+.+++++++O++AM+M.++++++++%"
tablica$(17) = "%+.++AA+++M+++O.O..++.+++..MAM.MMMMMMMM%"
tablica$(18) = "%+AA+.O+++M+A.+.+.A++A.+.AOM+M.++++++++%"
tablica$(19) = "%+++++++++M++++++++++++++++M+M+++++++++%"
tablica$(20) = "%+++++++++M++++++++++++++++MAM+...+...+%"
tablica$(21) = "%+++++++++M+++++O++++++++++M+M+...+...+%"
tablica$(22) = "%.......++M++++++++++++OOMMM+M+...+...+%"
tablica$(23) = "%.......++++++++++++++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O....O..O..........O....O.......O%"
tablica$(2) = "%O..O.+....+..+.......O..+....+....O..+%"
tablica$(3) = "%+..+...O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+..........O..O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O.+..+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

plansza6:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%......................................%"
tablica$(2) = "%......................................%"
tablica$(3) = "%......................................%"
tablica$(4) = "%......................................%"
tablica$(5) = "%..................AO..................%"
tablica$(6) = "%.................AAAO.................%"
tablica$(7) = "%................OAOAAA................%"
tablica$(8) = "%...............AAAAOAAO...............%"
tablica$(9) = "%..............AOAOAAAOAO..............%"

tablica$(10) = "%.............AOAAAAAOAAOA.............%"
tablica$(11) = "%............AAOAAAOAAOAAAA............%"
tablica$(12) = "%...........OAAAAOAAOAAOAOAO...........%"
tablica$(13) = "%..........AAAOAAAAOAAAAAAAAO..........%"
tablica$(14) = "%.........OAOAAOAAOAOAAOAOAAOA.........%"
tablica$(15) = "%........AAOAAOOAOAAAAOAOAOAAAA........%"
tablica$(16) = "%.......OAAAAOAAOAOAOAAAAAAAAAOA.......%"
tablica$(17) = "%......AOAOAAOAAAAOAAOAOOAOAOAAAO......%"
tablica$(18) = "%.....AOAOAAOAOAOAAOAAAOAOAAAAAOAA.....%"
tablica$(19) = "%....OAOAAOAAOAOAAOAAOAOAOAOAOAAAOA....%"
tablica$(20) = "%...OAOAAAOAOAOAAOAAOAOAOAAAOAOAOAAA...%"
tablica$(21) = "%..AAOAOAAAOAOAAOAAOAAAAOAOAAAAOAAOAA..%"
tablica$(22) = "%.OAAAOAAAOAOAOAAAAAOAAAAOAAAOAAAAAAOA.%"
tablica$(23) = "%AOAAAOOAOAAOAAOOAOAOOAOAAAOAOAOAOAAAOA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 2
ilemot = 0
GOTO wczytaj

plansza7:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAOAAAAAOAAAAOAAAM+.............+++%"
tablica$(2) = "%OOOAAOAOOAAOOOOAAAAAMO..............++%"
tablica$(3) = "%OAAAOAAAAAOAAAAOOOAOM+...............+%"
tablica$(4) = "%OOOOOOOAAOAAOAAOAAAAMO................%"
tablica$(5) = "%AAAAOOAAAAAAOAOAAOAAM+................%"
tablica$(6) = "%OOOAAAAOOAAAAAOAOAAAMO................%"
tablica$(7) = "%OAAAAAOAOAAAAOAAOAOAM+................%"
tablica$(8) = "%AOOAOOOAAAOAAAOAAAAAM.................%"
tablica$(9) = "%OAAOAAOAAAOOOOAOAOAAM.................%"

tablica$(10) = "%OOOOAOAAAAAAOAOAAOOAM.................%"
tablica$(11) = "%AAOOAOOOAAOAAAOAAAOAM.................%"
tablica$(12) = "%AAAAAOAAAAAOAAAAOAAAM.................%"
tablica$(13) = "%OOAAOAOOAOOAAOAAOOOAM.................%"
tablica$(14) = "%AAAAOOOAAOAAAAOOAAAOM.................%"
tablica$(15) = "%MMMMMMMMMMMMMMMMMMMMM.................%"
tablica$(16) = "%......................................%"
tablica$(17) = "%......................................%"
tablica$(18) = "%......................................%"
tablica$(19) = "%......................................%"
tablica$(20) = "%......................................%"
tablica$(21) = "%+.....................................%"
tablica$(22) = "%++....................................%"
tablica$(23) = "%+++...................................%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 15: moty(0) = 23
motx(1) = 36: moty(1) = 23
x = 35: y = 15



wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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






PostWysłany: Wto 13:57, 29 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy

REM ************** najpierw ruch motyli

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2: REM faza a nie fazamotyla bo ma byc 4
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot


REM **************** ruch kamieni i diamentow

beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

spadk = 0: spadd = 0

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka

END IF
NEXT xb
NEXT yb

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2
IF k$ = "6" THEN plansza (6): GOTO restart2
IF k$ = "7" THEN plansza (7): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 64: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 32: OUT 66, 0
NEXT i
FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 54: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 60: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.###"
pomoc$(1) = ".###.###"
pomoc$(2) = ".###.###"
pomoc$(3) = "........"
pomoc$(4) = "##.###.#"
pomoc$(5) = "##.###.#"
pomoc$(6) = "##.###.#"
pomoc$(7) = "........"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5
IF ktora = 6 THEN GOTO plansza6
IF ktora = 7 THEN GOTO plansza7


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+OAO+A.++A%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%O+.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+++A++++O+AO+AO+A+%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%+A++.+O++.+O.++++A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A+A++O+AO+A+O+A+O+%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+.+O+.+A+O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%+++.++O++++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%++++++OM...O+.............++A++O+++O+O%"
tablica$(2) = "%+++++++M+A+.+++M+O++O+M+++.++++++++.A+%"
tablica$(3) = "%+++++++MO.+O+++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++++++M.+.++.+MA....AM+++++A.++A+++OA%"
tablica$(5) = "%+++++++M+A.++++M+....+M+.++A+A+++++O++%"
tablica$(6) = "%+++++++M+++++A+M.A..A.M+++++A+.++A.+++%"
tablica$(7) = "%+++++++M+AO.+++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%++++++OM+++.++OM..OO..M+++AO+++A+++++A%"
tablica$(9) = "%+++++++M+.+O+++M..++..M++.++OA.OA++A.+%"

tablica$(10) = "%+++++++M.A+O+++M.O++O.M+++A+++++.A.+++%"
tablica$(11) = "%+++++++MO+.++++M.++++.M+++.OA++++O++OA%"
tablica$(12) = "%+++++++M+++A+++MO+..+OM++.+++.AA+A..O.%"
tablica$(13) = "%+++++++MA.O.+++M+....+M++++AA.O..+++.+%"
tablica$(14) = "%+++++++M++.++++MA....AM++++++.++.MMMMM%"
tablica$(15) = "%+++++++M+.A++++M+A..A+M+++O.....A++.++%"
tablica$(16) = "%+++++++M++..+++M++AA++M+.++++A++++A..+%"
tablica$(17) = "%+++++++MA++O+++M..AA..M+++.A.++++++.A.%"
tablica$(18) = "%+++++++M+.+A+++M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++M+++++++MA++++AM+++++++++++++++%"
tablica$(20) = "%++MMMMMM..MMMMMM++++++M+++++%%%%%%%%%%%"
tablica$(21) = "%++.....M.......M++++++M+++++%AAAAAAAAA%"
tablica$(22) = "%++MMMMMM..MMMMMM++++++M+++++%AOOOOOOOA%"
tablica$(23) = "%++.....M.......M++++++M++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 5: y = 15: ilemot = 2
motx(0) = 6: moty(0) = 21
motx(1) = 6: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.A++.A+O++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O++++++A+++MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.A+++++++..A++M+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.+++++O++++AM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.O+A++.+++++++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AM+++.+++++A+.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+M++O..+++++++++O+M+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O+++A..+++++++MAM.++%+++++%"
tablica$(9) = "%+OOOOOOOOM+O+..++..+++++++M+M.++%+++++%"

tablica$(10) = "%+++++++++M+O..++++..+++A++M+M.++%+++++%"
tablica$(11) = "%OOOOOOOO+M.+..+++A++++++O.MAM.++%+++++%"
tablica$(12) = "%MMMMMMMM+M+++++.+++++.+O++M+M.++%+++++%"
tablica$(13) = "%++++++++.+++++++++++.++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++...++++.+A..++A++++MAM.++++++++%"
tablica$(15) = "%++++++.....+++++++..++++++M+M.++++++++%"
tablica$(16) = "%+++++.......++++++++++O++AM+M.++++++++%"
tablica$(17) = "%++++.........+++++++.+++++MAM.MMMMMMMM%"
tablica$(18) = "%+++...........++++++A.+.AOM+M.++++++++%"
tablica$(19) = "%++.............+++++++++++M+M+++++++++%"
tablica$(20) = "%+...............++++++++++MAM+...+...+%"
tablica$(21) = "%.................+++++++++M+M+...+...+%"
tablica$(22) = "%..................++++OOMMM+M+...+...+%"
tablica$(23) = "%...................++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O....O..O..........O....O.......O%"
tablica$(2) = "%O..O.+....+..+.......O..+....+....O..+%"
tablica$(3) = "%+..+...O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+..........O..O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O.+..+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

plansza6:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OAA+..............................+AOA%"
tablica$(2) = "%AO+................................+AO%"
tablica$(3) = "%O+..................................+A%"
tablica$(4) = "%+....................................+%"
tablica$(5) = "%..................AO..................%"
tablica$(6) = "%.................AAAO.................%"
tablica$(7) = "%................OAOAAA................%"
tablica$(8) = "%...............AAAAOAAO...............%"
tablica$(9) = "%..............AOAOAAAOAO..............%"

tablica$(10) = "%.............AOAAAAAOAAOA.............%"
tablica$(11) = "%............AAOAAAOAAOAAAA............%"
tablica$(12) = "%...........OAAAAOAAOAAOAOAO...........%"
tablica$(13) = "%..........AAAOAAAAOAAAAAAAAO..........%"
tablica$(14) = "%.........OAOAAOAAOAOAAOAOAAOA.........%"
tablica$(15) = "%........AAOAAOOAOAAAAOAOAOAAAA........%"
tablica$(16) = "%.......OAAAAOAAOAOAOAAAAAAAAAOA.......%"
tablica$(17) = "%......AOAOAAOAAAAOAAOAOOAOAOAAAO......%"
tablica$(18) = "%.....AOAOAAOAOAOAAOAAAOAOAAAAAOAA.....%"
tablica$(19) = "%....OAOAAOAAOAOAAOAAOAOAOAOAOAAAOA....%"
tablica$(20) = "%...OAOAAAOAOAOAAOAAOAOAOAAAOAOAOAAA...%"
tablica$(21) = "%..AAOAOAAAOAOAAOAAOAAAAOAOAAAAOAAOAA..%"
tablica$(22) = "%.OAAAOAAAOAOAOAAAAAOAAAAOAAAOAAAAAAOA.%"
tablica$(23) = "%AOAAAOOAOAAOAAOOAOAOOAOAAAOAOAOAOAAAOA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 2
ilemot = 0
GOTO wczytaj

plansza7:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAOAAAAAOAAAM++%%++MAOOOOAAAAA.AAAA%"
tablica$(2) = "%OOOAAOAOOAAOOOOMO+%%+OMOAAAAAOOO..OOOO%"
tablica$(3) = "%OAAAOAAAAAOAAAAM++%%++MAAAAA..OOOAAAAA%"
tablica$(4) = "%OOOOOOOAAOAAOAAMO+%%+OMOOOOOAAAA.AAA.O%"
tablica$(5) = "%AAAAOOAAAAAAOAOM++%%++MA..AAA.AAOOO...%"
tablica$(6) = "%OOOAAAAOOAAAAAOMO+%%+OMO.AAAAOO..AAAAA%"
tablica$(7) = "%OAAAAAOAOAAAAOAM++%%++MA.OOOAAAAAAA...%"
tablica$(8) = "%AOOAOOOAAAOAAAOM++%%++MAAAAA.OOO..OOOO%"
tablica$(9) = "%OAAOAAOAAAOOOOAM++%%++MOOOOAAA..AAAAOO%"

tablica$(10) = "%OOOOAOAAAAAAOAOM++%%++M..OOOOAAAOOOAAA%"
tablica$(11) = "%AAOOAOOOAAOAAAOM++%%++M.AAAAOOOAAAAA..%"
tablica$(12) = "%AAAAAOAAAAAOAAAM++%%++M....OOAAAOOAOAA%"
tablica$(13) = "%OOAAOAOOAOOAAOAM++%%++M.AAAOOO..AAAA..%"
tablica$(14) = "%AAAAOOOAAOAAAAOM++%%++MAAAAAOOOAAAAOOO%"
tablica$(15) = "%MMMMMMMMMMMMMMMM++%%++MMMMMMMMMMMMMMMM%"
tablica$(16) = "%...++............................++...%"
tablica$(17) = "%...++............................++...%"
tablica$(18) = "%...++............................++...%"
tablica$(19) = "%+++++............................+++++%"
tablica$(20) = "%+++++............................+++++%"
tablica$(21) = "%...++............................++...%"
tablica$(22) = "%...++............................++...%"
tablica$(23) = "%...++............................++...%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 4
motx(0) = 3: moty(0) = 18
motx(1) = 3: moty(1) = 23
motx(2) = 38: moty(2) = 18
motx(3) = 38: moty(3) = 23

x = 15: y = 18



wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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






PostWysłany: Wto 16:19, 29 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy

REM ************** najpierw ruch motyli

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2: REM faza a nie fazamotyla bo ma byc 4
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot


REM **************** ruch kamieni i diamentow

beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

spadk = 0: spadd = 0


IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka

END IF
NEXT xb
NEXT yb

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2
IF k$ = "6" THEN plansza (6): GOTO restart2
IF k$ = "7" THEN plansza (7): GOTO restart2
IF k$ = "8" THEN plansza (8): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 64: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 32: OUT 66, 0
NEXT i
FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 54: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 60: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.###"
pomoc$(1) = ".###.###"
pomoc$(2) = ".###.###"
pomoc$(3) = "........"
pomoc$(4) = "##.###.#"
pomoc$(5) = "##.###.#"
pomoc$(6) = "##.###.#"
pomoc$(7) = "........"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5
IF ktora = 6 THEN GOTO plansza6
IF ktora = 7 THEN GOTO plansza7
IF ktora = 8 THEN GOTO plansza8


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+OAO+A.++A%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%O+.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+++A++++O+AO+AO+A+%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%+A++.+O++.+O.++++A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A+A++O+AO+A+O+A+O+%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+.+O+.+A+O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%+++.++O++++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%++++++OM...O+.............++A++O+++O+O%"
tablica$(2) = "%+++++++M+A+.+++M+O++O+M+++.++++++++.A+%"
tablica$(3) = "%+++++++MO.+O+++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++++++M.+.++.+MA....AM+++++A.++A+++OA%"
tablica$(5) = "%+++++++M+A.++++M+....+M+.++A+A+++++O++%"
tablica$(6) = "%+++++++M+++++A+M.A..A.M+++++A+.++A.+++%"
tablica$(7) = "%+++++++M+AO.+++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%++++++OM+++.++OM..OO..M+++AO+++A+++++A%"
tablica$(9) = "%+++++++M+.+O+++M..++..M++.++OA.OA++A.+%"

tablica$(10) = "%+++++++M.A+O+++M.O++O.M+++A+++++.A.+++%"
tablica$(11) = "%+++++++MO+.++++M.++++.M+++.OA++++O++OA%"
tablica$(12) = "%+++++++M+++A+++MO+..+OM++.+++.AA+A..O.%"
tablica$(13) = "%+++++++MA.O.+++M+....+M++++AA.O..+++.+%"
tablica$(14) = "%+++++++M++.++++MA....AM++++++.++.MMMMM%"
tablica$(15) = "%+++++++M+.A++++M+A..A+M+++O.....A++.++%"
tablica$(16) = "%+++++++M++..+++M++AA++M+.++++A++++A..+%"
tablica$(17) = "%+++++++MA++O+++M..AA..M+++.A.++++++.A.%"
tablica$(18) = "%+++++++M+.+A+++M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++M+++++++MA++++AM+++++++++++++++%"
tablica$(20) = "%++MMMMMM..MMMMMM++++++M+++++%%%%%%%%%%%"
tablica$(21) = "%++.....M.......M++++++M+++++%AAAAAAAAA%"
tablica$(22) = "%++MMMMMM..MMMMMM++++++M+++++%AOOOOOOOA%"
tablica$(23) = "%++.....M.......M++++++M++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 5: y = 15: ilemot = 2
motx(0) = 6: moty(0) = 21
motx(1) = 6: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.A++.A+O++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O++++++A+++MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.A+++++++..A++M+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.+++++O++++AM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.O+A++.+++++++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AM+++.+++++A+.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+M++O..+++++++++O+M+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O+++A..+++++++MAM.++%+++++%"
tablica$(9) = "%+OOOOOOOOM+O+..++..+++++++M+M.++%+++++%"

tablica$(10) = "%+++++++++M+O..++++..+++A++M+M.++%+++++%"
tablica$(11) = "%OOOOOOOO+M.+..+++A++++++O.MAM.++%+++++%"
tablica$(12) = "%MMMMMMMM+M+++++.+++++.+O++M+M.++%+++++%"
tablica$(13) = "%++++++++.+++++++++++.++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++...++++.+A..++A++++MAM.++++++++%"
tablica$(15) = "%++++++.....+++++++..++++++M+M.++++++++%"
tablica$(16) = "%+++++.......++++++++++O++AM+M.++++++++%"
tablica$(17) = "%++++.........+++++++.+++++MAM.MMMMMMMM%"
tablica$(18) = "%+++...........++++++A.+.AOM+M.++++++++%"
tablica$(19) = "%++.............+++++++++++M+M+++++++++%"
tablica$(20) = "%+...............++++++++++MAM+...+...+%"
tablica$(21) = "%.................+++++++++M+M+...+...+%"
tablica$(22) = "%..................++++OOMMM+M+...+...+%"
tablica$(23) = "%...................++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O....O..O..........O....O.......O%"
tablica$(2) = "%O..O.+....+..+.......O..+....+....O..+%"
tablica$(3) = "%+..+...O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+..........O..O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O.+..+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

plansza6:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OAA+..............................+AOA%"
tablica$(2) = "%AO+................................+AO%"
tablica$(3) = "%O+..................................+A%"
tablica$(4) = "%+....................................+%"
tablica$(5) = "%..................AO..................%"
tablica$(6) = "%.................AAAO.................%"
tablica$(7) = "%................OAOAAA................%"
tablica$(8) = "%...............AAAAOAAO...............%"
tablica$(9) = "%..............AOAOAAAOAO..............%"

tablica$(10) = "%.............AOAAAAAOAAOA.............%"
tablica$(11) = "%............AAOAAAOAAOAAAA............%"
tablica$(12) = "%...........OAAAAOAAOAAOAOAO...........%"
tablica$(13) = "%..........AAAOAAAAOAAAAAAAAO..........%"
tablica$(14) = "%.........OAOAAOAAOAOAAOAOAAOA.........%"
tablica$(15) = "%........AAOAAOOAOAAAAOAOAOAAAA........%"
tablica$(16) = "%.......OAAAAOAAOAOAOAAAAAAAAAOA.......%"
tablica$(17) = "%......AOAOAAOAAAAOAAOAOOAOAOAAAO......%"
tablica$(18) = "%.....AOAOAAOAOAOAAOAAAOAOAAAAAOAA.....%"
tablica$(19) = "%....OAOAAOAAOAOAAOAAOAOAOAOAOAAAOA....%"
tablica$(20) = "%...OAOAAAOAOAOAAOAAOAOAOAAAOAOAOAAA...%"
tablica$(21) = "%..AAOAOAAAOAOAAOAAOAAAAOAOAAAAOAAOAA..%"
tablica$(22) = "%.OAAAOAAAOAOAOAAAAAOAAAAOAAAOAAAAAAOA.%"
tablica$(23) = "%AOAAAOOAOAAOAAOOAOAOOAOAAAOAOAOAOAAAOA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 2
ilemot = 0
GOTO wczytaj

plansza7:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAOAAAAAOAAAM++%%++MAOAOOAAOAAAAOAA%"
tablica$(2) = "%OOOAAOAOOAAOOOOMO+%%+OMOAAOAAOOOAAOOOO%"
tablica$(3) = "%+AAAOAAAAAOAAAAM++%%++MAAAAAOAOOOAAAA+%"
tablica$(4) = "%++OOOOOAAOAAOAAMO+%%+OMOOOOOAAAAOAAA++%"
tablica$(5) = "%+++AOOAAAAAAOAOM++%%++MAOOAAAOAAOAO+++%"
tablica$(6) = "%++++AAAOOAAAAAOMO+%%+OMOAAOAAOOAOA++++%"
tablica$(7) = "%+++++AOAOAAAAOAM++%%++MAOOAOAAAOA+++++%"
tablica$(8) = "%++++++OAAAOAAAOM++%%++MAAOAAAOAO++++++%"
tablica$(9) = "%+++++++AAAOOOOAM++%%++MOAOOAAAO+++++++%"

tablica$(10) = "%++++++++AAAAOAOM++%%++MAAOAOOA++++++++%"
tablica$(11) = "%+++++++++AOAAAOM++%%++MOAAOAO+++++++++%"
tablica$(12) = "%++++++++++AOAAAM++%%++MAOAAO++++++++++%"
tablica$(13) = "%+++++++++++AAOAM++%%++MAAAA+++++++++++%"
tablica$(14) = "%++++++++++++AAOM++%%++MAAO++++++++++++%"
tablica$(15) = "%MMMMMMMMMMMMMMMM++%%++MMMMMMMMMMMMMMMM%"
tablica$(16) = "%...++............................++...%"
tablica$(17) = "%...++............................++...%"
tablica$(18) = "%...++............................++...%"
tablica$(19) = "%+++++............................+++++%"
tablica$(20) = "%+++++............................+++++%"
tablica$(21) = "%...++............................++...%"
tablica$(22) = "%...++............................++...%"
tablica$(23) = "%...++............................++...%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 4
motx(0) = 3: moty(0) = 18
motx(1) = 3: moty(1) = 23
motx(2) = 38: moty(2) = 18
motx(3) = 38: moty(3) = 23

x = 15: y = 18
GOTO wczytaj

plansza8:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%......................................%"
tablica$(2) = "%......................................%"
tablica$(3) = "%......................................%"
tablica$(4) = "%.....O+O+O+O+O+O+O+O+O+O+O+O+O+O......%"
tablica$(5) = "%.....%%%%%%%%%%%%%%%%%%%%%%%%%%%......%"
tablica$(6) = "%...........................LLLL%......%"
tablica$(7) = "%.....................+...+..LLL%......%"
tablica$(8) = "%.....................+...+...LL%......%"
tablica$(9) = "%.....................+...+....L%......%"

tablica$(10) = "%.....................+...+.....%......%"
tablica$(11) = "%.....................+...+++++.%......%"
tablica$(12) = "%.....................+.........%......%"
tablica$(13) = "%.....................+.........%......%"
tablica$(14) = "%.....................+.........%......%"
tablica$(15) = "%.....................+++++++++.%......%"
tablica$(16) = "%...............................%......%"
tablica$(17) = "%......O+O+O+O+O+O+O+O+O+O+O+O++%......%"
tablica$(18) = "%.....O+O+O+O+O+O+O+O+O+O+O+O+O+%......%"
tablica$(19) = "%.....%%%%%%%%%%%%%%%%%%%%%%%%%%%......%"
tablica$(20) = "%......................................%"
tablica$(21) = "%......................................%"
tablica$(22) = "%......................................%"
tablica$(23) = "%......................................%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 2
ilemot = 8
motx(0) = 2: moty(0) = 23
motx(1) = 6: moty(1) = 23
motx(2) = 10: moty(2) = 23
motx(3) = 14: moty(3) = 23
motx(4) = 18: moty(4) = 23
motx(5) = 22: moty(5) = 23
motx(6) = 26: moty(6) = 23
motx(7) = 30: moty(7) = 23





wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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






PostWysłany: Wto 18:12, 29 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED murek2(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy

REM ************** najpierw ruch motyli

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2: REM faza a nie fazamotyla bo ma byc 4
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot


REM **************** ruch kamieni i diamentow

beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

REM murek zmieniajacy

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC("N") THEN tabl(xb, yb + 2) = ASC("A"): tabl(xb, yb) = ASC("@"): GOTO koniecbadania
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC("N") THEN tabl(xb, yb + 2) = ASC("O"): tabl(xb, yb) = ASC("@"): GOTO koniecbadania
END IF

REM zwykle spadanie
spadk = 0: spadd = 0


IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka

END IF
koniecbadania:
NEXT xb
NEXT yb

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz
IF pobrany = ASC("N") THEN PUT (xb * 8, yb * 8), murek2, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2
IF k$ = "6" THEN plansza (6): GOTO restart2
IF k$ = "7" THEN plansza (7): GOTO restart2
IF k$ = "8" THEN plansza (8): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 64: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 32: OUT 66, 0
NEXT i
FOR i = 1 TO 100
OUT 66, 32: OUT 66, 0
OUT 66, 54: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 60: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.######..###"
pomoc$(1) = ".###.#####.##.##"
pomoc$(2) = ".###.####.####.#"
pomoc$(3) = ".........######."
pomoc$(4) = "##.###.#.######."
pomoc$(5) = "##.###.##.####.#"
pomoc$(6) = "##.###.###.##.##"
pomoc$(7) = "........###..###"

FOR yr = 0 TO 7
FOR xr = 0 TO 15
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek
GET (8, 0)-(15, 7), murek2

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5
IF ktora = 6 THEN GOTO plansza6
IF ktora = 7 THEN GOTO plansza7
IF ktora = 8 THEN GOTO plansza8


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+OAO+A.++A%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%O+.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+++A++++O+AO+AO+A+%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%+A++.+O++.+O.++++A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A+A++O+AO+A+O+A+O+%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+.+O+.+A+O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%+++.++O++++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%++++++OM...O+.............++A++O+++O+O%"
tablica$(2) = "%+++++++M+A+.+++M+O++O+M+++.++++++++.A+%"
tablica$(3) = "%+++++++MO.+O+++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++++++M.+.++.+MA....AM+++++A.++A+++OA%"
tablica$(5) = "%+++++++M+A.++++M+....+M+.++A+A+++++O++%"
tablica$(6) = "%+++++++M+++++A+M.A..A.M+++++A+.++A.+++%"
tablica$(7) = "%+++++++M+AO.+++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%++++++OM+++.++OM..OO..M+++AO+++A+++++A%"
tablica$(9) = "%+++++++M+.+O+++M..++..M++.++OA.OA++A.+%"

tablica$(10) = "%+++++++M.A+O+++M.O++O.M+++A+++++.A.+++%"
tablica$(11) = "%+++++++MO+.++++M.++++.M+++.OA++++O++OA%"
tablica$(12) = "%+++++++M+++A+++MO+..+OM++.+++.AA+A..O.%"
tablica$(13) = "%+++++++MA.O.+++M+....+M++++AA.O..+++.+%"
tablica$(14) = "%+++++++M++.++++MA....AM++++++.++.MMMMM%"
tablica$(15) = "%+++++++M+.A++++M+A..A+M+++O.....A++.++%"
tablica$(16) = "%+++++++M++..+++M++AA++M+.++++A++++A..+%"
tablica$(17) = "%+++++++MA++O+++M..AA..M+++.A.++++++.A.%"
tablica$(18) = "%+++++++M+.+A+++M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++M+++++++MA++++AM+++++++++++++++%"
tablica$(20) = "%++MMMMMM..MMMMMM++++++M+++++%%%%%%%%%%%"
tablica$(21) = "%++.....M.......M++++++M+++++%AAAAAAAAA%"
tablica$(22) = "%++MMMMMM..MMMMMM++++++M+++++%AOOOOOOOA%"
tablica$(23) = "%++.....M.......M++++++M++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 5: y = 15: ilemot = 2
motx(0) = 6: moty(0) = 21
motx(1) = 6: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.A++.A+O++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O++++++A+++MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.A+++++++..A++M+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.+++++O++++AM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.O+A++.+++++++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AM+++.+++++A+.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+M++O..+++++++++O+M+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O+++A..+++++++MAM.++%+++++%"
tablica$(9) = "%+OOOOOOOOM+O+..++..+++++++M+M.++%+++++%"

tablica$(10) = "%+++++++++M+O..++++..+++A++M+M.++%+++++%"
tablica$(11) = "%OOOOOOOO+M.+..+++A++++++O.MAM.++%+++++%"
tablica$(12) = "%MMMMMMMM+M+++++.+++++.+O++M+M.++%+++++%"
tablica$(13) = "%++++++++.+++++++++++.++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++...++++.+A..++A++++MAM.++++++++%"
tablica$(15) = "%++++++.....+++++++..++++++M+M.++++++++%"
tablica$(16) = "%+++++.......++++++++++O++AM+M.++++++++%"
tablica$(17) = "%++++.........+++++++.+++++MAM.MMMMMMMM%"
tablica$(18) = "%+++...........++++++A.+.AOM+M.++++++++%"
tablica$(19) = "%++.............+++++++++++M+M+++++++++%"
tablica$(20) = "%+...............++++++++++MAM+...+...+%"
tablica$(21) = "%.................+++++++++M+M+...+...+%"
tablica$(22) = "%..................++++OOMMM+M+...+...+%"
tablica$(23) = "%...................++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O....O..O..........O....O.......O%"
tablica$(2) = "%O..O.+....+..+.......O..+....+....O..+%"
tablica$(3) = "%+..+...O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+..........O..O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O.+..+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

plansza6:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOOOOOO..........AAAAAAAAAAAAAA%"
tablica$(2) = "%++++++++++++++..........++++++++++++++%"
tablica$(3) = "%NNNNNNNNNNNNNN..........NNNNNNNNNNNNNN%"
tablica$(4) = "%......................................%"
tablica$(5) = "%..................AO..................%"
tablica$(6) = "%.................AAAO.................%"
tablica$(7) = "%................OAOAAA................%"
tablica$(8) = "%...............AAAAOAAO...............%"
tablica$(9) = "%..............AOAOAAAOAO..............%"

tablica$(10) = "%.............AOAAAAAOAAOA.............%"
tablica$(11) = "%............AAOAAAOAAOAAAA............%"
tablica$(12) = "%...........OAAAAOAAOAAOAOAO...........%"
tablica$(13) = "%..........AAAOAAAAOAAAAAAAAO..........%"
tablica$(14) = "%.........OAOAAOAAOAOAAOAOAAOA.........%"
tablica$(15) = "%........AAOAAOOAOAAAAOAOAOAAAA........%"
tablica$(16) = "%.......OAAAAOAAOAOAOAAAAAAAAAOA.......%"
tablica$(17) = "%......AOAOAAOAAAAOAAOAOOAOAOAAAO......%"
tablica$(18) = "%.....AOAOAAOAOAOAAOAAAOAOAAAAAOAA.....%"
tablica$(19) = "%....OAOAAOAAOAOAAOAAOAOAOAOAOAAAOA....%"
tablica$(20) = "%...OAOAAAOAOAOAAOAAOAOAOAAAOAOAOAAA...%"
tablica$(21) = "%..AAOAOAAAOAOAAOAAOAAAAOAOAAAAOAAOAA..%"
tablica$(22) = "%.OAAAOAAAOAOAOAAAAAOAAAAOAAAOAAAAAAOA.%"
tablica$(23) = "%AOAAAOOAOAAOAAOOAOAOOAOAAAOAOAOAOAAAOA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 10: y = 6
ilemot = 0
GOTO wczytaj

plansza7:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAOAAAAAOAAAM++%%++MAOAOOAAOAAAAOAA%"
tablica$(2) = "%OOOAAOAOOAAOOOOMO+%%+OMOAAOAAOOOAAOOOO%"
tablica$(3) = "%+AAAOAAAAAOAAAAM++%%++MAAAAAOAOOOAAAA+%"
tablica$(4) = "%++OOOOOAAOAAOAAMO+%%+OMOOOOOAAAAOAAA++%"
tablica$(5) = "%+++AOOAAAAAAOAOM++%%++MAOOAAAOAAOAO+++%"
tablica$(6) = "%++++AAAOOAAAAAOMO+%%+OMOAAOAAOOAOA++++%"
tablica$(7) = "%+++++AOAOAAAAOAM++%%++MAOOAOAAAOA+++++%"
tablica$(8) = "%++++++OAAAOAAAOM++%%++MAAOAAAOAO++++++%"
tablica$(9) = "%+++++++AAAOOOOAM++%%++MOAOOAAAO+++++++%"

tablica$(10) = "%++++++++AAAAOAOM++%%++MAAOAOOA++++++++%"
tablica$(11) = "%+++++++++AOAAAOM++%%++MOAAOAO+++++++++%"
tablica$(12) = "%++++++++++AOAAAM++%%++MAOAAO++++++++++%"
tablica$(13) = "%+++++++++++AAOAM++%%++MAAAA+++++++++++%"
tablica$(14) = "%++++++++++++AAOM++%%++MAAO++++++++++++%"
tablica$(15) = "%MMMMMMMMMMMMMMMM++%%++MMMMMMMMMMMMMMMM%"
tablica$(16) = "%...++............................++...%"
tablica$(17) = "%...++............................++...%"
tablica$(18) = "%...++............................++...%"
tablica$(19) = "%+++++............................+++++%"
tablica$(20) = "%+++++............................+++++%"
tablica$(21) = "%...++............................++...%"
tablica$(22) = "%...++............................++...%"
tablica$(23) = "%...++............................++...%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 4
motx(0) = 3: moty(0) = 18
motx(1) = 3: moty(1) = 23
motx(2) = 38: moty(2) = 18
motx(3) = 38: moty(3) = 23

x = 15: y = 18
GOTO wczytaj

plansza8:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%......................................%"
tablica$(2) = "%......................................%"
tablica$(3) = "%......................................%"
tablica$(4) = "%.....O+O+O+O+O+O+O+O+O+O+O+O+O+O......%"
tablica$(5) = "%.....%%%%%%%%%%%%%%%%%%%%%%%%%%%......%"
tablica$(6) = "%...........................LLLL%......%"
tablica$(7) = "%.....................+...+..LLL%......%"
tablica$(8) = "%.....................+...+...LL%......%"
tablica$(9) = "%.....................+...+....L%......%"

tablica$(10) = "%.....................+...+.....%......%"
tablica$(11) = "%.....................+...+++++.%......%"
tablica$(12) = "%.....................+.........%......%"
tablica$(13) = "%.....................+.........%......%"
tablica$(14) = "%.....................+.........%......%"
tablica$(15) = "%.....................+++++++++.%......%"
tablica$(16) = "%...............................%......%"
tablica$(17) = "%......O+O+O+O+O+O+O+O+O+O+O+O++%......%"
tablica$(18) = "%.....O+O+O+O+O+O+O+O+O+O+O+O+O+%......%"
tablica$(19) = "%.....%%%%%%%%%%%%%%%%%%%%%%%%%%%......%"
tablica$(20) = "%......................................%"
tablica$(21) = "%......................................%"
tablica$(22) = "%......................................%"
tablica$(23) = "%......................................%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 2
ilemot = 8
motx(0) = 2: moty(0) = 23
motx(1) = 6: moty(1) = 23
motx(2) = 10: moty(2) = 23
motx(3) = 14: moty(3) = 23
motx(4) = 18: moty(4) = 23
motx(5) = 22: moty(5) = 23
motx(6) = 26: moty(6) = 23
motx(7) = 30: moty(7) = 23





wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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






PostWysłany: Śro 11:19, 30 Cze 2021    Temat postu:

DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam (ulamek)
DECLARE SUB beepdia (ulamek)
DECLARE SUB plansza (ktora)
DECLARE SUB elementy ()

REM gra musi chodzic w trybie Turbo 97240 cykli

SCREEN 13
DEF SEG = 0

DIM SHARED diament(0 TO 16) AS LONG
DIM SHARED diament2(0 TO 16) AS LONG
DIM SHARED diament3(0 TO 16) AS LONG
DIM SHARED diament4(0 TO 16) AS LONG
DIM SHARED kamien(0 TO 16) AS LONG
DIM SHARED czyste(0 TO 16) AS LONG
DIM SHARED murek(0 TO 16) AS LONG
DIM SHARED murek2(0 TO 16) AS LONG
DIM SHARED wegiel(0 TO 16) AS LONG
DIM SHARED stal(0 TO 16) AS LONG
DIM SHARED motyl1(0 TO 16) AS LONG
DIM SHARED motyl2(0 TO 16) AS LONG
DIM SHARED motyl3(0 TO 16) AS LONG
DIM SHARED lawa1(0 TO 16) AS LONG
DIM SHARED lawa2(0 TO 16) AS LONG
DIM SHARED lawa3(0 TO 16) AS LONG

DIM SHARED gracz1(0 TO 16) AS LONG

DIM SHARED pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
DIM SHARED motx(0 TO 7) AS INTEGER
DIM SHARED moty(0 TO 7) AS INTEGER
DIM SHARED motw(0 TO 7) AS INTEGER
DIM SHARED stary.port
DIM SHARED x, y, ilemot
REM ************************ zaladowanie elementow graficznych

elementy
REM startowa pozycja gracza
x = 25: y = 18

REM ****************************** zaladowanie 1 planszy
restart:
plansza (1)

REM ************************ dane startowe
restart2:
FOR i = 0 TO ilemot - 1
motw(i) = 2
NEXT i
CLS
tabl(x, y) = 2
xs = x: ys = y

REM *************************** petla glowna
petla:

key$ = ""

REM *************************** sprawdzenie tablicy

REM ************** najpierw ruch motyli

FOR mot = 0 TO ilemot - 1

IF moty(mot) = 0 THEN GOTO wyjdzzpetli
mx = motx(mot)
my = moty(mot)
wektor = motw(mot)

REM sprawdzenie dotkniecia lawy
styk = 0
IF tabl(mx + 1, my) = ASC("L") THEN styk = 1
IF tabl(mx - 1, my) = ASC("L") THEN styk = 1
IF tabl(mx, my - 1) = ASC("L") THEN styk = 1
IF tabl(mx, my + 1) = ASC("L") THEN styk = 1
IF styk = 1 THEN xdz = mx: ydz = my: GOSUB dziewiatka: GOTO wyjdzzpetli

ruch = 0
nie1 = 0: nie2 = 0: nie3 = 0: nie4 = 0
nie5 = 0: nie6 = 0: nie7 = 0: nie8 = 0

IF tabl(mx + 1, my - 1) <> ASC(".") THEN nie1 = 1
IF tabl(mx + 1, my) <> ASC(".") THEN nie2 = 1
IF tabl(mx + 1, my + 1) <> ASC(".") THEN nie3 = 1
IF tabl(mx, my + 1) <> ASC(".") THEN nie4 = 1
IF tabl(mx - 1, my + 1) <> ASC(".") THEN nie5 = 1
IF tabl(mx - 1, my) <> ASC(".") THEN nie6 = 1
IF tabl(mx - 1, my - 1) <> ASC(".") THEN nie7 = 1
IF tabl(mx, my - 1) <> ASC(".") THEN nie8 = 1

REM aby kontynuowal kierunek ruchu

powtorz = 0
IF wektor = 6 THEN GOTO wek6
IF wektor = 4 THEN GOTO wek4
IF wektor = 8 THEN GOTO wek8

jeszcze:
REM ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8

wek4:
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: wektor = 2

wek6:
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: wektor = 4

wek8:
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: wektor = 8
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: wektor = 6

REM sprawdz jeszcze raz

IF ruch = 0 AND powtorz = 0 AND (nie2 <> 0 OR nie4 <> 0 OR nie6 <> 0 OR nie8 <> 0) THEN powtorz = 1: GOTO jeszcze


REM motyl zapetlony w prozni

IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF faza = 0 THEN ruch = 1: wektor = 2: REM faza a nie fazamotyla bo ma byc 4
IF faza = 1 THEN ruch = 1: wektor = 4
IF faza = 2 THEN ruch = 1: wektor = 6
IF faza = 3 THEN ruch = 1: wektor = 8
END IF

REM wykonanie ruchu w tablicy

IF ruch = 1 AND wektor = 2 THEN tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 1 AND wektor = 4 THEN tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 1 AND wektor = 6 THEN tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 1 AND wektor = 8 THEN tabl(mx, my) = ASC("."): my = my - 1

IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my

motw(mot) = wektor
wyjdzzpetli:
NEXT mot


REM **************** ruch kamieni i diamentow

beepk = 0: beepd = 0
FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("@") THEN tabl(xb, yb) = ASC("."): REM tymczasowa przerwa

REM murek zmieniajacy

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC("N") THEN tabl(xb, yb + 2) = ASC("A"): tabl(xb, yb) = ASC("@"): GOTO koniecbadania
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC("N") THEN tabl(xb, yb + 2) = ASC("O"): tabl(xb, yb) = ASC("@"): GOTO koniecbadania
END IF

REM zwykle spadanie
spadk = 0: spadd = 0


IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("O"): tabl(xb, yb) = ASC("@"): spadk = 1: GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) = ASC(".") THEN tabl(xb, yb + 1) = ASC("A"): tabl(xb, yb) = ASC("@"): spadd = 1: GOTO skok
END IF

REM znaki wieksze od ascii 64 powoduja upadek w bok

IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("O") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb) = ASC(".")
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb - 1, yb + 1) = ASC(".") AND tabl(xb - 1, yb) = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb) = ASC("."): GOTO skok
END IF
IF pobrany = ASC("A") THEN
IF tabl(xb, yb + 1) > 64 THEN IF tabl(xb + 1, yb + 1) = ASC(".") AND tabl(xb + 1, yb) = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb) = ASC(".")
END IF

skok:
REM dzwiek upadku
IF spadk = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepk = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka
END IF

IF spadd = 1 THEN
IF tabl(xb, yb + 2) <> ASC(".") THEN beepd = 1
IF tabl(xb, yb + 2) = ASC("X") THEN xdz = xb: ydz = yb + 2: GOSUB dziewiatka

END IF
koniecbadania:
NEXT xb
NEXT yb

REM ****************** losowe rozszerzanie lawy

FOR speed = 1 TO 8: REM szybkosc powiekszania alwy
xlos = INT(RND(1) * 38) + 1
ylos = INT(RND(1) * 23) + 1
IF tabl(xlos, ylos) = ASC("L") THEN
REM loslawa = INT(RND(1) * 4)
IF tabl(xlos - 1, ylos) = ASC(".") THEN tabl(xlos - 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos + 1, ylos) = ASC(".") THEN tabl(xlos + 1, ylos) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos - 1) = ASC(".") THEN tabl(xlos, ylos - 1) = ASC("L"): GOTO lawaend
IF tabl(xlos, ylos + 1) = ASC(".") THEN tabl(xlos, ylos + 1) = ASC("L")
lawaend:
END IF
NEXT speed

REM *************************** wyswietlenie tablicy

FOR yb = 24 TO 0 STEP -1

k$ = INKEY$
IF k$ <> "" THEN key$ = k$

FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR: GOTO wyjdz
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR: GOTO wyjdz
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR: GOTO wyjdz
IF pobrany = ASC("N") THEN PUT (xb * 8, yb * 8), murek2, OR: GOTO wyjdz

REM czysczenie tylko pod niektore elementy
PUT (xb * 8, yb * 8), czyste, AND

IF pobrany = ASC("O") THEN PUT (xb * 8, yb * 8), kamien, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 OR fazamotyla = 5 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 OR fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 4 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF

REM falowanie diamentu:

IF pobrany = ASC("A") THEN
IF faza = 0 THEN PUT (xb * 8, yb * 8), diament, OR
IF faza = 1 THEN PUT (xb * 8, yb * 8), diament2, OR
IF faza = 2 THEN PUT (xb * 8, yb * 8), diament3, OR
IF faza = 3 THEN PUT (xb * 8, yb * 8), diament4, OR
END IF

REM falowanie lawy
IF pobrany = ASC("L") THEN
IF fazalawy = 0 THEN PUT (xb * 8, yb * 8), lawa1, OR
IF fazalawy = 1 THEN PUT (xb * 8, yb * 8), lawa2, OR
IF fazalawy = 2 THEN PUT (xb * 8, yb * 8), lawa3, OR
IF fazalawy = 3 THEN PUT (xb * 8, yb * 8), lawa2, OR
END IF

IF pobrany = 2 THEN PUT (xb * 8, yb * 8), gracz1, OR



wyjdz:

NEXT xb
IF beepk = 1 THEN beepkam (yb): GOTO skok3
IF beepd = 1 THEN beepdia (yb)
skok3:

NEXT yb

skok2:

REM ************** zmiana fazy falowania motyli i diamentow:

faza = faza + 1
IF faza = 4 THEN faza = 0

fazamotyla = fazamotyla + 1
IF fazamotyla = 6 THEN fazamotyla = 0

fazalawy = fazalawy + 1
IF fazalawy = 4 THEN fazalawy = 0

REM ********************* obsluga klawiatury

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

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

IF k$ = CHR$(27) THEN END
IF k$ = "1" THEN GOTO restart
IF k$ = "2" THEN plansza (2): GOTO restart2
IF k$ = "3" THEN plansza (3): GOTO restart2
IF k$ = "4" THEN plansza (4): GOTO restart2
IF k$ = "5" THEN plansza (5): GOTO restart2
IF k$ = "6" THEN plansza (6): GOTO restart2
IF k$ = "7" THEN plansza (7): GOTO restart2
IF k$ = "8" THEN plansza (8): GOTO restart2

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

REM ************ sprawdzenie czy wolno wykonac ruch

pobrany = tabl(x, y)

IF y = ys AND pobrany = ASC("O") THEN IF tabl(xs + dx * 2, y) = ASC(".") THEN tabl(xs + dx * 2, y) = ASC("O"): GOTO nowa

IF pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("+") THEN chrup
IF pobrany = ASC("A") THEN braniedia
nowa:

REM ************* kasowanie w tablicy starej pozycji gracza
tabl(xs, ys) = ASC(".")

REM ************* wstawienie do tablicy nowej pozycji gracza
tabl(x, y) = 2

REM zapamietanie starej pozycji gracza
xs = x: ys = y

GOTO petla

REM ****** dziewiec diamentow za motyla

dziewiatka:
FOR yy = ydz - 1 TO ydz + 1
FOR xx = xdz - 1 TO xdz + 1
IF tabl(xx, yy) <> ASC("%") THEN tabl(xx, yy) = ASC("A")
NEXT xx
NEXT yy

REM ktory motyl?

FOR ktory = 0 TO ilemot - 1
IF motx(ktory) = xdz AND moty(ktory) = ydz THEN motx(ktory) = 0: moty(ktory) = 0
NEXT ktory

RETURN

SUB beepdia (ulamek)
IF ulamek < 24 GOTO pominstart

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)


pominstart:
FOR i = 1 TO 1
OUT 66, 102: OUT 66, 1
OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 1
REM OUT 66, 250: OUT 66, 0
REM OUT 66, 64: OUT 66, 3
REM OUT 66, 250: OUT 66, 2


NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
IF ulamek > 0 THEN GOTO pominkoniec

REM wylaczenie glosnika
OUT 97, stary.port

pominkoniec:
END SUB

SUB beepkam (ulamek)
IF ulamek < 24 THEN GOTO ominto

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

ominto:

FOR i = 1 TO 15
OUT 66, 42: OUT 66, 0
OUT 66, 71: OUT 66, 3
OUT 66, 135: OUT 66, 1
REM OUT 66, 35: OUT 66, 1
REM OUT 66, 135: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i

IF ulamek > 0 THEN GOTO omindrugie

t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port

omindrugie:

END SUB

SUB braniedia

DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)

REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)

FOR i = 100 TO 1 STEP -1
OUT 66, i: OUT 66, 3
FOR j = 1 TO 150: NEXT j
NEXT i


REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB chrup
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182

REM odczytanie wartosci portu 97
stary.port = INP(97)


REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)

REM wlaczenie glosnika
OUT 97, nowy.port

REM najpierw mlodszy potem starszy bajt

t0 = PEEK(1132)



FOR i = 1 TO 200
OUT 66, 32: OUT 66, 0
OUT 66, 94: OUT 66, 0
OUT 66, 20: OUT 66, 0
OUT 66, 92: OUT 66, 0
NEXT i
FOR i = 1 TO 300
OUT 66, 32: OUT 66, 0
OUT 66, 94: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 90: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i


t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port


END SUB

SUB elementy

REM zielony wegiel
PALETTE 32, 5 * 65536 + 12 * 256 + 0
PALETTE 33, 9 * 65536 + 14 * 256 + 2
PALETTE 34, 12 * 65536 + 18 * 256 + 6

FOR i = 0 TO 15
REM odcienie kamienia +48
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
REM odcienie diamentu +64
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.7) * 256 + INT(i * 3.2)
NEXT i

GET (0, 0)-(7, 7), czyste

pomoc$(0) = "...@@......@@......@@......@@..."
pomoc$(1) = "..@$$@....@**@....@::@....@##@.."
pomoc$(2) = ".@****@..@::::@..@####@..@$$$$@."
pomoc$(3) = "@::::::@@######@@$$$$$$@@******@"
pomoc$(4) = "@######@@$$$$$$@@******@@::::::@"
pomoc$(5) = ".@$$$$@..@****@..@::::@..@####@."
pomoc$(6) = "..@**@....@::@....@##@....@$$@.."
pomoc$(7) = "...@@......@@......@@......@@..."

FOR yr = 0 TO 7
FOR xr = 0 TO 31
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 64: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 13 + 64: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), diament
GET (8, 0)-(15, 7), diament2
GET (16, 0)-(23, 7), diament3
GET (24, 0)-(31, 7), diament4

pomoc$(0) = "..*$**.."
pomoc$(1) = ".*$###*."
pomoc$(2) = "**$$###*"
pomoc$(3) = "$#*$$#$*"
pomoc$(4) = "*:*#$$#$"
pomoc$(5) = "*$*$:$#*"
pomoc$(6) = ".*:*$**."
pomoc$(7) = "..:*:*.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 3 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 48: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 48: PSET (xr, yr)

NEXT xr
NEXT yr

GET (0, 0)-(7, 7), kamien



pomoc$(0) = ".###.######..###"
pomoc$(1) = ".###.#####.##.##"
pomoc$(2) = ".###.####.####.#"
pomoc$(3) = ".........######."
pomoc$(4) = "##.###.#.######."
pomoc$(5) = "##.###.##.####.#"
pomoc$(6) = "##.###.###.##.##"
pomoc$(7) = "........###..###"

FOR yr = 0 TO 7
FOR xr = 0 TO 15
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 13 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), murek
GET (8, 0)-(15, 7), murek2

pomoc$(0) = "$*******"
pomoc$(1) = "**#*$***"
pomoc$(2) = "*****$*$"
pomoc$(3) = "*$**#***"
pomoc$(4) = "***$**$*"
pomoc$(5) = "$******#"
pomoc$(6) = "**$**$**"
pomoc$(7) = "*#**$***"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 33: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 32: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 34: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), wegiel

pomoc$(0) = "########"
pomoc$(1) = "#**##**#"
pomoc$(2) = "#*.##*.#"
pomoc$(3) = "########"
pomoc$(4) = "########"
pomoc$(5) = "#**##**#"
pomoc$(6) = "#*.##*.#"
pomoc$(7) = "########"

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 11 + 16: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), stal

CLS

pomoc$(0) = "#......#.#....#...#..#.."
pomoc$(1) = "@@....@@.@@..@@....@@..."
pomoc$(2) = "@$$..$$@..$$$$.....$$..."
pomoc$(3) = "*&*&*&*&..*&*&.....&*..."
pomoc$(4) = "&*&*&*&*..&*&*.....*&..."
pomoc$(5) = "@$$..$$@..$$$$.....$$..."
pomoc$(6) = "@@....@@.@@..@@....@@..."
pomoc$(7) = "#......#.#....#...#..#.."

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "&" THEN COLOR 2 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 11 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 8 + 16: PSET (xr, yr)


NEXT xr
NEXT yr

GET (0, 0)-(7, 7), motyl1
GET (8, 0)-(15, 7), motyl2
GET (16, 0)-(23, 7), motyl3

CLS
pomoc$(0) = "..@@@..."
pomoc$(1) = "..@@@..."
pomoc$(2) = "...@...."
pomoc$(3) = ".*****.."
pomoc$(4) = "*.***.*."
pomoc$(5) = "..###..."
pomoc$(6) = "..#.#..."
pomoc$(7) = ".##.##.."

FOR yr = 0 TO 7
FOR xr = 0 TO 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "@" THEN COLOR 15: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), gracz1
CLS

pomoc$(0) = "#####################**#"
pomoc$(1) = "#####**######**#####****"
pomoc$(2) = "#############**#####****"
pomoc$(3) = "##**#################**#"
pomoc$(4) = "#****#####**############"
pomoc$(5) = "#****#####**######**####"
pomoc$(6) = "##**####################"
pomoc$(7) = "########################"

FOR yr = 0 TO 7
FOR xr = 0 TO 23
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 12: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 4: PSET (xr, yr)
NEXT xr
NEXT yr

GET (0, 0)-(7, 7), lawa1
GET (8, 0)-(15, 7), lawa2
GET (16, 0)-(23, 7), lawa3

CLS

END SUB

SUB plansza (ktora)
IF ktora = 2 THEN GOTO plansza2
IF ktora = 3 THEN GOTO plansza3
IF ktora = 4 THEN GOTO plansza4
IF ktora = 5 THEN GOTO plansza5
IF ktora = 6 THEN GOTO plansza6
IF ktora = 7 THEN GOTO plansza7
IF ktora = 8 THEN GOTO plansza8


tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%A++.OO.A+O+O+A.+++%AAO++OA++A+AO+++O+O%"
tablica$(2) = "%O+.++A+++A+O+++O+O%O++AOA+A+A+AO+A+AA+%"
tablica$(3) = "%+++A++++O++O+AO+A+%AAO+AOAOAAOAAAOAO++%"
tablica$(4) = "%O++MMMMMMMMMMMMMMM%+O+OOAAA+AAAOAO+AOA%"
tablica$(5) = "%+A++.+O++.+O.++++A%A+AO+++OAOOAAO++O++%"
tablica$(6) = "%+O+O++A.+A+O++O++O%+O+AAOA+OA+AO+AOA++%"
tablica$(7) = "%A++++O+AO+++O+A+O+%AAAO+AAAOAOAAAO+OA+%"
tablica$(8) = "%MMMMMMMMMMMMMMM+++%A+AAAOAAOAAAAOO+A+A%"
tablica$(9) = "%+O+.+O+.+A+O+.++A+%OAAA+OAAAOAAOAOOAAA%"

tablica$(10) = "%+++.++O++++O++A+++%AOAAAAOAAOAAOAAAAAA%"
tablica$(11) = "%+.+OA+++.O.++++...%AAAOAOAAOAAAAAOOAOA%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%%%%%%%%%%+%%%%%%%%%%"
tablica$(13) = "%+++++A++++++O++++++++++...........++++%"
tablica$(14) = "%++++++++++++++++++++++.............+++%"
tablica$(15) = "%+++++.++++++.++++++++...............++%"
tablica$(16) = "%+++++.++++++.+++++++.................+%"
tablica$(17) = "%+++++.++++++.+++++%...................%"
tablica$(18) = "%+++++.++++++.+++++%...................%"
tablica$(19) = "%+++++.++++++.+++++%...................%"
tablica$(20) = "%+++++.++++++.+++++%...................%"
tablica$(21) = "%+++++.++++++.+++++%...................%"
tablica$(22) = "%+++++.++++++.+++++%...................%"
tablica$(23) = "%++++++++++++++++++%A.................A%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
ilemot = 2: x = 30: y = 20
motx(0) = 6: moty(0) = 22
motx(1) = 13: moty(1) = 22

GOTO wczytaj
plansza2:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%+++++%....LLLLLLLLLLLLLLLLLL....%+++++%"
tablica$(2) = "%+...+%.......LLLLLLLLLLL........%+...+%"
tablica$(3) = "%+...+%..........................%+...+%"
tablica$(4) = "%+...+%..........................%+...+%"
tablica$(5) = "%+++++%..........................%+++++%"
tablica$(6) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(7) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(8) = "%+++++%.M.M.M.M.M.%%%%.M.M.M.M.M.%+++++%"
tablica$(9) = "%+++++............................+++++%"

tablica$(10) = "%+++++............................+++++%"
tablica$(11) = "%+++++............................+++++%"
tablica$(12) = "%+++++............................+++++%"
tablica$(13) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(14) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(15) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(16) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(17) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(18) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(19) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(20) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(21) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(22) = "%+...+++...+++...++++++...+++...+++...+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 3: moty(0) = 4
motx(1) = 36: moty(1) = 4
motx(2) = 3: moty(2) = 22
motx(3) = 9: moty(3) = 22
motx(4) = 15: moty(4) = 22
motx(5) = 24: moty(5) = 22
motx(6) = 30: moty(6) = 22
motx(7) = 36: moty(7) = 22

x = 35: y = 15
GOTO wczytaj

plansza3:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%++++++OM..................++A++O+++O+O%"
tablica$(2) = "%+++++++M+OOOO++M+O++O+M+++.++++++++.A+%"
tablica$(3) = "%+++++++M+OOOO++M++++++M++++MMMMMA.AO++%"
tablica$(4) = "%+++++++M+OOOO++MA....AM+++++A.++A+++OA%"
tablica$(5) = "%+++++++M+OOOO++M+....+M+.++++++++++O++%"
tablica$(6) = "%+++++++M+OOOO++M.A..A.M+++++A+.++A.+++%"
tablica$(7) = "%+++++++M+OOOO++M.+..+.M+++O++OAMMMMM++%"
tablica$(8) = "%++++++OM+OOOO++M..OO..M+++AO+++A+++++A%"
tablica$(9) = "%+++++++M+OOOO++M..++..M++.++OA.O+++A.+%"

tablica$(10) = "%+++++++M+++++++M.O++O.M+++A+++++.A.+++%"
tablica$(11) = "%+++++++MNNNNNN+M.++++.M+++.OA++++O++OA%"
tablica$(12) = "%+++++++M.......MO+..+OM++.+++.+A+A..O.%"
tablica$(13) = "%+++++++M.......M+....+M++++A+.O..+++.+%"
tablica$(14) = "%+++++++M.......MA....AM++++++.++.MMMMM%"
tablica$(15) = "%+++++++M.......M+A..A+M+++O.+++.A++.++%"
tablica$(16) = "%+++++++M.......M++AA++M+.+++++++++A..+%"
tablica$(17) = "%+++++++M.......M..AA..M+++.A.++++++.++%"
tablica$(18) = "%+++++++M.......M.A++A.M+++O..+++.A.++.%"
tablica$(19) = "%+++++++M.......MA++++AM+++++++++++++++%"
tablica$(20) = "%++MMMMMM.......M++++++M+++++%%%%%%%%%%%"
tablica$(21) = "%++.....M.......M++++++M+++++%AAAAAAAAA%"
tablica$(22) = "%++MMMMMM.......M++++++M+++++%AOOOOOOOA%"
tablica$(23) = "%++.....M.......M++++++M++++++AAAAAAAAA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 5: y = 15: ilemot = 2
motx(0) = 6: moty(0) = 21
motx(1) = 6: moty(1) = 23

GOTO wczytaj

plansza4:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOMAO.A.A++.A+O++OAM+MLLLLLLLLL%"
tablica$(2) = "%A+++++++AM+.+++O++++++A+++MAM.+++LLLLL%"
tablica$(3) = "%OOOOOOOO+MAO.A+++++++..A++M+M.++%%%%%%%"
tablica$(4) = "%A+++++++AM.+++.+++++O++++AM+M.++%+++++%"
tablica$(5) = "%+OOOOOOOOM.O+A++.+++++++++MAM.++%+++++%"
tablica$(6) = "%A+++++++AM+++.+++++A+.+A.AM+M.++%+++++%"
tablica$(7) = "%OOOOOOOO+M++O..+++++++++O+M+M.++%+++++%"
tablica$(8) = "%A+++++++AM+.O+++A.++++++++MAM.++%+++++%"
tablica$(9) = "%+OOOOOOOOM+O+.++++++++++++M+M.++%+++++%"

tablica$(10) = "%+++++++++M+O++++++..+++A++M+M.++%+++++%"
tablica$(11) = "%OOOOOOOO+M.+..+++A++++++O.MAM.++%+++++%"
tablica$(12) = "%MMMMMMMM+M+++++.+++++.+O++M+M.++%+++++%"
tablica$(13) = "%++++++++.+++++++++++.++..+M+M.++%%%%%%%"
tablica$(14) = "%+++++++...++++.+A..++A++++MAM.++++++++%"
tablica$(15) = "%++++++.....+++++++++++++++M+M.++++++++%"
tablica$(16) = "%+++++.......++++++++++O++AM+M.++++++++%"
tablica$(17) = "%++++.........+++++++.+++++MAM.MMMMMMMM%"
tablica$(18) = "%+++...........++++++A.+.AOM+M.++++++++%"
tablica$(19) = "%++.............+++++++++++M+M+++++++++%"
tablica$(20) = "%+...............++++++++++MAM+...+...+%"
tablica$(21) = "%.................+++++++++M+M+...+...+%"
tablica$(22) = "%..................++++OOMMM+M+...+...+%"
tablica$(23) = "%...................++++++++AM+++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 2
motx(0) = 32: moty(0) = 22
motx(1) = 36: moty(1) = 22
x = 35: y = 15
GOTO wczytaj

plansza5:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.....O....O..O..........O....O.......O%"
tablica$(2) = "%O..O.+....+..+.......O..+....+....O..+%"
tablica$(3) = "%+..+...O.O..O....O...+...O........+...%"
tablica$(4) = "%....O..+.+..+..O.+....O..+.O...O...O..%"
tablica$(5) = "%..O.+..........+...O..+....+...+...+..%"
tablica$(6) = "%..+.....O..O.......+..........O..O..O.%"
tablica$(7) = "%.O....O.+..+..O...O....O....O.+..+..+.%"
tablica$(8) = "%.+....+.......+...+....+....+.........%"
tablica$(9) = "%......................................%"

tablica$(10) = "%......................................%"
tablica$(11) = "%+....................................+%"
tablica$(12) = "%+...+.....+...+......+...+.....+...+.+%"
tablica$(13) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(14) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(15) = "%+.+.+.+.+.+.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(16) = "%+.+.+.+.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(17) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+.+.+.+%"
tablica$(18) = "%+.+.+++.+++.+.+.+.++.+.+.+.+.+.+++.+.+%"
tablica$(19) = "%+.+.+++.+++.+.+.+.++.+++.+.+++.+++.+.+%"
tablica$(20) = "%+.+.+++.+++.+.+.++++.+++.+.+++.+++++.+%"
tablica$(21) = "%+++.+++.+++++.++++++.+++.+++++.+++++.+%"
tablica$(22) = "%+++.+++.+++++.++++++++++.+++++.+++++.+%"
tablica$(23) = "%++++++++++++++++++++++++++++++++++++++%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 8
motx(0) = 2: moty(0) = 16
motx(1) = 35: moty(1) = 16
motx(2) = 4: moty(2) = 22
motx(3) = 8: moty(3) = 22
motx(4) = 14: moty(4) = 22
motx(5) = 25: moty(5) = 22
motx(6) = 31: moty(6) = 22
motx(7) = 37: moty(7) = 22

x = 20: y = 3
GOTO wczytaj

plansza6:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%OOOOOOOOOOOOOO..........AAAAAAAAAAAAAA%"
tablica$(2) = "%++++++++++++++..........++++++++++++++%"
tablica$(3) = "%NNNNNNNNNNNNNN..........NNNNNNNNNNNNNN%"
tablica$(4) = "%......................................%"
tablica$(5) = "%..................AO..................%"
tablica$(6) = "%.................AAAO.................%"
tablica$(7) = "%................OAOAAA................%"
tablica$(8) = "%...............AAAAOAAO...............%"
tablica$(9) = "%..............AOAOAAAOAO..............%"

tablica$(10) = "%.............AOAAAAAOAAOA.............%"
tablica$(11) = "%............AAOAAAOAAOAAAA............%"
tablica$(12) = "%...........OAAAAOAAOAAOAOAO...........%"
tablica$(13) = "%..........AAAOAAAAOAAAAAAAAO..........%"
tablica$(14) = "%.........OAOAAOAAOAOAAOAOAAOA.........%"
tablica$(15) = "%........AAOAAOOAOAAAAOAOAOAAAA........%"
tablica$(16) = "%.......OAAAAOAAOAOAOAAAAAAAAAOA.......%"
tablica$(17) = "%......AOAOAAOAAAAOAAOAOOAOAOAAAO......%"
tablica$(18) = "%.....AOAOAAOAOAOAAOAAAOAOAAAAAOAA.....%"
tablica$(19) = "%....OAOAAOAAOAOAAOAAOAOAOAOAOAAAOA....%"
tablica$(20) = "%...OAOAAAOAOAOAAOAAOAOAOAAAOAOAOAAA...%"
tablica$(21) = "%..AAOAOAAAOAOAAOAAOAAAAOAOAAAAOAAOAA..%"
tablica$(22) = "%.OAAAOAAAOAOAOAAAAAOAAAAOAAAOAAAAAAOA.%"
tablica$(23) = "%AOAAAOOAOAAOAAOOAOAOOAOAAAOAOAOAOAAAOA%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 10: y = 6
ilemot = 0
GOTO wczytaj

plansza7:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAOAAAAAOAAAM++%%++MAOAOOAAOAAAAOAA%"
tablica$(2) = "%OOOAAOAOOAAOOOOMO+%%+OMOAAOAAOOOAAOOOO%"
tablica$(3) = "%+AAAOAAAAAOAAAAM++%%++MAAAAAOAOOOAAAA+%"
tablica$(4) = "%++OOOOOAAOAAOAAMO+%%+OMOOOOOAAAAOAAA++%"
tablica$(5) = "%+++AOOAAAAAAOAOM++%%++MAOOAAAOAAOAO+++%"
tablica$(6) = "%++++AAAOOAAAAAOMO+%%+OMOAAOAAOOAOA++++%"
tablica$(7) = "%+++++AOAOAAAAOAM++%%++MAOOAOAAAOA+++++%"
tablica$(8) = "%++++++OAAAOAAAOM++%%++MAAOAAAOAO++++++%"
tablica$(9) = "%+++++++AAAOOOOAM++%%++MOAOOAAAO+++++++%"

tablica$(10) = "%++++++++AAAAOAOM++%%++MAAOAOOA++++++++%"
tablica$(11) = "%+++++++++AOAAAOM++%%++MOAAOAO+++++++++%"
tablica$(12) = "%++++++++++AOAAAM++%%++MAOAAO++++++++++%"
tablica$(13) = "%+++++++++++AAOAM++%%++MAAAA+++++++++++%"
tablica$(14) = "%++++++++++++AAOM++%%++MAAO++++++++++++%"
tablica$(15) = "%MMMMMMMMMMMMMMMM++%%++MMMMMMMMMMMMMMMM%"
tablica$(16) = "%...++............................++...%"
tablica$(17) = "%...++............................++...%"
tablica$(18) = "%...++............................++...%"
tablica$(19) = "%+++++............................+++++%"
tablica$(20) = "%+++++............................+++++%"
tablica$(21) = "%...++............................++...%"
tablica$(22) = "%...++............................++...%"
tablica$(23) = "%...++............................++...%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"

ilemot = 4
motx(0) = 3: moty(0) = 18
motx(1) = 3: moty(1) = 23
motx(2) = 38: moty(2) = 18
motx(3) = 38: moty(3) = 23

x = 15: y = 18
GOTO wczytaj

plansza8:

tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%......................................%"
tablica$(2) = "%......................................%"
tablica$(3) = "%......................................%"
tablica$(4) = "%.....O+O+O+O+O+O+O+O+O+O+O+O+O+O......%"
tablica$(5) = "%.....%%%%%%%%%%%%%%%%%%%%%%%%%%%......%"
tablica$(6) = "%.....++++++++++++++++++++++++++%......%"
tablica$(7) = "%...........................LLL+%......%"
tablica$(8) = "%.....................+...+..LL+%......%"
tablica$(9) = "%.....................+...+...L+%......%"

tablica$(10) = "%.....................+...+....+%......%"
tablica$(11) = "%.....................+...++++.+%......%"
tablica$(12) = "%.....................+........+%......%"
tablica$(13) = "%.....................+........+%......%"
tablica$(14) = "%.....................+........+%......%"
tablica$(15) = "%.....................++++++++.+%......%"
tablica$(16) = "%..............................+%......%"
tablica$(17) = "%......O+O+O+O+O+O+O+O+O+O+O+O++%......%"
tablica$(18) = "%.....O+O+O+O+O+O+O+O+O+O+O+O+O+%......%"
tablica$(19) = "%.....%%%%%%%%%%%%%%%%%%%%%%%%%%%......%"
tablica$(20) = "%......................................%"
tablica$(21) = "%......................................%"
tablica$(22) = "%......................................%"
tablica$(23) = "%......................................%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
x = 20: y = 2
ilemot = 8
motx(0) = 2: moty(0) = 23
motx(1) = 6: moty(1) = 23
motx(2) = 10: moty(2) = 23
motx(3) = 14: moty(3) = 23
motx(4) = 18: moty(4) = 23
motx(5) = 22: moty(5) = 23
motx(6) = 26: moty(6) = 23
motx(7) = 30: moty(7) = 23





wczytaj:
FOR yd = 0 TO 24
FOR xd = 0 TO 39
tabl(xd, yd) = ASC(MID$(tablica$(yd), xd + 1, 1))
NEXT xd
NEXT yd


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
Strona 3 z 3

 
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