I didn't really understand it at first either.. And it's kinda hard to explain.. Let's see...
*Steals Tarankusu's list*
NPC Code:
dir vecx vecy
0 0 -1
1 -1 0
2 0 1
3 1 0
*explains list ferther*
vecx(playerdir) // the best usage for it.
vecx={0,-1,0,1} // like if playerdir {0,1,2,3}
vecy={-1,0,1,0} // like if playerdir {0,1,2,3}
if playerdir = 0, the VECY would = -1
if playerdir = 1, the VECX would = -1
if playerdir = 2, the VECY would = 1
if playerdir = 3, the VECX would = 1
playery=playery+vecy(playerdir)
if he was faceing up, the playerdir would = 0, so it would add -1 to his playery, AKA playery-=1 //in other words.. move him up
playerx=playerx+vecx(playerdir)
if he was facing left, the playerdir would = 1, so it would add -1 to his playerx, AKA playerx-=1 //in other words.. move him left
and so on and so forth... >;/ get it?