Тема: фотки
Показать сообщение отдельно
Старый 14.04.2010, 14:09   #26
odd
Мастер
 
Аватар для odd
 
Регистрация: 06.09.2007
Адрес: Донецк, ДНР
Сообщений: 1,023
Написано 298 полезных сообщений
(для 713 пользователей)
Ответ: фотки

Сообщение от www12 Посмотреть сообщение
а не жостикам
Можно джойстиком, можно цифровыми кнопками:

Program Map;
const 
step = 8;
var
x, y, key, key2, i, j, hi, wi: integer;
imm : image;
rep: boolean;
begin
y
:=0; x:=0;
imm:=loadImage('/icon.png');
i:=GetImageHeight(imm);
j:=getImageWidth(imm);
wi:=GetWidth;
hi:=GetHeight;
rep:=true;

repeat

key2
:=GetKeyPressed;
key:=KeyToAction(key2); Delay(20);
if (
key2 = 50) then key:=GA_UP;
if (
key2 = 52) then key:=GA_LEFT;
if (
key2 = 54) then key:=GA_RIGHT;
if (
key2 = 56) then key:=GA_DOWN;
if (
key = GA_DOWN) and (y < hi - step - i) then begin y:=y+step; rep:=true; end;
if (
key = GA_UP) and (y > 0) then begin y:=y-step; rep:=true; end;
if (
key = GA_RIGHT) and (x < wi - step - j) then begin x:=x+step; rep:=true; end;
if (
key = GA_LEFT) and (x > 0) then begin x:=x-step; rep:=true; end;

if (
rep) then
begin
    SetColor
(255, 255, 255);
    
FillRect(0, 0, wi, hi);
    
DrawImage(imm, x, y);
    
repaint; rep:=false;
end;

until false;
end. 
(Offline)
 
Ответить с цитированием