|
Życie Wieczne
|
Zobacz poprzedni temat :: Zobacz następny temat |
Autor |
Wiadomość |
Piotr-246
Gość
|
Wysłany: Pon 15:21, 21 Cze 2021 Temat postu: Bulder - gra |
|
|
[b]Bulder - Boulder Dash w Quick Basicu przy z włączonym Turbo[/b]
SCREEN 13
DEF SEG = 0
FOR i = 0 TO 255: PRINT i; "-"; CHR$(i);
NEXT i: PRINT
PRINT CHR$(176): PRINT CHR$(177): PRINT CHR$(178): PRINT CHR$(15)
PRINT CHR$(219): PRINT CHR$(2): PRINT
REM ****************************** pomieszczenie
a$ = CHR$(176) + CHR$(176) + CHR$(176) + CHR$(176)
b$ = a$ + a$ + a$ + a$
c$ = CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32)
d$ = c$ + c$ + c$ + c$ + " "
COLOR 12
PRINT b$; b$; a$; a$
FOR i = 1 TO 20
PRINT CHR$(176); c$; d$; d$; CHR$(176)
NEXT i
PRINT b$; b$; a$; a$
LOCATE 10, 10: PRINT CHR$(2)
LOCATE 3, 3: PRINT "AAAAAAAAAAAAAAAAAAAAAAOOOOO";
LOCATE 4, 3: PRINT "AAAAAAAAAAAAAAAAAAAAAAOOOOO";
LOCATE 5, 3: PRINT "AAAOAAAAAAAAAAAAAAAAAAOOOOO";
LOCATE 6, 3: PRINT "AAAOAAAAAAAAAAAAAAAAAAOOOOO";
LOCATE 7, 3: PRINT "AAAOAAAAAAAAAAAAAAAAAAOOOOO";
LOCATE 8, 3: PRINT "AAAOAAAAAOAAAAAAAAAAAAOOOOO";
LOCATE 9, 3: PRINT "AAAOAAAAA AAAAAAAAAAAAOOOOO";
LOCATE 10, 3: PRINT "AAAOAAAAAOAAAAAAAAAAAAAOOOOO";
x = 10: y = 10
xs = 10: ys = 10
REM *************************** petla glowna
petla:
k$ = INKEY$
REM petla opozniajaca
FOR delay = 1 TO 10000: NEXT delay
FOR yb = 22 TO 2 STEP -1
FOR xb = 1 TO 39
pobrany = SCREEN(yb, xb)
IF pobrany = 32 THEN
pobrany2 = SCREEN(yb - 1, xb):
IF pobrany2 = ASC("O") THEN LOCATE yb, xb: PRINT "O"; : LOCATE yb - 1, xb: PRINT " ";
END IF
IF pobrany = ASC("O") THEN
pobrany2 = SCREEN(yb - 1, xb)
IF pobrany2 = ASC("O") THEN pobrany3 = SCREEN(yb, xb - 1): IF pobrany3 = 32 THEN LOCATE yb, xb - 1: PRINT "O": LOCATE yb - 1, xb: PRINT " "
pobrany2 = SCREEN(yb - 1, xb)
IF pobrany2 = ASC("O") THEN pobrany3 = SCREEN(yb, xb + 1): IF pobrany3 = 32 THEN LOCATE yb, xb + 1: PRINT "O": LOCATE yb - 1, xb: PRINT " "
END IF
IF pobrany = ASC("A") THEN LOCATE yb, xb: PRINT "B";
IF pobrany = ASC("B") THEN LOCATE yb, xb: PRINT "C";
IF pobrany = ASC("C") THEN LOCATE yb, xb: PRINT "D";
IF pobrany = ASC("D") THEN LOCATE yb, xb: PRINT "A";
NEXT xb
NEXT yb
REM k$ = INKEY$
IF k$ = "" THEN GOTO petla
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);
IF k$ = CHR$(27) THEN END
IF k$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 = SCREEN(y, x)
IF pobrany <> 32 THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
REM ************* kasowanie starego obrazka
LOCATE ys, xs: COLOR 14: PRINT " ";
REM ************* rysowanie nowego obrazka
LOCATE y, x: PRINT CHR$(2)
xs = x: ys = y
GOTO petla
|
|
Powrót do góry |
|
|
|
|
Zobacz poprzedni temat :: Zobacz następny temat |
Autor |
Wiadomość |
Piotr-246
Gość
|
Wysłany: Pon 17:25, 21 Cze 2021 Temat postu: |
|
|
SCREEN 13
DEF SEG = 0
FOR i = 0 TO 255: PRINT i; "-"; CHR$(i);
NEXT i: PRINT
PRINT CHR$(176): PRINT CHR$(177): PRINT CHR$(178): PRINT CHR$(15)
PRINT CHR$(219): PRINT CHR$(2): PRINT
REM ****************************** pomieszczenie
a$ = CHR$(176) + CHR$(176) + CHR$(176) + CHR$(176)
b$ = a$ + a$ + a$ + a$
c$ = CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32)
d$ = c$ + c$ + c$ + c$ + " "
COLOR 12
PRINT b$; b$; a$; a$
FOR i = 1 TO 20
PRINT CHR$(176); c$; d$; d$; CHR$(176)
NEXT i
PRINT b$; b$; a$; a$
LOCATE 10, 10: PRINT CHR$(2)
LOCATE 3, 3: PRINT "AAAAAAAAAAAAOAAAAAAAAAOOOOO";
LOCATE 4, 3: PRINT "A++++++++++++++++++++++OOOO";
LOCATE 5, 3: PRINT "AAAOAAAAOAAA AAAAAAAAAAOOOOO";
LOCATE 6, 3: PRINT "AAAOAAAAAAAA AAAAAAAAAAOOOOO";
LOCATE 7, 3: PRINT "AAAOAAAAAAAA AAAAAAAAAAOOOOO";
LOCATE 8, 3: PRINT "AAAOAAO. . AA AAAAOAAAAAOOOOO";
LOCATE 9, 3: PRINT "AAAOAAA. . AAA AAAAAAAAAAOOOOO";
LOCATE 10, 3: PRINT "AAAOAA. . OAA AAAAOAAA++++++++++++";
LOCATE 11, 3: PRINT "AAAOAA. . AAA AAAAAAAAAAOOOOO";
LOCATE 12, 3: PRINT "AAAOAA. .AAOAA AAAAOAAAAAOOOOO";
LOCATE 13, 3: PRINT "AAAO++. .AAAAA AAAAAAAAAAOOOOO";
LOCATE 14, 3: PRINT "A++++++++++++++++++++++++++OOOO";
LOCATE 15, 3: PRINT "AAAO++. .AAOAA AAAAOAAAAAOOOOO";
LOCATE 16, 3: PRINT "AAAO++. .AAAAA AAAAAAAAAAOOOOO";
LOCATE 17, 3: PRINT "AAAOAA. .AAAOAA AAAAOAAAAAO OOOO";
x = 10: y = 17
xs = 10: ys = 17
REM *************************** petla glowna
petla:
key$ = ""
FOR yb = 22 TO 2 STEP -1
REM petla opozniajaca
FOR delay = 1 TO 1000: NEXT delay
k$ = INKEY$
IF k$ <> "" THEN key$ = k$
FOR xb = 1 TO 39
pobrany = SCREEN(yb, xb)
IF pobrany = 32 THEN
pobrany2 = SCREEN(yb - 1, xb):
IF pobrany2 = ASC("O") THEN LOCATE yb, xb: PRINT "O"; : LOCATE yb - 1, xb: PRINT " ";
END IF
IF pobrany = ASC("O") THEN
pobrany2 = SCREEN(yb - 1, xb)
IF pobrany2 = ASC("O") THEN pobrany3 = SCREEN(yb, xb - 1): IF pobrany3 = 32 THEN LOCATE yb, xb - 1: PRINT "O": LOCATE yb - 1, xb: PRINT " "
pobrany2 = SCREEN(yb - 1, xb)
IF pobrany2 = ASC("O") THEN pobrany3 = SCREEN(yb, xb + 1): IF pobrany3 = 32 THEN LOCATE yb, xb + 1: PRINT "O": LOCATE yb - 1, xb: PRINT " "
END IF
IF pobrany = ASC("A") THEN LOCATE yb, xb: PRINT "B";
IF pobrany = ASC("B") THEN LOCATE yb, xb: PRINT "C";
IF pobrany = ASC("C") THEN LOCATE yb, xb: PRINT "D";
IF pobrany = ASC("D") THEN LOCATE yb, xb: PRINT "A";
NEXT xb
NEXT yb
IF key$ = "" THEN GOTO petla
k$ = key$
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);
IF k$ = CHR$(27) THEN END
IF k$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 = SCREEN(y, x)
IF pobrany <> 32 AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
REM ************* kasowanie starego obrazka
LOCATE ys, xs: COLOR 14: PRINT " ";
REM ************* rysowanie nowego obrazka
LOCATE y, x: PRINT CHR$(2)
xs = x: ys = y
GOTO petla
|
|
Powrót do góry |
|
|
Zobacz poprzedni temat :: Zobacz następny temat |
Autor |
Wiadomość |
Piotr-246
Gość
|
Wysłany: Pon 18:43, 21 Cze 2021 Temat postu: |
|
|
SCREEN 13
DEF SEG = 0
DIM diament(0 TO 16) AS LONG
DIM diament2(0 TO 16) AS LONG
DIM diament3(0 TO 16) AS LONG
DIM diament4(0 TO 16) AS LONG
DIM czyste(0 TO 16) AS LONG
DIM tablica$(0 TO 22)
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 0: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament
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 15: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament2
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 15: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament3
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 15: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament4
REM ****************************** pomieszczenie
a$ = CHR$(176) + CHR$(176) + CHR$(176) + CHR$(176)
b$ = a$ + a$ + a$ + a$
c$ = CHR$(32) + CHR$(32) + CHR$(32) + CHR$(32)
d$ = c$ + c$ + c$ + c$ + " "
COLOR 12
PRINT b$; b$; a$; a$
FOR i = 1 TO 20
PRINT CHR$(176); c$; d$; d$; CHR$(176)
NEXT i
PRINT b$; b$; a$; a$
tablica$(0) = "AAAAAAAAAAAAOAAAAAAAAAOOOO+++++++++++++++++++++++++++O"
tablica$(1) = "AAAAAAAAAAAAOAAAAAAAAAOO+++++++++++++++++++++++++++OOO"
tablica$(2) = "A++++++++++++++++++++++OOO+++++++++++++++++++++++++++O"
tablica$(3) = "AAAAAAAAAAAAOAAAAAAAAAOOOO+++++++++++++++++++++++++++O"
tablica$(4) = "A++++++++++++++++++++++OOO+++++++++++++++++++++++++++O"
tablica$(5) = "AAAAAAAAAAAAOAAAAAAAAAOO+++++++++++++++++++++++++++OOO"
tablica$(6) = "A++++++++++++++++++++++OO+++++++++++++++++++++++++++OO"
tablica$(7) = "AAAAAAAAAAAAOAAAAAAAAAO+++++++++++++++++++++++++++OOOO"
tablica$(8) = "A+++++++++++++++++++++++++++++++++++++++++++++++++OOOO"
tablica$(9) = "AAAAA+++++++++++++++++++++++++++AAAAAAAOAAAAAAAAAOOOOO"
tablica$(10) = "A++++++++++++++++++++++++++++++++++++++++++++++++OOOO"
tablica$(11) = "AAAAAAAAAAAAOA..........................AAAAAAAAOOOOO"
tablica$(12) = "A+++++++++++++++..........................+++++++OOOO"
tablica$(13) = "AAAAAAAAAAAAOAAA..........................AAAAAAOOOOO"
tablica$(14) = "A++++++++++++++++..........................++++++OOOO"
tablica$(15) = "AAAAAAAAAAAAOAA..........................AAAAAAAOOOOO"
tablica$(16) = "A+++++++++++++++++...........................+++++OOOO"
tablica$(17) = "AAAAAAAAAAAAOAAAAAAA...........................AAOOOOO"
tablica$(18) = "A+++++++++++++++++............................+++++OOOO"
tablica$(19) = "AAAAAAAAAAAAOAAAA............................AAAAAOOOOO"
tablica$(20) = "A+++++++++++++++++++++++++++++++++++++++++++++++++++OOOO"
tablica$(21) = "AAAAAAAAAAAAOAAAAA...........................AAAAOOOOO"
tablica$(22) = "A++++++++++++++++............................++++++OOOO"
LOCATE 10, 10: PRINT CHR$(2)
x = 10: y = 17
xs = 10: ys = 17
REM *************************** petla glowna
petla:
REM petla opozniajaca
REM FOR delay = 1 TO 10: NEXT delay
key$ = ""
FOR yb = 22 TO 2 STEP -1
k$ = INKEY$
IF k$ <> "" THEN key$ = k$
FOR xb = 1 TO 39
pobrany = ASC(MID$(tablica$(yb), xb, 1))
LOCATE yb, xb: IF pobrany <> 65 THEN PRINT CHR$(pobrany);
IF pobrany = 32 THEN
pobrany2 = ASC(MID$(tablica$(yb - 1), xb, 1))
IF pobrany2 = ASC("O") THEN LOCATE yb, xb: PRINT "O"; : LOCATE yb - 1, xb: PRINT " ";
END IF
IF pobrany = ASC("O") THEN
pobrany2 = ASC(MID$(tablica$(yb - 1), xb, 1))
IF pobrany2 = ASC("O") THEN pobrany3 = ASC(MID$(tablica$(yb), xb - 1, 1)): IF pobrany3 = 32 THEN LOCATE yb, xb - 1: PRINT "O": LOCATE yb - 1, xb: PRINT " "
pobrany2 = ASC(MID$(tablica$(yb - 1), xb, 1))
IF pobrany2 = ASC("O") THEN pobrany3 = ASC(MID$(tablica$(yb), xb + 1, 1)): IF pobrany3 = 32 THEN LOCATE yb, xb + 1: PRINT "O": LOCATE yb - 1, xb: PRINT " "
END IF
IF pobrany = ASC("A") THEN
PUT ((xb - 1) * 8, (yb - 1) * 8), czyste, AND
IF faza = 0 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament, OR
IF faza = 1 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament2, OR
IF faza = 2 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament3, OR
IF faza = 3 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament4, OR
END IF
NEXT xb
NEXT yb
faza = faza + 1
IF faza = 4 THEN faza = 0
IF key$ = "" THEN GOTO petla
k$ = key$
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);
IF k$ = CHR$(27) THEN END
IF k$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 = SCREEN(y, x)
IF pobrany <> 32 AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
REM ************* kasowanie starego obrazka
LOCATE ys, xs: COLOR 14: PRINT " ";
REM ************* rysowanie nowego obrazka
LOCATE y, x: PRINT CHR$(2)
xs = x: ys = y
GOTO petla
|
|
Powrót do góry |
|
|
Zobacz poprzedni temat :: Zobacz następny temat |
Autor |
Wiadomość |
Piotr-246
Gość
|
Wysłany: Pon 19:11, 21 Cze 2021 Temat postu: |
|
|
REM gra musi chodzic w trybie Turbo
SCREEN 13
DEF SEG = 0
DIM diament(0 TO 16) AS LONG
DIM diament2(0 TO 16) AS LONG
DIM diament3(0 TO 16) AS LONG
DIM diament4(0 TO 16) AS LONG
DIM czyste(0 TO 16) AS LONG
DIM tablica$(0 TO 22)
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament3
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 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament4
REM ****************************** pomieszczenie
tablica$(0) = "AAAAAAAAAAAAOAAAAAAAAAOOOO+++++++++++++++++++++++++++O"
tablica$(1) = "AAAAAAAAAAAAOAAAAAAAAAOO+++++++++++++++++++++++++++OOO"
tablica$(2) = "A++++++++++++++++++++++OOO+++++++++++++++++++++++++++O"
tablica$(3) = "AAAAAAAAAAAAOAAAAAAAAAOOOO+++++++++++++++++++++++++++O"
tablica$(4) = "A++++++++++++++++++++++OOO+++++++++++++++++++++++++++O"
tablica$(5) = "AAAAAAAAAAAAOAAAAAAAAAOO+++++++++++++++++++++++++++OOO"
tablica$(6) = "A++++++++++++++++++++++OO+++++++++++++++++++++++++++OO"
tablica$(7) = "AAAAAAAAAAAAOAAAAAAAAAO+++++++++++++++++++++++++++OOOO"
tablica$(8) = "A+++++++++++++++++++++++++++++++++++++++++++++++++OOOO"
tablica$(9) = "AAAAA+++++++++++++++++++++++++++AAAAAAAOAAAAAAAAAOOOOO"
tablica$(10) = "A++++++++++++++++++++++++++++++++++++++++++++++++OOOO"
tablica$(11) = "AAAAAAAAAAAAOA..........................AAAAAAAAOOOOO"
tablica$(12) = "A+++++++++++++++..........................+++++++OOOO"
tablica$(13) = "AAAAAAAAAAAAOAAA..........................AAAAAAOOOOO"
tablica$(14) = "A++++++++++++++++..........................++++++OOOO"
tablica$(15) = "AAAAAAAAAAAAOAA..........................AAAAAAAOOOOO"
tablica$(16) = "A+++++++++++++++++...........................+++++OOOO"
tablica$(17) = "AAAAAAAAAAAAOAAAAAAA...........................AAOOOOO"
tablica$(18) = "A+++++++++++++++++............................+++++OOOO"
tablica$(19) = "AAAAAAAAAAAAOAAAA............................AAAAAOOOOO"
tablica$(20) = "A+++++++++++++++++++++++++++++++++++++++++++++++++++OOOO"
tablica$(21) = "AAAAAAAAAAAAOAAAAA...........................AAAAOOOOO"
tablica$(22) = "A++++++++++++++++............................++++++OOOO"
LOCATE 10, 10: PRINT CHR$(2)
x = 10: y = 17
xs = 10: ys = 17
REM *************************** petla glowna
petla:
REM petla opozniajaca
REM FOR delay = 1 TO 10: NEXT delay
key$ = ""
FOR yb = 22 TO 2 STEP -1
k$ = INKEY$
IF k$ <> "" THEN key$ = k$
FOR xb = 1 TO 39
pobrany = ASC(MID$(tablica$(yb), xb, 1))
IF pobrany = 32 THEN
LOCATE yb, xb: PRINT " "
pobrany2 = ASC(MID$(tablica$(yb - 1), xb, 1))
IF pobrany2 = ASC("O") THEN MID$(tablica$(yb), xb, 1) = "O": MID$(tablica$(yb - 1), xb, 1) = " "
END IF
IF pobrany = ASC("O") THEN
LOCATE yb, xb: PRINT "O";
pobrany2 = ASC(MID$(tablica$(yb - 1), xb, 1))
IF pobrany2 = ASC("O") THEN pobrany3 = ASC(MID$(tablica$(yb), xb - 1, 1)): IF pobrany3 = 32 THEN MID$(tablica$(yb), xb - 1, 1) = "O": MID$(tablica$(yb - 1), xb, 1) = " "
pobrany2 = ASC(MID$(tablica$(yb - 1), xb, 1))
IF pobrany2 = ASC("O") THEN pobrany3 = ASC(MID$(tablica$(yb), xb + 1, 1)): IF pobrany3 = 32 THEN MID$(tablica$(yb), xb + 1, 1) = "O": MID$(tablica$(yb - 1), xb, 1) = " "
END IF
IF pobrany = ASC("+") THEN LOCATE yb, xb: PRINT "+";
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT ((xb - 1) * 8, (yb - 1) * 8), czyste, AND
IF faza = 0 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament, OR
IF faza = 1 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament2, OR
IF faza = 2 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament3, OR
IF faza = 3 THEN PUT ((xb - 1) * 8, (yb - 1) * 8), diament4, OR
END IF
NEXT xb
NEXT yb
REM zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 0
IF key$ = "" THEN GOTO petla
k$ = key$
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);
IF k$ = CHR$(27) THEN END
IF k$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 = SCREEN(y, x)
IF pobrany <> 32 AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
REM ************* kasowanie starego obrazka
MID$(tablica$(ys), xs, 1) = " "
LOCATE ys, xs: COLOR 14: PRINT " ";
REM ************* rysowanie nowego obrazka
LOCATE y, x: PRINT CHR$(2)
xs = x: ys = y
GOTO petla
|
|
Powrót do góry |
|
|
Zobacz poprzedni temat :: Zobacz następny temat |
Autor |
Wiadomość |
Piotr-246
Gość
|
Wysłany: Pon 21:14, 21 Cze 2021 Temat postu: |
|
|
REM gra musi chodzic w trybie Turbo
SCREEN 13
DEF SEG = 0
DIM diament(0 TO 16) AS LONG
DIM diament2(0 TO 16) AS LONG
DIM diament3(0 TO 16) AS LONG
DIM diament4(0 TO 16) AS LONG
DIM kamien(0 TO 16) AS LONG
DIM czyste(0 TO 16) AS LONG
DIM murek(0 TO 16) AS LONG
DIM wegiel(0 TO 16) AS LONG
DIM tablica$(0 TO 24)
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 15 + 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 3 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 7 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), wegiel
REM ****************************** pomieszczenie
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO++++++++++++++%%"
tablica$(2) = "%++++++++++++++++++++++OOO++++++++++%+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO++++++++++++%%"
tablica$(4) = "%++%%%%%%%%%%%%%%%%%+++OOO++++++++++++%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO++++++++++++++%%"
tablica$(6) = "%++++++++++++++++++++++OO++++++++++++++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+++++++++++++++%"
tablica$(8) = "%A+++++++++++++++++++++++++++++++++++++%"
tablica$(9) = "%AAAA+++++++++++++++++++++++++++AAAAAAA%"
tablica$(10) = "%+++++++++++++++++++++++++++++++++.++++%"
tablica$(11) = "%AAAAAAAAAAAOA.........................%"
tablica$(12) = "%+++++++++++++++.......................%"
tablica$(13) = "%AAAAAAAAAAAOAAA..........++++++++++...%"
tablica$(14) = "%++++++++++++++++..............++......%"
tablica$(15) = "%AAAAAAAAAAAOAA................++......%"
tablica$(16) = "%+++++++++++++++++.............++.....%%"
tablica$(17) = "%AAAAAAAAAAAOAAAAAAA...........++......%"
tablica$(18) = "%+++++++++++++++++...................%%%"
tablica$(19) = "%AAAAAAAAAAAOAAAA......................%"
tablica$(20) = "%++++++++++++++++++++++++++++++++++%%%%%"
tablica$(21) = "%AAAAAAAAAAAOAAAAA.....%%..............%"
tablica$(22) = "%++++++++++++++++....%%%%%%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
LOCATE 10, 10: PRINT CHR$(2)
x = 10: y = 17
xs = 10: ys = 17
REM *************************** petla glowna
petla:
REM petla opozniajaca
REM FOR delay = 1 TO 10: NEXT delay
key$ = ""
FOR yb = 24 TO 0 STEP -1
k$ = INKEY$
IF k$ <> "" THEN key$ = k$
FOR xb = 0 TO 39
pobrany = ASC(MID$(tablica$(yb), xb + 1, 1))
IF pobrany = 32 THEN
LOCATE yb, xb: PRINT " "
pobrany2 = ASC(MID$(tablica$(yb - 1), xb + 1, 1))
IF pobrany2 = ASC("O") THEN MID$(tablica$(yb), xb + 1, 1) = "O": MID$(tablica$(yb - 1), xb + 1, 1) = " "
END IF
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
pobrany2 = ASC(MID$(tablica$(yb - 1), xb + 1, 1))
IF pobrany2 = ASC("O") THEN pobrany3 = ASC(MID$(tablica$(yb), xb - 1 + 1, 1)): IF pobrany3 = 32 THEN MID$(tablica$(yb), xb - 1 + 1, 1) = "O": MID$(tablica$(yb - 1), xb + 1, 1) = " "
pobrany2 = ASC(MID$(tablica$(yb - 1), xb + 1, 1))
IF pobrany2 = ASC("O") THEN pobrany3 = ASC(MID$(tablica$(yb), xb + 1 + 1, 1)): IF pobrany3 = 32 THEN MID$(tablica$(yb), xb + 1 + 1, 1) = "O": MID$(tablica$(yb - 1), xb + 1, 1) = " "
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
REM zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 0
IF key$ = "" THEN GOTO petla
k$ = key$
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);
IF k$ = CHR$(27) THEN END
IF k$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 = SCREEN(y, x)
IF pobrany <> 32 AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
REM ************* kasowanie starego obrazka
MID$(tablica$(ys), xs, 1) = " "
LOCATE ys, xs: COLOR 14: PRINT " ";
REM ************* rysowanie nowego obrazka
LOCATE y, x: PRINT CHR$(2)
xs = x: ys = y
GOTO petla
|
|
Powrót do góry |
|
|
Zobacz poprzedni temat :: Zobacz następny temat |
Autor |
Wiadomość |
Piotr-246
Gość
|
Wysłany: Wto 5:52, 22 Cze 2021 Temat postu: |
|
|
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
LOCATE 10, 10: PRINT CHR$(2)
x = 10: y = 17
xs = 10: ys = 17
REM *************************** petla glowna
petla:
REM petla opozniajaca
REM FOR delay = 1 TO 10: NEXT delay
key$ = ""
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 = 32 THEN
LOCATE yb, xb: PRINT " "
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC(" ")
END IF
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): IF pobrany3 = 32 THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb - 1) = 32
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): IF pobrany3 = 32 THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb - 1) = 32
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
REM zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 0
IF key$ = "" THEN GOTO petla
k$ = key$
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
REM PRINT k$; : IF k$ <> "" THEN PRINT ASC(k$);
IF k$ = CHR$(27) THEN END
IF k$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 = SCREEN(y, x)
IF pobrany <> 32 AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
REM ************* kasowanie starego obrazka
tabl(xs, ys) = 32
LOCATE ys, xs: COLOR 14: PRINT " ";
REM ************* rysowanie nowego obrazka
LOCATE y, x: PRINT CHR$(2)
xs = x: ys = y
GOTO petla
SUB elementy
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 15 + 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 3 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 7 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), wegiel
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO++++++++++++++%%"
tablica$(2) = "%++++++++++++++++++++++OOO++++++++++%+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO++++++++++++%%"
tablica$(4) = "%++%%%%%%%%%%%%%%%%%+++OOO++++++++++++%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO++++++++++++++%%"
tablica$(6) = "%++++++++++++++++++++++OO++++++++++++++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+++++++++++++++%"
tablica$(8) = "%A+++++++++++++++++++++++++++++++++++++%"
tablica$(9) = "%AAAA+++++++++++++++++++++++++++AAAAAAA%"
tablica$(10) = "%+++++++++++++++++++++++++++++++++.++++%"
tablica$(11) = "%AAAAAAAAAAAOA.........................%"
tablica$(12) = "%+++++++++++++++.......................%"
tablica$(13) = "%AAAAAAAAAAAOAAA..........++++++++++...%"
tablica$(14) = "%++++++++++++++++..............++......%"
tablica$(15) = "%AAAAAAAAAAAOAA................++......%"
tablica$(16) = "%+++++++++++++++++.............++.....%%"
tablica$(17) = "%AAAAAAAAAAAOAAAAAAA...........++......%"
tablica$(18) = "%+++++++++++++++++...................%%%"
tablica$(19) = "%AAAAAAAAAAAOAAAA......................%"
tablica$(20) = "%++++++++++++++++++++++++++++++++++%%%%%"
tablica$(21) = "%AAAAAAAAAAAOAAAAA.....%%..............%"
tablica$(22) = "%++++++++++++++++....%%%%%%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Wto 6:57, 22 Cze 2021 Temat postu: |
|
|
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(10, 10) = 2
x = 10: y = 10
xs = 10: ys = 10
REM *************************** petla glowna
petla:
key$ = ""
REM *************************** sprawdzenie 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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
END IF
IF pobrany = ASC("O") THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 pobrany <> ASC(".") AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
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
SUB elementy
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 15 + 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 3 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 7 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), wegiel
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO++++++++++++++%%"
tablica$(2) = "%++++++++++++++++++++++OOO++++++++++%+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO++++++++++++%%"
tablica$(4) = "%++%%%%%%%%%%%%%%%%%+++OOO++++++++++++%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO++++++++++++++%%"
tablica$(6) = "%++++++++++++++++++++++OO++++++++++++++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+++++++++++++++%"
tablica$(8) = "%A+++++++++++++++++++++.+++++++++++++++%"
tablica$(9) = "%AAAA++++++++++++++++++.++++++++AAAAAAA%"
tablica$(10) = "%+++++++++++++++++++++..++++++++++.++++%"
tablica$(11) = "%AAAAAAAAAAAOA.........................%"
tablica$(12) = "%+++++++++++++++.......................%"
tablica$(13) = "%AAAAAAAAAAAOAAA..........++++++++++...%"
tablica$(14) = "%++++++++++++++++..............++......%"
tablica$(15) = "%AAAAAAAAAAAOAA................++......%"
tablica$(16) = "%+++++++++++++++++.............++.....%%"
tablica$(17) = "%AAAAAAAAAAAOAAAAA.............++......%"
tablica$(18) = "%+++++++++++++++++...................%%%"
tablica$(19) = "%AAAAAAAAAAAOAAAA......................%"
tablica$(20) = "%++++++++++++++++++++++++++++++++++%%%%%"
tablica$(21) = "%AAAAAAAAAAAOAAAAA.....%%..............%"
tablica$(22) = "%++++++++++++++++....%%%%%%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Wto 7:52, 22 Cze 2021 Temat postu: |
|
|
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(10, 10) = 2
x = 10: y = 10
xs = 10: ys = 10
REM *************************** petla glowna
petla:
key$ = ""
REM *************************** sprawdzenie 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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok3
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok3
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok3:
END IF
REM IF pobrany = ASC("O") THEN
REM pobrany2 = tabl(xb, yb - 1)
REM IF pobrany2 > 64 THEN pobrany3 = tabl(xb - 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb - 1, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
REM IF pobrany2 > 64 THEN pobrany3 = tabl(xb + 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb + 1, yb) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
REM skok:
REM END IF
REM IF pobrany = ASC("A") THEN
REM pobrany2 = tabl(xb, yb - 1)
REM IF pobrany2 > 64 THEN pobrany3 = tabl(xb - 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb - 1, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok2
REM IF pobrany2 > 64 THEN pobrany3 = tabl(xb + 1, yb): IF pobrany3 = ASC(".") THEN tabl(xb + 1, yb) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
REM skok2:
REM END IF
NEXT xb
NEXT yb
REM *************************** wyswietlenie tablicy
FOR yb = 0 TO 24
k$ = INKEY$
IF k$ <> "" THEN key$ = k$
FOR xb = 0 TO 39
pobrany = tabl(xb, yb)
IF pobrany = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 pobrany <> ASC(".") AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
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
SUB elementy
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 15 + 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 3 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 7 + 16: PSET (xr, yr)
NEXT xr
NEXT yr
GET (0, 0)-(7, 7), wegiel
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO+++++A++++++++%%"
tablica$(2) = "%++++++++++++++++++++++OOO+++A++++++%+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO+++A++++++++%%"
tablica$(4) = "%++%%%%%%%%%%%%%%%%%+++OOO+++A++++++++%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO+++++A++++++++%%"
tablica$(6) = "%++++++++++++++++++++++OO++++A+++++++++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+++++A+++++++++%"
tablica$(8) = "%A+++++++++++++++++++++.+++++A+++++++++%"
tablica$(9) = "%AAAA++++++++++++++++++.+++++A++AAAAAAA%"
tablica$(10) = "%+++++++++++++++++++++..+++...++++.++++%"
tablica$(11) = "%AAAAAAAAAAAOA.........................%"
tablica$(12) = "%++++++++++%%M.........................%"
tablica$(13) = "%+AAAAAAAAAAOAAA..............++++++...%"
tablica$(14) = "%++++++++++++++++..............++......%"
tablica$(15) = "%+AAAAAAAAAAOAA................++......%"
tablica$(16) = "%+++++++++++++++++.............++.....%%"
tablica$(17) = "%+AAAAAAAAAAOAAAAA.............++......%"
tablica$(18) = "%+++++++++++++++++...................%%%"
tablica$(19) = "%+AAAAAAAAAAOAAAA......................%"
tablica$(20) = "%++++++++++++++++++++++++++++++++++%%%%%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA.....%%..............%"
tablica$(22) = "%++++++++++++++++....%%%%%%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Wto 10:11, 22 Cze 2021 Temat postu: |
|
|
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(10, 10) = 2
x = 10: y = 10
xs = 10: ys = 10
REM *************************** petla glowna
petla:
key$ = ""
REM *************************** sprawdzenie 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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 pobrany <> ASC(".") AND pobrany <> ASC("+") THEN x = xs: y = ys: FOR i = 85 TO 80 STEP -1: SOUND i, .07: NEXT i: GOTO petla
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
SUB elementy
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 4 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 2 + 16: 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
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(2) = "%+++++++++++O+++MMMM+++OOO+++A++++++A+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO+++A++++++O+%%"
tablica$(4) = "%++MMMMMMMMMOMMMMMMM+++OOO+++A++++++A+%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(6) = "%+++++++++++O++++++++++OOO+++A++++++A++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+O+++A++++++O++%"
tablica$(8) = "%A++++++++++O++++MMMM++.+O+++A++++++A++%"
tablica$(9) = "%AAAA+++++++O++++++++++.+O+++A++.......%"
tablica$(10) = "%++++++++++..+++++++++....+...++++...++%"
tablica$(11) = "%AAAAAAAA..............................%"
tablica$(12) = "%++++++++..MMM.........................%"
tablica$(13) = "%+AAAAAAAA....................++++.....%"
tablica$(14) = "%++++++++++....................++......%"
tablica$(15) = "%+AAAAAAAAAA...................++......%"
tablica$(16) = "%++++++++++....................++......%"
tablica$(17) = "%+AAAAAAAAAAOAA................++......%"
tablica$(18) = "%+++++++++++++++.......MM..............%"
tablica$(19) = "%+AAAAAAAAAAOAAAA......................%"
tablica$(20) = "%+++++++++++++++.....MMMMMM++++++......%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA...M.%%..............%"
tablica$(22) = "%++++++++++++++++....MMMMM%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Wto 13:03, 22 Cze 2021 Temat postu: |
|
|
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(10, 10) = 2
x = 10: y = 10
xs = 10: ys = 10
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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepk = 1
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepd = 1
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
IF beepk = 1 THEN SOUND 40, .5: GOTO skok2
IF beepd = 1 THEN SOUND 5000, .5
skok2:
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("A") THEN SOUND 1600, .2: SOUND 900, .2
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
SUB elementy
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 2 + 16: 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
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(2) = "%+++++++++++O+++MMMM+++OOO+++A++++++A+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO+++A++++++O+%%"
tablica$(4) = "%++MMMMMMMMMOMMMMMMM+++OOO+++A++++++A+%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(6) = "%+++++++++++O++++++++++OOO+++A++++++A++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+O+++A++++++O++%"
tablica$(8) = "%A++++++++++O++++MMMM++.+O+++A++++++A++%"
tablica$(9) = "%AAAA+++++++O++++++++++.+O+++A++.......%"
tablica$(10) = "%++++++++++..+++++++++....+...++++...++%"
tablica$(11) = "%AAAAAAAA..............................%"
tablica$(12) = "%++++++++..MMM.........................%"
tablica$(13) = "%+AAAAAAAA....................++++.....%"
tablica$(14) = "%++++++++++....................++......%"
tablica$(15) = "%+AAAAAAAAAA...................++......%"
tablica$(16) = "%++++++++++....................++......%"
tablica$(17) = "%+AAAAAAAAAAOAA................++......%"
tablica$(18) = "%+++++++++++++++.......MM..............%"
tablica$(19) = "%+AAAAAAAAAAOAAAA......................%"
tablica$(20) = "%+++++++++++++++.....MMMMMM++++++......%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA...M.%%..............%"
tablica$(22) = "%++++++++++++++++....MMMMM%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Wto 14:37, 22 Cze 2021 Temat postu: |
|
|
DECLARE SUB beepkam ()
DECLARE SUB beepdia ()
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(10, 10) = 2
x = 10: y = 10
xs = 10: ys = 10
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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepk = 1
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepd = 1
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
IF beepk = 1 THEN beepkam: GOTO skok2
IF beepd = 1 THEN beepdia
skok2:
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
REM IF pobrany = ASC("A") THEN SOUND 1600, 1: SOUND 900, 1
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
SUB beepdia
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, 2
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 3
OUT 66, 250: OUT 66, 2
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB beepkam
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, 1
OUT 66, 250: OUT 66, 0
OUT 66, 32: OUT 66, 1
OUT 66, 32: OUT 66, 0
OUT 66, 104: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 250: OUT 66, 1
OUT 66, 32: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB elementy
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 2 + 16: 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
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(2) = "%+++++++++++O+++MMMM+++OOO+++A++++++A+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO+++A++++++O+%%"
tablica$(4) = "%++MMMMMMMMMOMMMMMMM+++OOO+++A++++++A+%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(6) = "%+++++++++++O++++++++++OOO+++A++++++A++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+O+++A++++++O++%"
tablica$(8) = "%A++++++++++O++++MMMM++.+O+++A++++++A++%"
tablica$(9) = "%AAAA+++++++O++++++++++.+O+++A++.......%"
tablica$(10) = "%++++++++++..+++++++++....+...++++...++%"
tablica$(11) = "%AAAAAAAA..............................%"
tablica$(12) = "%++++++++..MMM.........................%"
tablica$(13) = "%+AAAAAAAA....................++++.....%"
tablica$(14) = "%++++++++++....................++......%"
tablica$(15) = "%+AAAAAAAAAA...................++......%"
tablica$(16) = "%++++++++++....................++......%"
tablica$(17) = "%+AAAAAAAAAAOAA................++......%"
tablica$(18) = "%+++++++++++++++.......MM..............%"
tablica$(19) = "%+AAAAAAAAAAOAAAA......................%"
tablica$(20) = "%+++++++++++++++.....MMMMMM++++++......%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA...M.%%..............%"
tablica$(22) = "%++++++++++++++++....MMMMM%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Wto 16:03, 22 Cze 2021 Temat postu: |
|
|
DECLARE SUB braniedia ()
DECLARE SUB beepkam ()
DECLARE SUB beepdia ()
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(10, 10) = 2
x = 10: y = 10
xs = 10: ys = 10
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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepk = 1
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepd = 1
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
IF beepk = 1 THEN beepkam: GOTO skok2
IF beepd = 1 THEN beepdia
skok2:
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 pobrany <> ASC(".") AND pobrany <> ASC("+") AND pobrany <> ASC("A") THEN x = xs: y = ys: GOTO petla
IF pobrany = ASC("A") THEN braniedia: REM SOUND 1600, 1: SOUND 900, 1
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
SUB beepdia
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, 2
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 3
OUT 66, 250: OUT 66, 2
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB beepkam
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, 1
OUT 66, 250: OUT 66, 0
OUT 66, 32: OUT 66, 1
OUT 66, 32: OUT 66, 0
OUT 66, 104: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 250: OUT 66, 1
OUT 66, 32: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB 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 elementy
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = ":" THEN COLOR 0 + 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 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament2
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), diament3
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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 10 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 15 + 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), 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 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 9 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "#" THEN COLOR 14 + 16: 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 5 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "$" THEN COLOR 2 + 16: 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
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(2) = "%+++++++++++O+++MMMM+++OOO+++A++++++A+%%"
tablica$(3) = "%AAAAAAAAAAAOAAAAAAAAAOOOO+++A++++++O+%%"
tablica$(4) = "%++MMMMMMMMMOMMMMMMM+++OOO+++A++++++A+%%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAAAAAOO+O+++A++++++O+%%"
tablica$(6) = "%+++++++++++O++++++++++OOO+++A++++++A++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAAAAAAO+O+++A++++++O++%"
tablica$(8) = "%A++++++++++O++++MMMM++.+O+++A++++++A++%"
tablica$(9) = "%AAAA+++++++O++++++++++.+O+++A++.......%"
tablica$(10) = "%++++++++++..+++++++++....+...++++...++%"
tablica$(11) = "%AAAAAAAA..............................%"
tablica$(12) = "%++++++++..MMM.........................%"
tablica$(13) = "%+AAAAAAAA....................++++.....%"
tablica$(14) = "%++++++++++....................++......%"
tablica$(15) = "%+AAAAAAAAAA...................++......%"
tablica$(16) = "%++++++++++....................++......%"
tablica$(17) = "%+AAAAAAAAAAOAA................++......%"
tablica$(18) = "%+++++++++++++++.......MM..............%"
tablica$(19) = "%+AAAAAAAAAAOAAAA......................%"
tablica$(20) = "%+++++++++++++++.....MMMMMM++++++......%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA...M.%%..............%"
tablica$(22) = "%++++++++++++++++....MMMMM%............%"
tablica$(23) = "%++++++++++++++++....%%%%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Śro 8:47, 23 Cze 2021 Temat postu: |
|
|
DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam ()
DECLARE SUB beepdia ()
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 pomoc$(0 TO 7)
DIM SHARED tablica$(0 TO 24)
DIM SHARED tabl(0 TO 39, 0 TO 24) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(3, 3) = 3
x = 3: y = 3
xs = 3: ys = 3
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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepk = 1
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepd = 1
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
IF beepk = 1 THEN beepkam: GOTO skok2
IF beepd = 1 THEN beepdia
skok2:
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 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: REM SOUND 1600, 1: SOUND 900, 1
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
SUB beepdia
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, 2
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 3
OUT 66, 250: OUT 66, 2
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB beepkam
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, 1
OUT 66, 250: OUT 66, 0
OUT 66, 32: OUT 66, 1
OUT 66, 32: OUT 66, 0
OUT 66, 104: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 250: OUT 66, 1
OUT 66, 32: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB 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
REM odcienie kamienia +48
FOR i = 0 TO 15
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
NEXT i
REM odcienie diamentu +64
FOR i = 0 TO 15
PALETTE 64 + i, INT(i * 4) * 65536 + INT(i * 3.5) * 256 + i * 3
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 7
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
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 + 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), diament2
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 + 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), diament3
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 + 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), 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)
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
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.......AAAAOAAAAAA%AAOO+OA++A+AO+++O++%"
tablica$(2) = "%.......++++O+++MMM%O++OOO+A+A+AO+A+A++%"
tablica$(3) = "%.......AAAAOAAAAAA%AAOOOOAOAAOOAAO+O++%"
tablica$(4) = "%.......MMMMO++++++%+O+OOOAAOAAAOAO+AOA%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAA%AAOO+O+OAOOAAO++O++%"
tablica$(6) = "%%%%%%%%%%%%%%+++++%+O+OOOA+OAAAO+AOA++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAA%AAAO+OOOOAOAAAO+OA+%"
tablica$(8) = "%A++++++++++O++++MM%M+AAAOAAOAAOAOO+A+A%"
tablica$(9) = "%AAAA+++++++O++++++%OOOOOOOOOOOOOAOOAAA%"
tablica$(10) = "%++++++++++..++++++%AAAAAAOOOOOOOAAAAAA%"
tablica$(11) = "%AAAAAAAA..........%%%%%%%%%%+%%%%%%%%%%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%...................%"
tablica$(13) = "%+AAAAAAAA.........%...................%"
tablica$(14) = "%++++++++++........%...................%"
tablica$(15) = "%+AAAA+++AAA.......%MMMMMM.......MMMMMM%"
tablica$(16) = "%++++++++++........%...................%"
tablica$(17) = "%+AAAAAAAAAAOAA....%+++++..............%"
tablica$(18) = "%+++++++++++++++...%...................%"
tablica$(19) = "%+AAAAAA++AAOAAAA..........+++++++.....%"
tablica$(20) = "%+++++++++++++++............+++++......%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA.....................%"
tablica$(22) = "%++++++++++++++++....MMM...............%"
tablica$(23) = "%++++++++++++++++.......%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Śro 11:26, 23 Cze 2021 Temat postu: |
|
|
DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam ()
DECLARE SUB beepdia ()
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 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 1) AS INTEGER
DIM SHARED moty(0 TO 1) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(3, 3) = 3
x = 3: y = 3
xs = 3: ys = 3
motx(0) = 15: moty(0) = 17
motx(1) = 23: moty(1) = 23
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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepk = 1
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepd = 1
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
REM ****************** ruch motyli
FOR mot = 0 TO 1
mx = motx(mot)
my = moty(mot)
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 ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx + 1
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my + 1
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx - 1
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my - 1
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: 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
NEXT mot
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR
IF pobrany = ASC("X") THEN PUT (xb * 8, yb * 8), motyl1, OR
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
IF beepk = 1 THEN beepkam: GOTO skok2
IF beepd = 1 THEN beepdia
skok2:
REM ************** zmiana fazy falowania diamentu:
faza = faza + 1
IF faza = 4 THEN faza = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 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: REM SOUND 1600, 1: SOUND 900, 1
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
SUB beepdia
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, 2
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 3
OUT 66, 250: OUT 66, 2
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB beepkam
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, 1
OUT 66, 250: OUT 66, 0
OUT 66, 32: OUT 66, 1
OUT 66, 32: OUT 66, 0
OUT 66, 104: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 250: OUT 66, 1
OUT 66, 32: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB 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
REM odcienie kamienia +48
FOR i = 0 TO 15
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
NEXT i
REM odcienie diamentu +64
FOR i = 0 TO 15
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 7
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
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 + 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), diament2
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 + 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), diament3
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 + 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), 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)
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 7
IF MID$(pomoc$(yr), xr + 1, 1) = "." THEN COLOR 1 + 16: PSET (xr, yr)
IF MID$(pomoc$(yr), xr + 1, 1) = "*" THEN COLOR 6 + 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), motyl1
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.......AAAAOAAAAAA%AAOO+OA++A+AO+++O++%"
tablica$(2) = "%.......++++O+++MMM%O++OOO+A+A+AO+A+A++%"
tablica$(3) = "%.......AAAAOAAAAAA%AAOOOOAOAAOOAAO+O++%"
tablica$(4) = "%.......MMMMO++++++%+O+OOOAAOAAAOAO+AOA%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAA%AAOO+O+OAOOAAO++O++%"
tablica$(6) = "%%%%%%%%%%%%%%+++++%+O+OOOA+OAAAO+AOA++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAA%AAAO+OOOOAOAAAO+OA+%"
tablica$(8) = "%A++++++++++O++++MM%M+AAAOAAOAAOAOO+A+A%"
tablica$(9) = "%AAAA+++++++O++++++%OOOOOOOOOOOOOAOOAAA%"
tablica$(10) = "%++++++++++..++++++%AAAAAAOOOOOOOAAAAAA%"
tablica$(11) = "%AAAAAAAA..........%%%%%%%%%%+%%%%%%%%%%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%...................%"
tablica$(13) = "%+AAAAAAAA.........%...................%"
tablica$(14) = "%++++++++++........%...................%"
tablica$(15) = "%+AAAA+++AAA.......%MMMMMM.......MMMMMM%"
tablica$(16) = "%++++++++++........%...................%"
tablica$(17) = "%+AAAAAAAAAAOAA....%...................%"
tablica$(18) = "%+++++++++++++++...%...................%"
tablica$(19) = "%+AAAAAA++AAOAAAA......................%"
tablica$(20) = "%+++++++++++++++.......................%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA.....................%"
tablica$(22) = "%++++++++++++++++......................%"
tablica$(23) = "%++++++++++++++++.......%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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ść
|
Wysłany: Śro 14:20, 23 Cze 2021 Temat postu: |
|
|
DECLARE SUB chrup ()
DECLARE SUB braniedia ()
DECLARE SUB beepkam ()
DECLARE SUB beepdia ()
DECLARE SUB plansza ()
DECLARE SUB elementy ()
REM gra musi chodzic w trybie Turbo
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 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 1) AS INTEGER
DIM SHARED moty(0 TO 1) AS INTEGER
REM ************************ zaladowanie elementow graficznych
elementy
REM ****************************** zaladowanie planszy
plansza
REM ************************ dane startowe
tabl(3, 3) = 3
x = 3: y = 3
xs = 3: ys = 3
motx(0) = 15: moty(0) = 17
motx(1) = 23: moty(1) = 23
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
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN tabl(xb, yb) = ASC("O"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepk = 1
IF pobrany2 = ASC("A") THEN tabl(xb, yb) = ASC("A"): tabl(xb, yb - 1) = ASC("."): IF tabl(xb, yb + 1) <> ASC(".") THEN beepd = 1
END IF
REM znaki wieksze od ascii 64 powoduja upadek w bok
IF pobrany > 64 THEN
pobrany2 = tabl(xb, yb - 1)
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("O") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("O"): tabl(xb, yb - 1) = ASC(".")
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb - 1, yb): pobrany4 = tabl(xb - 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb - 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC("."): GOTO skok
IF pobrany2 = ASC("A") THEN pobrany3 = tabl(xb + 1, yb): pobrany4 = tabl(xb + 1, yb - 1): IF pobrany3 = ASC(".") AND pobrany4 = ASC(".") THEN tabl(xb + 1, yb - 1) = ASC("A"): tabl(xb, yb - 1) = ASC(".")
skok:
END IF
NEXT xb
NEXT yb
REM ****************** ruch motyli
FOR mot = 0 TO 1
mx = motx(mot)
my = moty(mot)
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 ruch w prawo
IF ruch = 0 AND nie8 = 1 AND nie2 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx + 1
IF ruch = 0 AND nie1 = 1 AND nie2 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx + 1
REM ruch w dol
IF ruch = 0 AND nie2 = 1 AND nie4 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my + 1
IF ruch = 0 AND nie3 = 1 AND nie4 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my + 1
REM ruch w lewo
IF ruch = 0 AND nie4 = 1 AND nie6 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx - 1
IF ruch = 0 AND nie5 = 1 AND nie6 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx - 1
REM ruch w gore
IF ruch = 0 AND nie6 = 1 AND nie8 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my - 1
IF ruch = 0 AND nie7 = 1 AND nie8 = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my - 1
IF ruch = 0 AND nie2 = 0 AND nie4 = 0 AND nie6 = 0 AND nie8 = 0 THEN
IF fazamotyla = 0 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx + 1
IF fazamotyla = 1 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my + 1
IF fazamotyla = 2 THEN ruch = 1: tabl(mx, my) = ASC("."): mx = mx - 1
IF fazamotyla = 3 THEN ruch = 1: tabl(mx, my) = ASC("."): my = my - 1
END IF
IF ruch = 0 THEN tabl(mx, my) = ASC("X")
IF ruch = 1 THEN tabl(mx, my) = ASC("X "): motx(mot) = mx: moty(mot) = my
NEXT mot
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 = 2 THEN LOCATE yb + 1, xb + 1: COLOR 14: PRINT CHR$(2);
IF pobrany = ASC(".") THEN LOCATE yb + 1, xb + 1: PRINT " ";
IF pobrany = ASC("O") THEN
PUT (xb * 8, yb * 8), czyste, AND
PUT (xb * 8, yb * 8), kamien, OR
END IF
IF pobrany = ASC("+") THEN PUT (xb * 8, yb * 8), wegiel, OR
IF pobrany = ASC("%") THEN PUT (xb * 8, yb * 8), stal, OR
IF pobrany = ASC("M") THEN PUT (xb * 8, yb * 8), murek, OR
IF pobrany = ASC("X") THEN
IF fazamotyla = 0 THEN PUT (xb * 8, yb * 8), motyl1, OR
IF fazamotyla = 1 THEN PUT (xb * 8, yb * 8), motyl2, OR
IF fazamotyla = 2 THEN PUT (xb * 8, yb * 8), motyl3, OR
IF fazamotyla = 3 THEN PUT (xb * 8, yb * 8), motyl2, OR
END IF
REM falowanie diamentu:
IF pobrany = ASC("A") THEN
PUT (xb * 8, yb * 8), czyste, AND
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
NEXT xb
NEXT yb
IF beepk = 1 THEN beepkam: GOTO skok2
IF beepd = 1 THEN beepdia
skok2:
REM ************** zmiana fazy falowania motyli i diamentow:
faza = faza + 1
IF faza = 4 THEN faza = 0
fazamotyla = fazamotyla + 1
IF fazamotyla = 4 THEN fazamotyla = 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$ = CHR$(0) + "M" THEN x = x + 1
IF k$ = CHR$(0) + "K" THEN x = x - 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 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: REM SOUND 1600, 1: SOUND 900, 1
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
SUB beepdia
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, 2
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 1
OUT 66, 250: OUT 66, 0
OUT 66, 64: OUT 66, 3
OUT 66, 250: OUT 66, 2
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB beepkam
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, 1
OUT 66, 250: OUT 66, 0
OUT 66, 32: OUT 66, 1
OUT 66, 32: OUT 66, 0
OUT 66, 104: OUT 66, 0
OUT 66, 48: OUT 66, 0
OUT 66, 250: OUT 66, 1
OUT 66, 32: OUT 66, 0
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB 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
REM odcienie kamienia +48
FOR i = 0 TO 15
PALETTE 48 + i, INT(i * 2.5) * 65536 + i * 3 * 256 + i * 4
NEXT i
REM odcienie diamentu +64
FOR i = 0 TO 15
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 7
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
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 + 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), diament2
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 + 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), diament3
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 + 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), 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)
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 1 + 16: 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
END SUB
SUB plansza
tablica$(0) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
tablica$(1) = "%.......AAAAOAAAAAA%AAOO+OA++A+AO+++O++%"
tablica$(2) = "%.......++++O+++MMM%O++OOO+A+A+AO+A+A++%"
tablica$(3) = "%.......AAAAOAAAAAA%AAOOOOAOAAOOAAO+O++%"
tablica$(4) = "%.......MMMMO++++++%+O+OOOAAOAAAOAO+AOA%"
tablica$(5) = "%AAAAAAAAAAAOAAAAAA%AAOO+O+OAOOAAO++O++%"
tablica$(6) = "%%%%%%%%%%%%%%+++++%+O+OOOA+OAAAO+AOA++%"
tablica$(7) = "%AAAAAAAAAAAAOAAAAA%AAAO+OOOOAOAAAO+OA+%"
tablica$(8) = "%A++++++++++O++++MM%M+AAAOAAOAAOAOO+A+A%"
tablica$(9) = "%AAAA+++++++O++++++%OOOOOOOOOOOOOAOOAAA%"
tablica$(10) = "%++++++++++..++++++%AAAAAAOOOOOOOAAAAAA%"
tablica$(11) = "%AAAAAAAA..........%%%%%%%%%%+%%%%%%%%%%"
tablica$(12) = "%++++%%%%%%%%%%%%%%%...................%"
tablica$(13) = "%+AAAAAAAA.........%...................%"
tablica$(14) = "%++++++++++........%...................%"
tablica$(15) = "%+AAAA+++AAA.......%MMMMMM.......MMMMMM%"
tablica$(16) = "%++++++++++........%...................%"
tablica$(17) = "%+AAAAAAAAAAOAA....%...................%"
tablica$(18) = "%+++++++++++++++...%...................%"
tablica$(19) = "%+AAAAAA++AAOAAAA......................%"
tablica$(20) = "%+++++++++++++++.......................%"
tablica$(21) = "%+AAAAAAAAAAOAAAAA.....................%"
tablica$(22) = "%++++++++++++++++......................%"
tablica$(23) = "%++++++++++++++++.......%%%............%"
tablica$(24) = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
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 |
|
|
|
|
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
|