 class StageScene extends Scene
   constructor: (@game) ->
     super(@game)
+    @max_stage = @game.get_config('stages')
     @init_stage_nodes()
-    window.ss = this
 
   start: () ->
     super()

    $(document).unbind "keydown"

  adjust_stage: (offset) ->
    @current_stage += offset
    @game.set_config('current_stage', @current_stage)
    @update_stage_label()

  init_stage_nodes: () ->
    # bg
    # @layer.add(new Kinetic.Rect({
    #   x: 0,
    #   y: 0,
    #   fill: "#999",
    #   width: 600,
    #   height: 520
    # }))
    # label text
    @stage_label = new Kinetic.Text({
      x: 210,
      y: 230,
      fontSize: 22,
      fontStyle: "bold",
      fontFamily: "Courier",
      text: "STAGE #{@current_stage}",
      fill: "#fff"
    })
    @layer.add(@stage_label)


  get_config: (key) -> @configs[key]
  init_default_config: () ->
    @configs = {
      fps: 60, players: 1, current_stage: 1, stages: 5,
      hi_score: 20000, p1_score: 0, p2_score: 0,
      last_score: 0, player_initial_life: 2, enemies_per_stage: 20,
    }
