Ok habs gerade hingekriegt mit Form.Active
Aber hier mal der Code:
Delphi-Quellcode:
procedure TGame.Timer2Timer(Sender: TObject);
begin
if Game.Active=true then
begin
If GetAsyncKeyState(Ord('W')) < 0 Then Begin
if Image11.Top>1 then
begin
Stepup;
end;
End;
If GetAsyncKeyState(Ord('A')) < 0 Then Begin
if Image11.left>1 then
begin
Stepleft;
end;
End;
If GetAsyncKeyState(Ord('S')) < 0 Then Begin
if Image11.top<350 then
begin
Stepdown;
end;
End;
If GetAsyncKeyState(Ord('D')) < 0 Then Begin
if Image11.left<350 then
begin
Stepright;
end;
End;
end;
end;
Und hier noch eine der funktionen zum laufen:
Delphi-Quellcode:
procedure TGame.Stepup();
begin
if Bewegung=false then
begin
Bewegung:=true;
Image11.Picture:=Image4.Picture;
Image11.Top:=Image11.Top-10;
delay(100);
Image11.Picture:=Image4.Picture;
Image11.Top:=Image11.Top-10;
delay(100);
Image11.Picture:=Image8.Picture;
Image11.Top:=Image11.Top-10;
delay(100);
Image11.Picture:=Image4.Picture;
Image11.Top:=Image11.Top-10;
Bewegung:=false;
end;
end;