You could shorten some things considerably:
PHP Code:
temp.color = int(random(0,7)+.5);
if (temp.color == 0){
temp.i.red = 1;
temp.i.green = 0;
temp.i.blue = 0;
}elseif(temp.color == 1){
temp.i.red = 0;
temp.i.green = 1;
temp.i.blue = 0;
}elseif(temp.color == 2){
temp.i.red = 0;
temp.i.green = 0;
temp.i.blue = 1;
}elseif(temp.color == 3){
temp.i.red = 1;
temp.i.green = 1;
temp.i.blue = 0;
}elseif(temp.color == 4){
temp.i.red = 1;
temp.i.green = 0;
temp.i.blue = 1;
}elseif(temp.color == 5){
temp.i.red = 0;
temp.i.green = 1;
temp.i.blue = 1;
}elseif(temp.color == 6){
temp.i.red = 1;
temp.i.green = 1;
temp.i.blue = 1;
}elseif(temp.color == 7){
temp.i.red = random(0,1);
temp.i.green = random(0,1);
temp.i.blue = random(0,1);
}
=
PHP Code:
temp.color = int(random(0,7)+.5);
if (temp.color < 7) {
// if they are in the array, they will = 1, if not 0, so it handles the troubles for you!
temp.i.red = temp.color in {0,3,4,6};
temp.i.green = temp.color in {1,3,5,6};
temp.i.blue = temp.color in {2,4,5,6};
} else {
temp.i.red = random(0,1);
temp.i.green = random(0,1);
temp.i.blue = random(0,1);
};
Or even:
PHP Code:
temp.color = int(random(0,7)+.5);
temp.i.red = temp.color == 7 ? random(0,1) : temp.color in {0,3,4,6};
temp.i.green = temp.color == 7 ? random(0,1) : temp.color in {1,3,5,6};
temp.i.blue = temp.color == 7 ? random(0,1) : temp.color in {2,4,5,6};
Also things like this, which isn't really that bad anyways but can cut some things down:
temp.i.red = temp.i.green = temp.i.blue = 1;
this.rockets = this.bursts = his.trails = new[0];