Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#1

[Andorra 2D 0.2 ALPHA] Animationen

  Alt 5. Mai 2007, 16:31
Hi,

Die Figurdatei (bmp) besteht aus 4*3 Animationsphasen, wobei

Delphi-Quellcode:
PatternWidth := 18;
PatternHeight := 28;
Delphi-Quellcode:
const
  ANIM_UP = 0;
  ANIM_DOWN = 6;
  ANIM_LEFT = 9;
  ANIM_RIGHT = 3;


procedure TPlayer.DoMove(TimeGap: double);
begin
  inherited DoMove(TimeGap);
  if GetAsyncKeyState(VK_UP) < 0 then
  begin
    AnimStart := ANIM_UP;
    AnimStop := AnimStart + 2;
    y := y - 1;
  end
  else
  if GetAsyncKeyState(VK_DOWN) < 0 then
  begin
    AnimStart := ANIM_DOWN;
    AnimStop := AnimStart + 2;
    y := y + 1;
  end
  else
  if GetAsyncKeyState(VK_RIGHT) < 0 then
  begin
    AnimStart := ANIM_RIGHT;
    AnimStop := AnimStart + 2;
    x := x + 1;
  end
  else
  if GetAsyncKeyState(VK_LEFT) < 0 then
  begin
    AnimStart := ANIM_LEFT;
    AnimStop := AnimStart + 2;
    x := x - 1;
  end;
end;
In der Praxis gibt es das Problem das wenn ich grad nach oben am gehn war und dann nach unten drücke dann geht die Animation nicht direkt bei ANIM_DOWN los sondern da kommt erst das erste Bild von ANIM_RIGHT... dh das ganze sieht so aus:

^
|

->

|
v

statt

^
|

|
v

... Versteht ihr was das Problem ist? Bei DelphiX besteht dieses Problem irgendwie nicht.. Is das ein Fehler der Engine oder mache ich was falsch?

Im Anhang ist die exe...

Gruß
Neutral General
Angehängte Dateien
Dateityp: rar projekt_212.rar (227,5 KB, 15x aufgerufen)
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat