P4N,Quote:
I'm bored so here's some code ideas
C.Recording = true;
C.Path = new List<Coord>();
C.PathIndex = 0;
C.Path.Add(new MakeCoord(C.X, C.Y));
Then in receiving jump packet do
if (C.Recording == true)
C.Path.Add(new MakeCoord(C.X, C.Y));
In your path finding code do something like...
if(Distance to C.Path[C.PathIndex] < 7)
//path found, move to next one
if(C.PathIndex + 1< C.Path.Count)
C.PathIndex++;
else
{
C.Path = C.Path.Reverse();
C.PathIndex = 1;
}
Coord To = Calculations.PullClosest(MakeCoord(C.X, C.Y), C.Path[C.PathIndex]);
Jump or shift to the pulled coord
or something like that...
That's the ABSOLUTE simplest way to code it. Keep in mind pull closest will be a method pulling all possible coords near you that are valid and then checking their distance vs target and returning the closest one. Assuming no large obstacles it will return the most efficient coord to move to each time.
TEACHING MOMENT:
Keep in mind when working with enumerated elements in a list or an array, the .count will ALWAYS be greater then your current index value as they start at 0, not 1!
Pulling element 1 means you are actually pulling the second element in a list/array.
List<int> A = new List<int>{5, 4, 3, 2, 1, 0};
Console.WriteLine(A[0]);
This will produce the output '5'
Alternatively doing A[1] would be '4' and so on.
I was busy with my real work. So I didn't really catch up with this thread. You are too good to be nice to noobie hackers :) Anyway, can you pm me with IM address? I want to pay you back with answer to map issues. It was little time consuming but I think I got right.