Jetzt hab ich mal Einheit.Gehen verschönert:
Delphi-Quellcode:
procedure TEinheit.Gehen(P: TPoint);
begin
Aim := P;
AnimLoop := true;
if (p.x > X) and (p.Y > Y) then // Südost
begin
AnimActive := true;
AnimStart := 40;
AnimStop := 47;
AnimSpeed := 10;
XSpeed := 100;
YSpeed := 100;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x > X) and (p.Y < Y) then // Nordost
begin
AnimActive := true;
AnimStart := 16;
AnimStop := 23;
AnimSpeed := 15;
XSpeed := 100;
YSpeed := -100;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x > X) and (p.Y = Y) then // Ost
begin
AnimActive := true;
AnimStart := 0;
AnimStop := 7;
AnimSpeed := 15;
XSpeed := 100;
YSpeed := 0;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x < X) and (p.Y > Y) then // Südwest
begin
AnimActive := true;
AnimStart := 48;
AnimStop := 55;
AnimSpeed := 15;
XSpeed := -100;
YSpeed := 100;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x < X) and (p.Y < Y) then // Nordwest
begin
AnimActive := true;
AnimStart := 24;
AnimStop := 31;
AnimSpeed := 15;
XSpeed := -100;
YSpeed := -100;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x < X) and (p.Y = Y) then // West
begin
AnimActive := true;
AnimStart := 56;
AnimStop := 63;
AnimSpeed := 15;
XSpeed := -100;
YSpeed := 0;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x = X) and (p.Y > Y) then // Süd
begin
AnimActive := true;
AnimStart := 32;
AnimStop := 39;
AnimSpeed := 15;
XSpeed := 0;
YSpeed := 100;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x = X) and (p.Y < Y) then // Nord
begin
AnimActive := true;
AnimStart := 8;
AnimStop := 15;
AnimSpeed := 15;
XSpeed := 0;
YSpeed := -100;
DoMove(Form1.AdPerCounter.TimeGap);
end
else
if (p.x = X) and (p.Y = Y) then
begin
AnimActive := false;
end;
end;
Naja, ich klicke die Einheit an(linke Maustaste) dann klick ich irgendwo anders hin(rechte maustaste).
er beginnt zu 'gehen'
naja, zuerst springt er etwa 5 Zentimeter dann geht er zwar, aber er dreht sich im kreis....
Also der Sprite bewegt sich richtig, die Bilder sind aber falsch, obwohl die AnimStart und AnimStops 100%ig richtig sind... weiß jemand was ich falsch mache?