private
{ Private declarations }
public
procedure komznach; //ïðîöåäóðà ðîçä³ëÿº êîìàíäó ³ çíà÷åííÿ ³ çàïèñóº ó â³äïîâ³äí³ çì³íí³
{ Public declarations }
end;
var
Form2: TForm2;
radok,znach ,komanda: string;
j,i,n,k: integer;
x0,y0:single;
move:boolean;
implementation
{$R *.fmx}
procedure TForm2.Button1Click(Sender: TObject);
begin
n:= Memo1.Lines.Count;
if memo1.Lines[0]<>'' then begin
radok:=memo1.Lines[0];
komznach;
timer1.Enabled:=true;
end;
i:=0 ;
k:=0;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
if komanda='ââåðõ'then begin image1.RotationAngle:=0; image1.Position.Y :=image1.Position.Y - 1; end;
if komanda='âíèç'then begin image1.RotationAngle:=180; image1.Position.Y :=image1.Position.Y + 1; end;
if komanda='âë³âî'then begin image1.RotationAngle:=270; image1.Position.x :=image1.Position.x - 1;end;
if komanda='âïðàâî'then begin image1.RotationAngle:=90; image1.Position.x :=image1.Position.x + 1;end;
inc(k);
if k = strtoint(znach) then begin
if i<n-1 then inc(i) else begin
i:=0;
timer1.Enabled:=false;
showmessage('Ïðîãðàìó çàâåðøåíî');
end;
radok:=memo1.Lines[i];
if memo1.Lines[i]<>'' then komznach;
k:=0;
end;
end;
//end;
procedure TForm2.FormCreate(Sender: TObject);
begin
image1.Bitmap.LoadFromFile('marsrover.jpg');
image2.Bitmap.LoadFromFile('mars1.jpg');
end;
procedure TForm2.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Single);
begin
if move then begin
image1.Position.x :=image1.Position.x+x-x0;
image1.Position.Y :=image1.Position.Y+y-y0;
end;
end;
procedure TForm2.komznach;
begin
for j := 0 to length(radok) do begin
if radok[j]=' ' then begin
komanda:=copy(radok,0,j-1);
znach:=copy(radok,j+1, length(radok)-j+1);
end;
end;
end;