 class Game
 
   @player = null 
-  @successTxt = null
 
   create: ->
     #setup game window
     x = @game.width / 3
     y = @game.height / 2   
-    @starx = @game.width / 2
-    @stary = @game.height / 2
 
     #add Sprites
     @game.add.sprite 0, 0, 'Plough'
-    @star = @add.sprite @starx, @stary, 'unlitstar'
+    #@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'
+    #@soundSputnik = @game.add.audio 'soundSputnik'
 
 
     #setup game input/output



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



module.exports = Game

    @player.body.fixedRotation = true
    @player.body.setZeroDamping()


  update: ->
     @player.body.setZeroVelocity()

     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[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)
