setscreen ("graphics:500;400,offscreenonly")
View.Set ("noecho")
var playerx : int := maxx div 2
var playery : int := maxy div 2
var changex : int := 0
var changey : int := 0
var maptownstartx : int := 0
var maptownstarty : int := 0
var tilenumber : int := 30
var stream : int
var size : int := 36
open : stream, "003.map", get
var pictures : array 1 .. size, 1 .. size of int
var pic1 : int := Pic.FileNew ("001.bmp")
var pic2 : int := Pic.FileNew ("002.bmp")
var pic3 : int := Pic.FileNew ("003.bmp")
var pic4 : int := Pic.FileNew ("004.bmp")
var pic5 : int := Pic.FileNew ("005.bmp")
var pic6 : int := Pic.FileNew ("006.bmp")
var pic7 : int := Pic.FileNew ("007.bmp")
var pic8 : int := Pic.FileNew ("008.bmp")
var pic9 : int := Pic.FileNew ("009.bmp")
var pic10 : int := Pic.FileNew ("010.bmp")
var playerdown1 : int := Pic.FileNew ("walkdown1.bmp")
var playerdown2 : int := Pic.FileNew ("walkdown2.bmp")
var playerup1 : int := Pic.FileNew ("walkup1.bmp")
var playerup2 : int := Pic.FileNew ("walkup2.bmp")
var playerright1 : int := Pic.FileNew ("walkright1.bmp")
var playerright2 : int := Pic.FileNew ("walkright2.bmp")
var playerleft1 : int := Pic.FileNew ("walkleft1.bmp")
var playerleft2 : int := Pic.FileNew ("walkleft2.bmp")
for i : 1 .. size
get : stream, skip
exit when eof (stream)
for j : 1 .. size
get : stream, pictures (i, j)
end for
end for
close : stream
procedure maptown
for i : 1 .. size
for j : 1 .. size
if pictures (i, j) = 001 then
Pic.Draw (pic1, Pic.Width (pic1) * (j - 1 + changex), maxx - Pic.Height (pic1) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 002 then
Pic.Draw (pic2, Pic.Width (pic2) * (j - 1 + changex), maxx - Pic.Height (pic2) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 003 then
Pic.Draw (pic3, Pic.Width (pic3) * (j - 1 + changex), maxx - Pic.Height (pic3) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 004 then
Pic.Draw (pic4, Pic.Width (pic4) * (j - 1 + changex), maxx - Pic.Height (pic4) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 005 then
Pic.Draw (pic5, Pic.Width (pic5) * (j - 1 + changex), maxx - Pic.Height (pic5) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 006 then
Pic.Draw (pic6, Pic.Width (pic6) * (j - 1 + changex), maxx - Pic.Height (pic6) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 007 then
Pic.Draw (pic7, Pic.Width (pic7) * (j - 1 + changex), maxx - Pic.Height (pic7) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 008 then
Pic.Draw (pic8, Pic.Width (pic8) * (j - 1 + changex), maxx - Pic.Height (pic8) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 009 then
Pic.Draw (pic9, Pic.Width (pic9) * (j - 1 + changex), maxx - Pic.Height (pic9) * (i + 3 + changey), picCopy)
elsif pictures (i, j) = 010 then
Pic.Draw (pic10, Pic.Width (pic10) * (j - 1 + changex), maxx - Pic.Height (pic10) * (i + 3 + changey), picCopy)
end if
end for
end for
end maptown
procedure walk (down1, down2, funx, funy : int)
Draw.Cls
Time.Delay (150)
maptown
Pic.Draw (down2, funx, funy, picMerge)
View.Update
Draw.Cls
Time.Delay (150)
maptown %
Pic.Draw (down1, funx, funy, picMerge)
View.Update
end walk
procedure playgame
var chars : array char of boolean
loop
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
changey += 1
walk (playerup1, playerup2, playerx, playery)
elsif chars (KEY_RIGHT_ARROW) then
changex -= 1
walk (playerright1, playerright2, playerx, playery)
elsif chars (KEY_LEFT_ARROW) then
changex += 1
walk (playerleft1, playerleft2, playerx, playery)
elsif chars (KEY_DOWN_ARROW) then
changey -= 1
walk (playerdown1, playerdown2, playerx, playery)
end if
end loop
end playgame
playgame
|