const levelWidth=15; levelHeight=15; var buf1,buf2:integer; winer:integer; tile1,man,kust,dom,tile,fon,fon2,play:image; map:array[0..19,0..19] of string; x,y,b,tri,tri2,zx,zc,m,a2,a4,a5,a6,a7,a8,key,image_id,ri,ri2,u,g,g1,d_x,d_y,r,n:integer; ScreenHeight,ScreenWidth,sh,sw:integer; res : resource; line:string; pos, wt:string; procedure LoadMap; begin res := OpenResource('/map.txt'); for y := 0 to levelHeight do begin line := ReadLine(res); for x := 0 to levelWidth do map[x,y] := GetChar(line,x); end; CloseResource(res); end; procedure RedrawMap; begin for y := 0 to levelHeight do for x := 0 to levelWidth do begin if map[x,y] = '5' then begin zx:=x*15+tri; zc:=y*15+tri2; DrawImage(fon,zx,zc); end; if map[x,y] = '1' then begin zx:=x*15+tri; zc:=y*15+tri2; DrawImage(dom,zx,zc); end; if map[x,y] = '2' then begin zx:=x*15+tri2; zc:=y*15+tri; DrawImage(kust,zx,zc); end; if map[x,y] = '3' then begin zx:=x*15+tri2; zc:=y*15+tri; DrawImage(tile,zx,zc); end; if map[x,y] = '4' then begin zx:=x*15+tri2; zc:=y*15+tri; DrawImage(tile1,zx,zc); end; end; end; procedure render; begin setcolor(255,255,255); RedrawMap; repaint; end; procedure pere; begin m:=0; for y := 0 to levelHeight do for x := 0 to levelWidth do begin if map[x,y] = '1,2,3,4' then begin zx:=x*16+tri2; zc:=y*16+tri; if (50<(zx+a5)) and ((50+a6)>zx) and (50<(zc+a7)) and ((50+a4)>zc) then m:=m+2; end; end; end; begin d_x:=0; d_y:=0; ScreenHeight := GetHeight; ScreenWidth := GetWidth; sw:=GetWidth; sh:=GetHeight; ri:=0; ri2:=0; tri:=0; m:=0; play:=loadimage('/play.png'); fon2:=LoadImage('/fon2.png'); fon := loadImage('/man2.png'); tile1 := loadimage('/tile1.png'); tile := loadimage('/tile.png'); kust := loadimage('/kust.png'); dom := loadimage('/dom.png'); a2:=getImageWidth(loadImage('/tile1.png')); a4:=getImageHeight (loadImage('/tile1.png')); a5:=getImageWidth (loadImage('/kust.png')); a6:=getImageWidth (loadImage('/tile.png')); a7:=getImageHeight (loadImage('/kust.png')); a8:=getImageHeight (loadImage('/tile.png')); LoadMap; render; repeat key := getKeyPressed; if key =KE_KEY2 then begin tri:=tri+6; pere; if (m>0) then tri := tri-6; end; if key =KE_KEY4 then begin tri2:=tri2+6; pere; if (m>0) then tri2 := tri2-6; end; if key =KE_KEY6 then begin tri2:=tri2-6; pere; if (m>0) then tri2 := tri2+6; end; if key =KE_KEY8 then begin tri:=tri-6; pere; if (m>0) then tri := tri+6; end; render; until key = KE_KEY0 ; end.