Almost there, guys.
I only have some 1 problem left with void keyPressed() function:
void keyPressed() {
if (key == 'f') {
weapon = (weapon + 1) % 10;
}
if (key == 'j') {
if (weapon == invaders[0]){
remove_invader (weapon);
add_invader(int(random(10)));
score = score + 5;
} else {
boundary = boundary + 115;
}
}
}
The problem is that I don’t know how to obliterate any matching invaders to the right but only the left-most one.