Thread: Plane
View Single Post
  #32  
Old 10-14-2005, 11:08 PM
Knuckles Knuckles is offline
Registered User
Join Date: Sep 2002
Location: New York
Posts: 580
Knuckles is on a distinguished road
Send a message via AIM to Knuckles
NPC Code:

for (i = 0; i < 4; i ++) {
if(keydown(i)) {
this.x += vecx(i);
this.y += vecy(i);
break;
}
}



instead of 900 lines of key detection...you can do the same for playerdir detection.
learn vectorx, vectory. think of it as an array.

vecx = {0,1,0,1}
vecy = {1,0,1,0}

so vecx(0) would = 0;
vecx(1) would = 1;
vecx(2) would = 0;
vecx(3) would = 1;
__________________
Knuckles
"They say 60% of the time, it works everytime!"

Last edited by Knuckles; 10-14-2005 at 11:45 PM..
Reply With Quote