SRL Archive - Reflection Help

from A to B and back


sjlou

2008-08-15 04:01:14

what do you need to do if you want to walk from A to B and then walk back from B to A with the same loadpath function ?

MasterKill

2008-08-15 04:42:53

lets say you have a path of 0 to 9 coords.

for the walking to the B, you start walking from 1 to 9 with a for to do loop

For I := 1 To 9 Do
Begin
WalkToPoint(I);
End;

after that for the walking back you can a For DownTo Do loop, just like this:

For I := 8 DownTo 0 Do
Begin
WalkToPoint(I);
End;

you'll have to make WalkToPoint() yourself but I'm just giving you the global idee.

Good luck scripting

sjlou

2008-08-15 05:00:27

TnQ just what i needed to know :D

Bobarkinator

2008-08-15 08:09:58

I usually make a function that has a for statement in it, and after it has walked the path, I invert the tpa so I can just call the same function again for walking back.

Nava2

2008-08-19 11:32:17

function WalkPath(TPA: TPointArray; Reverse: Boolean): Boolean;

var
I, H : integer;

begin
if Reverse then InvertTPA(TPA);
H := High(TPA);
for I := 0 to H do
WalkToTile(TPA[i], 0, 0);
end;

Thats what bob was talking about, works the same as downto but a lot cleaner.