Im pretty sure everyone have seen the walk code in LOTF. Well I rewrote one because I was really really bored, so I decided to do this shit. Its probably the best walk code released so far and yeah, enjoy. Small release as I said, should work in any source with a small adjustment.
Edit : Removed the old one because it wasnt working as I thought ( didnt tested )
Heres one that works almost perfect:
Edit : Removed the old one because it wasnt working as I thought ( didnt tested )
Heres one that works almost perfect:
Quote:
public void Walk(byte Dir)
{
sbyte x = 0, y = 0;
if (Dir == 0 || Dir == 1 || Dir == 5 || Dir == 7)
x = 1;
if (Dir >= 1 && Dir <= 3)
x = -1;
if (Dir == 1 || Dir == 6 || Dir == 7)
y = 1;
if (Dir >= 3 && Dir <= 5)
y = -1;
X = (ushort)(X + x); Y = (ushort)(Y + y);
}