procedure TForm1.Timer3Timer(Sender: TObject);
var gfeld : TPoint;
begin
case geist1[3] of
1:
begin
gfeld.X:=round((geist1[1]-10+15)/30)-1; //[1]=x koordinate ;
gfeld.Y:=round((geist1[2]+15)/30)-1; //[2]=y koordinate
if (welt[gfeld.X,gfeld.Y]<>'1') and (welt[gfeld.X,gfeld.Y]<>'4') then
dec(geist1[1]);
if (gfeld.X=1) and (gfeld.Y=9) then inc(geist1[1],16*30);
end;
2:
begin
gfeld.X:=round((geist1[1]+15)/30)-1;
gfeld.Y:=round((geist1[2]-10+15)/30)-1;
if (welt[gfeld.X,gfeld.Y]<>'1') and (welt[gfeld.X,gfeld.Y]<>'4') then
dec(geist1[2]);
end;
3:
begin
gfeld.X:=round((geist1[1]+10+15)/30)-1;
gfeld.Y:=round((geist1[2]+15)/30)-1;
if (welt[gfeld.X,gfeld.Y]<>'1') and (welt[gfeld.X,gfeld.Y]<>'4') then
inc(geist1[1]);
if (gfeld.X=19) and (gfeld.Y=9) then
dec(geist1[1],16*30);
end;
4:
begin
gfeld.X:=round((geist1[1]+15)/30)-1;
gfeld.Y:=round((geist1[2]+10+15)/30)-1;
if (welt[gfeld.X,gfeld.Y]<>'1') and (welt[gfeld.X,gfeld.Y]<>'4') then
inc(geist1[2]);
end;
end;
gfeld.X:=round((geist1[1]+15)/30)-1; // Orientierung
gfeld.Y:=round((geist1[2]+15)/30)-1;
geist1[3]:=random(4);