Ciao a tutti , sono un nuovo utente.
Vorrei sapere che problema ha il seguente ciclo di for che ho fatto per muovere la mia matrice di elementi. Infatti quando l'ultimo elemento a sinistra si scontra con il bordo sinistro del campo , questo comincia a distanziarsi sempre di più dagli altri elementi della matrice.
questo è il ciclo che ho fatto:

for(var i = 0; i < ENEMY_ROW; i++){

for(var j = 0; j < this.area.enemy[i].length; j++){

this.area.enemy[i][j].posX += this.area.enemy[i][j].speed;

var outOfArea = (this.area.enemy[i][j].posX > this.area.width - this.area.enemy[i] [j].htmlElement.offsetWidth)|| (this.area.enemy[i][j].posX < 0);

if(outOfArea){

for(var h = 0; h < ENEMY_ROW; h++){

for(var k = 0; k < this.area.enemy[h].length; k++){

this.area.enemy[h][k].speed = - this.area.enemy[h][k].speed;
this.area.enemy[h][k].posY += 10;
}
}
}
}
}

e questa è la matrice in questione :
spacenvaders.altervista.com

Grazie mille in anticipo dell'aiuto!