Kod: Tümünü seç
procedure TForm1.Timer1Timer(Sender: TObject);
var
A,B,e,f:integer;
begin
A:=RANDOM(3);
B:=RANDOM(3);
e:=RANDOM(3);
f:=RANDOM(3);
begin
if shape1.left=form1.Left
then
shape1.left:=shape1.Left-A
else shape1.left:=shape1.Left+A;
if shape1.top=form1.top
then
shape1.top:=shape1.top-B
else shape1.top:=shape1.top+B;
if shape1.Top<0 then dikeyyon.Caption:='+';
if shape1.Left<0 then yatayyon.Caption:='+';
if shape1.Top>410 then dikeyyon.Caption:='-';
if shape1.Left>552 then yatayyon.Caption:='-';
if shape1.Top=shape2.top then shape1.Top:=shape1.Top+10;
if shape1.Left=shape2.left then shape1.left:=shape1.Left+10;
if dikeyyon.Caption='+' then shape1.Top:=shape1.Top+10;
if dikeyyon.Caption='-' then shape1.Top:=shape1.Top-10;
if yatayyon.Caption='+' then shape1.left:=shape1.left+10;
if yatayyon.Caption='-' then shape1.left:=shape1.left-10;
end;
end;