我试图让 TCanvas 向上移动一点,然后再向下移动。但是使用当前代码,它执行得如此之快,以至于您看不到它。希望有人能给我正确的方法来做到这一点..
{this will give the attack amimation}
procedure TGameData.AnimateAttack(slot: Integer);
begin
if slot = 1 then
begin
fgame.slot1.Top := fgame.slot1.Top - 9;
fgame.slot1.Repaint;
fgame.slot1.Top := fgame.slot1.Top + 9;
fgame.slot1.Repaint;
end;
if slot = 2 then
begin
fgame.slot2.Top := fgame.slot2.Top - 9;
fgame.slot2.Repaint;
fgame.slot2.Top := fgame.slot2.Top + 9;
fgame.slot2.Repaint;
end;
if slot = 3 then
begin
fgame.slot3.Top := fgame.slot3.Top - 9;
fgame.slot3.Repaint;
fgame.slot3.Top := fgame.slot3.Top + 9;
fgame.slot3.Repaint;
end;
if slot = 4 then
begin
fgame.slot4.Top := fgame.slot4.Top - 9;
fgame.slot4.Repaint;
fgame.slot4.Top := fgame.slot4.Top + 9;
fgame.slot4.Repaint;
end;
if slot = 5 then
begin
fgame.slot5.Top := fgame.slot5.Top - 9;
fgame.slot5.Repaint;
fgame.slot5.Top := fgame.slot5.Top + 9;
fgame.slot5.Repaint;
end;
if slot = 6 then
begin
fgame.slot6.Top := fgame.slot6.Top - 9;
fgame.slot6.Repaint;
fgame.slot6.Top := fgame.slot6.Top + 9;
fgame.slot6.Repaint;
end;
end;