     @player.body.fixedRotation = true
     @player.body.setZeroDamping()
 
-    @printed = false
 
   update: ->
      @player.body.setZeroVelocity()
 
-     @xdistance = Math.abs(@player.x - @star.x)
-     @ydistance = Math.abs(@player.y - @star.y)
+     for star, i in @constellation
+     	 @xdistance = Math.abs(@player.x - star.x)
+     	 @ydistance = Math.abs(@player.y - star.y)
 
-     if @xdistance < 10 && @ydistance < 10 
-        if not @printed
-     	   @star.destroy()
-     	   @star = @add.sprite @starx, @stary, 'litstar'
-     	   @printed = true
-     else 
-        if @printed
-     	   @star.destroy()
-     	   @star = @add.sprite @starx, @stary, 'unlitstar'
-     	   @printed = false
+     	 if @xdistance < 10 && @ydistance < 10 
+     	    if not @printed[i]
+     	       star.destroy()
+     	       star = @add.sprite star.x, star.y, 'litstar'
+     	       @printed[i] = true
+     	 else 
+     	    if @printed[i]
+     	       star.destroy()
+     	       star = @add.sprite star.x, star.y, 'unlitstar'
+     	       @printed[i] = false
 
      if @cursors.left.isDown
         @player.body.moveLeft(200)



  drawConstellation: (level) ->
    level.name
    for star in level.starsArray
        @add.sprite star.x, star.y, 'litstar'



module.exports = Game

class Game

  @player = null 

  create: ->
    #setup game window
    x = @game.width / 3
    y = @game.height / 2   

    #add Sprites
    @game.add.sprite 0, 0, 'Plough'
    #@star = @add.sprite @starx, @stary, 'unlitstar'
    @player = @add.sprite x, y, 'player'
    @constellation = []
    @printed = []

    #Plot empty stars
    @drawConstellation(LEVELS[2])

    #add sounds
    #@soundSputnik = @game.add.audio 'soundSputnik'


    #setup game input/output
