I have added these commands in the declaration part and the void draw() function but nothing has changed
int noInvader;
int[] invaderHorde = new int[8];
for (int i = 0; i <= 7; i++) {
invaderHorde[i] = noInvader;
if (gap == width - x) {
invaderHorde = append(invaderHorde, invader);
}
}