program name; const speed=1; var i:integer; pos,pos1,pos2,pos3:integer; tank0,tank1,tank2,tank3:image; dir:image; x,y:integer; key:integer; begin tank0:=loadImage('/tank0.png'); tank1:=loadImage('/tank1.png'); tank2:=loadImage('/tank2.png'); tank3:=loadImage('/tank3.png'); dir:=tank0; x:=0; y:=0; pos:=20; pos1:=36; pos2:=36; pos3:=36; setColor(0,0,0); fillRect(0,0,getWidth,getHeight); repeat fillRect(x,y,16,16); key:=getKeyPressed; if key=KE_KEY6 then begin dir:=tank0; x:=x+speed; end else if key=KE_KEY8 then begin dir:=tank1; y:=y+speed; end else if key=KE_KEY4 then begin dir:=tank2; x:=x-speed; end else if key=KE_KEY2 then begin dir:=tank3; y:=y-speed; end; if (y>=pos) and (y+16<=pos3) and (x+16>=pos) then x:=pos-16; if (y+16>pos) and (x>=pos) and (x+16<=pos1) then y:=pos-16; if (y<=pos3) and (x>=pos3) and (x+16<=pos2) then y:=pos3; drawImage(loadImage('/prep.png'),pos,pos); drawImage(dir,x,y); repaint; delay(20); until getKeyClicked=KE_KEY0; end.