Shady?
2008-09-14 01:40:04
Well, i just made this, it checks if we are inside a certain box of tiles, where the first X and Y are the top left ones, and the second are the down right corner.
Example:
function InBox(Tilex1, Tiley1, Tilex2, Tiley2: integer): Boolean;
var
Path, pat: TPointArray;
MyX, MyY, X, Y: Integer;
i, p: integer;
begin
i := 0;
p := 1;
if not LoggedIn then exit;
SetLength(Path, 1);
SetLength(Pat, 1);
Path[i] := GetMyPos;
if Path[i].X >= Tilex1 then
begin
if Path[i].Y <= Tiley1 then
begin
if Path[i].X <= Tilex2 then
begin
if Path[i].Y >= Tiley2 then
begin
Result := true;
end;
end;
end;
end;
end;Example:
if (Inbox(3208, 9622, 3219, 9615)) then
begin
Writeln('We are inside the box!');
end;