10.11.2011, 20:24
|
#50
|
ПроЭктировщик
Регистрация: 09.05.2010
Адрес: рф ро шахты
Сообщений: 177
Написано 66 полезных сообщений (для 271 пользователей)
|
Ответ: Помогите исправить ошибку
Сообщение от leonid
Со всем разобрался, но как исправить вторую проблему?
|
про то, что в конце карты должна быть пустая строка, забыл? нажми интер еще разок в конце текстового файла с картой и сохрани.
1211111111
1211111111
1211111111
1222211111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
// тут должна быть пустая строка

program lol;
var
i, j, x, y, key: integer;
S: string;
res: resource;
land_image: array [1..2] of image;
land_array: array [1..30, 1..30] of integer;
pers: image;
begin
land_image[1] := loadimage('/land1.png');
land_image[2] := loadimage('/land2.png');
for i := 1 to 30 do
for j := 1 to 30 do
begin
land_array [i, j] := 1;
end;
res := openresource('/map.txt');
for i := 1 to 10 do
begin
S := readline(res);
for j := 1 to 10 do
land_array[j, i] := stringtointeger(GetChar(S, j - 1));
end;
closeresource(res);
repeat
setcolor(255, 255, 255);
fillrect(0, 0, 240, 320);
for i := 1 to 10 do
for j := 1 to 10 do
begin
drawimage (land_image[land_array[j, i]], (j - 1) * 30, (i - 1) * 30);
end;
pers := loadImage('/pers.png');
drawimage(pers, x, y);
key := GetKeyPressed;
if keytoaction(key) = GA_UP then
begin
y := y - 1;
end;
if keytoaction(key) = GA_DOWN then
begin
y := y + 1;
end;
if keytoaction(key) = GA_LEFT then
begin
x := x - 1;
end;
if keytoaction(key) = GA_RIGHT then
begin
x := x + 1;
end;
repaint;
delay (40);
until (GetKeyPressed = KE_KEY0);
end.
__________________
to be or not to be - it's not a question!
2b or not 2b = ff
|
(Offline)
|
|