blank01
12-26-2010, 02:17 PM
Maybe it's just too early for me but I can't think of a way to simplify the following:
if(goLeft) {
this.x -= speed;
} else {
this.x += speed;
}
So far the best I can think of is:
this.x += (2*speed)*(int(goLeft)-.5)
It saves a few lines sure but I'm not sure if it will take less/more computer effort.
if(goLeft) {
this.x -= speed;
} else {
this.x += speed;
}
So far the best I can think of is:
this.x += (2*speed)*(int(goLeft)-.5)
It saves a few lines sure but I'm not sure if it will take less/more computer effort.