Why do
PHP Code:
function onWeaponfired() {
if (player.dir==0) shoot(blahblah crap for direction 0);
if (player.dir==1) shoot(blahblah crap for direction 1);
if (player.dir==2) shoot(blahblah crap for direction 2);
if (player.dir==3) shoot(blahblah crap for direction 3);
}
when you can do
PHP Code:
function onWeaponfired() {
shoot(formulate the angle depending on the direction);
}
?
Sure, the first way works, but it's silly to not try to improve your scripting by finding shorter alternatives. Like I said, it's better
practice. There may not be any hard evidence as to why, in terms of efficiency, but you can learn a lot of things by trying to think outside the box and find ways to shorten your code.