Hi Delfi,
in the sample there is nothing done with the callback.
Could you please give a short sample how to change the callback?
And any idea why the findpath is a bit slow with a 2dim level of 0..280,0..280?
Right now my blocktester looks like this:
Code:
function TForm1.blocktester(X, Y, Fx, Fy: integer): integer;
begin
result:= -1; // if it isnt anything else - it is wall
if (level[x,y]=255) then result:=round(((ABS(FX-X) + ABS(FY - Y)) * 3))
else if (level[x,y]=0) or (level[x,y]=51) then result:= ((ABS(FX-X) + ABS(FY - Y)) * 3)*16;
end;
255 is a road (walk faster), 0 is empty and 51 is grass, also walkable.
My findpath looks like this:
Code:
Astar.findpath(StartPoint, EndPoint, point(levelb-1,levelh-1),true,true, @blocktester);
Levelb and Levelh contain my level width/height (280)
Is this correct?
Thanks a lot,
Firle
Bookmarks