unit uHero;

{$mode delphi}

interface

uses
  uLiveObj;
type

  { THero }

  THero = class(TLiveObj)
    procedure AI; override;
    procedure Draw; override;
    function OnPortal : Boolean;
  end;

implementation
uses
  zglHeader, uGlobal;
{ THero }

procedure THero.AI;
begin
  if WayN < Length(Way) - 1 then
  begin
    WayN := WayN + 1;
    if Map.FreeWay(Way[WayN].X, Way[WayN].Y, true) then
      TileGo(Way[WayN].X, Way[WayN].Y)
    else
      SetLength(Way, 0);
  end;
end;

procedure THero.Draw;
begin

  Asprite2d_Draw(cube, Map.camX + pX - 64 + 35, Map.camY + pY - 128, 128, 128, 0, 1);
end;

function THero.OnPortal: Boolean;
begin
  result := not Move and (Map.TileA[tX][tY].Sprite = cPortal);
end;



end.

