Having trouble resetting a group in the canvas
<p>Ive been working on my side scrolling game that generates random aliens on the canvas. The game has basic arcade physics and shooting, Im now working on the restart function for my game and I have gotten so far as reseting the lives, score and player on the canvas. But I'm having trouble reseting the group of aliens. my code for the aliens is the create function, but when I call the create aliens  function in the restart function it is out of scope. I was following this <a href="https://phaser.io/examples/v2/games/invaders" rel="nofollow noreferrer">link</a> as an example but it isnt working either.</p>

<p>Is there a better way to restart the group in phaser??</p>

<p>here is my code for the group:</p>

<pre><code>//Creates a group of 35 aliens.
function createAliens(){
     aliens = game.add.group();
     aliens.enableBody = true;
     aliens.createMultiple(35, 'aliens', 0, false);



     game.time.events.repeat(Phaser.Timer.SECOND, 20, resurrect, this);

//ressurects the alien from the group and adds it to the group, and gives it movement &amp; physics.
function resurrect() {
       var ufos = aliens.getFirstDead();

       if(ufos){
         ufos.reset(game.world.randomX, game.world.randomY);

         ufos.body.velocity.setTo(10 + Math.random() * 40, 10 + Math.random() * 40);

         ufos.body.bounce.setTo(0.5, 0.5);
         ufos.body.collideWorldBounds = true;
         ufos.frame = game.rnd.integerInRange(0,36);
       }
     }
}
</code></pre>

<p>And here is my restart function: </p>

<pre><code>function restart(){

  lives.callAll('revive');

  aliens.removeAll();
  player.revive();
  console.log(createAliens());

  deadTxt.visible = false;
  score = 0;



}
</code></pre>

<p>and my <a href="https://github.com/Jcook894/Side_Scroller_game" rel="nofollow noreferrer">github repo</a> if you'd like too play :)</p>