I am haveing trouble with the reset command

function spawnEnemy(){

if (game.time.now > enemyTime){
    enemyTime = game.time.now + 3000;
    nombre = Math.floor(Math.random()*3);
    hauteurEnemie = (500 - (nombre + 3)*50);
    hauteurEnemie = Math.floor(Math.random()*hauteurEnemie);
    enemy = enemies.getFirstExists(false)
    if (enemy){
        for (var h = 0; h < nombre + 3; h++)
        {
            enemy.reset(801, hauteurEnemie + h*50);
           
            enemy.body.velocity.x = -75;
        }
    }
}

}

I don’t understand why the function only spawns one ship at a time

That’s resetting the same sprite several times.

Probably you want to move enemy = enemies.getFirstExists(false) etc. into the loop.

Thank you!