
Kod: Tümünü seç
[Error] Unit1.pas(175): Incompatible types: 'Parameter lists differ'
Kod: Tümünü seç
[Error] Unit1.pas(175): Incompatible types: 'Parameter lists differ'
Kod: Tümünü seç
procedure TForm1.newup(sender:Tobject);
Kod: Tümünü seç
procedure tform1.NEWUP(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
Kod: Tümünü seç
Const
{$j+}
x: Integer = 1;
y: Integer = 1;
{$j-}
Adim = 6;
begin
shape52.Left:=xyeri;
Shape52.Top:=yyeri;
xyeri := xyeri + (x*Adim);
yyeri := yyeri + (y*Adim);
If xyeri + (x*Adim) >= (Panel1.Width - Shape52.Width ) then x := x*(-1);
If yyeri + (y*Adim) >= (Panel1.Height - Shape52.Height) then y := y*(-1);
If xyeri+ (x*Adim) <= 0 then x := x*(-1);
If yyeri + (y*Adim) <= 0 then y := y*(-1);
label1.Caption:=inttostr(xyeri);
label2.Caption:=inttostr(yyeri);
if ((xyeri>=437) and (xyeri<=517)) and ((yyeri>=220) and (yyeri<=245)) then Shape28.Visible:=false;
if ((xyeri>=533) and (xyeri<=613)) and ((yyeri>=220) and (yyeri<=245)) then Shape29.Visible:=false;
if ((xyeri>=629) and (xyeri<=709)) and ((yyeri>=220) and (yyeri<=245)) then Shape30.Visible:=false;
if ((xyeri>=725) and (xyeri<=805)) and ((yyeri>=220) and (yyeri<=245)) then Shape31.Visible:=false;
if ((xyeri>=821) and (xyeri<=901)) and ((yyeri>=220) and (yyeri<=245)) then Shape32.Visible:=false;
if ((xyeri>=917) and (xyeri<=997)) and ((yyeri>=220) and (yyeri<=245)) then Shape33.Visible:=false;
Kod: Tümünü seç
Var
xyeri : Integer = 174;
yyeri : Integer = 192;
procedure TForm1.Timer1Timer(Sender: TObject);
Const
{$j+}
x: Integer = 1;
y: Integer = 1;
{$j-}
Adim = 6;
Var
i : Integer;
Shape : TShape;
begin
// Yeni Konumu Hesapladık
xyeri := xyeri + (x*Adim);
yyeri := yyeri + (y*Adim);
Label1.Caption := inttostr(xyeri);
Label2.Caption := inttostr(yyeri);
// 1. Durum : Hesapladığımız yeni konum Panel sınırlarına eriştiyse sapsın.
If xyeri + (x*Adim) >= (Panel1.Width - Shape52.Width ) then x := x*(-1);
If yyeri + (y*Adim) >= (Panel1.Height - Shape52.Height) then y := y*(-1);
If xyeri + (x*Adim) <= 0 then x := x*(-1);
If yyeri + (y*Adim) <= 0 then y := y*(-1);
// 2. Durum : Hesapladığımız yeni konum Hedef Shape sınırlarına eriştiyse sapsın, saparken de obje gizlensin.
// Her shape için ayrı ayrı işlem yapmak istemediğimden, bir işlemi her birisi için sorgulayarak sadeleştirme yapıyorum.
for i := 28 to 33 do
begin
// Shape sırasıyla Shape28, Shape29, Shape30, Shape31, Shape32, Shape33 olacak...
Shape := TShape( FindComponent( 'Shape'+ IntToStr(i) ) );
if Shape.Visible // Birinci şart shape görünür halde mi ?!
AND ( xyeri >= Shape.Left)
AND ( xyeri <= Shape.Left+Shape.Width)
AND ( yyeri >= Shape.Top )
AND ( yyeri <= Shape.Top +Shape.Height) then
begin
// önce gizle
Shape.Visible:=false;
// sonra topun yönünü saptır.
x := x*(-1);
y := y*(-1);
end;
end;
// Konumumuzu aldık
Shape52.Left := xyeri;
Shape52.Top := yyeri;
end;