Thread: Plane
View Single Post
  #33  
Old 10-14-2005, 11:44 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Knuckles
NPC Code:

for (i = 0; i < 4; i ++) {
if(keydown(i)) {
this.x += vecx(this.x);
this.y += vecy(this.y);
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;
I think you mean vecx(i) and vecy(i), not vecx(this.x), vecy(this.y).
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote