1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51:
| procedure TSokubahn.MoveKiste(NewX, NewY,OldX,OldY,DirX, dirY:Integer); var oldTex,OldTyp,kx,ky:Integer; begin if (Map[NewX, NewY].Typ <> Wand) and (Map[NewX, NewY].Typ <> Kasten) then begin oldTyp:=Map[OldX, OldY].Typ; oldTex:=Map[OldX, OldY].Tex;
kx:=NewX+DirX; ky:=NewY+DirY;
ax:=Kx; ay:=Ky; if Map[kx, ky].Typ = Ziel then begin oldTyp2:=Map[kx,ky].Typ; oldTex2:=Map[Kx,ky].Tex; end;
Map[OldX, OldY].Typ:=None; Map[OldX, OldY].Tex:=None;
Map[NewX, NewY].Typ:=oldTyp; Map[NewX, NewY].Tex:=oldTex;
if (oldTyp2 = Ziel) and (GoMovekiste = True) then begin ShowMessage(IntToStr(ax) + '\' + IntToStr(ay)); GoMovekiste:=False; Map[ax, ay].Typ:=oldTyp2; Map[ax, ay].Tex:=oldTex2; oldTyp2:=-1; end; end; end;
procedure TSokubahn.SetPlayerPos(NewX, NewY:integer); begin if ( Map[Player.X+NewX,Player.Y+NewY].Typ <> Wand ) and ( Map[Player.X+NewX,Player.Y+NewY].Typ <> Kasten ) then begin Player.X:=Player.X+NewX; Player.Y:=Player.Y+NewY; end else begin if (Map[Player.X+NewX,Player.Y+NewY].Typ = Kasten) and (Map[Player.X+NewX+NewX,Player.Y+NewY+NewY].Typ <> Wand)then begin Player.X:=Player.X+NewX; Player.Y:=Player.Y+NewY; MoveKiste(Player.X+NewX,Player.Y+NewY,Player.X,Player.Y,NewX, NewY); GoMovekiste:=True;
end; end;
end; |