Код
program platformer;
uses crt;
var x,y:integer;
xr,yr:integer;
key:char;
room:array[1..80,1..5]of integer;
file1:text;
exit:integer;
score:integer;
procedure load_room;
begin
assign(file1,'room');
reset(file1);
for yr:=1 to 5 do
begin
for xr:=1 to 80 do
begin
read(file1,room[xr,yr]);
end;
end;
close(file1);
end;
procedure draw_room;
begin
for yr:=1 to 5 do
begin
for xr:=1 to 80 do
begin
gotoxy(xr,yr);
case room[xr,yr] of
1: write(chr(219));
7: write(chr(178));
0: write('0');
2: write('|');
end;
end;
end;
end;
procedure main;
begin
x:=1;
y:=4;
exit:=0;
end;
procedure control;
begin
key:=readkey;
case ord(key) of
72: if room[x,y-1]<>1 then y:=y-1;
80: if room[x,y+1]<>1 then y:=y+1;
75: if room[x-1,y]<>1 then x:=x-1;
77: if room[x+1,y]<>1 then x:=x+1;
27: exit:=1;
end;
if room[x,y]=2 then
begin
room[x,y]:=0;
score:=score+1;
end;
end;
procedure draw_player;
begin
gotoxy(x,y);
write(chr(2));
gotoxy(80,6);
end;
procedure rez;
begin
gotoxy(1,6);
write(score,'score');
end;
begin
clrscr;
main;
load_room;
repeat
draw_room;
draw_player;
control;
rez;
until exit=1;
end.
Скачать обязательно, и вставить в одну дерикторию с игрой!