     #       2
     #       v
     constructor: (@gameManager, @gameVisual, characterLoadconfig) ->
-        # @config ?= { x: 4, y: 4, direction: 0, maxX:9, maxY:9, traps: [[2,4],[9,9]], targets: [[5,5]], targetCount : 0}
         @config = deepcopy @gameManager.config.game
         @score = 0
         @stars = 0
         @protagonist = {
             x: @config.startpos[0],
             y: @config.startpos[1],
-            dir: if @config.direction? then @config.direction else 0,
-            index: 0
+            dir: characterLoadconfig.protagonist.dir,
+            index: characterLoadconfig.protagonist.index
         }
         @target = {
             x: @config.targetpos[0]
             y: @config.targetpos[1]
         }
+        @otherCharacters = characterLoadconfig[2..]
         @gameVisual.charFace @protagonist.index, @protagonist.dir
-        return
+        @clockHandle = setInterval @clock(), 17
+        return
+
+    clock: =>
+        @tick = 0
+        return =>
+            @tick++
+            if @tick % 30 == 0
+                # Update Game State
+                placeholder = true
+            @gameVisual.coffederp @gameManager.config.visual
+            return
 
     gameWon: ->
         @gameManager.gameWon @score, @stars

    checkEvent: (playerX, playerY) ->
        log "Checking: X: #{playerX}, Y: #{playerY}"
        canMove = true
        if playerX < 1 or playerX > @gameManager.config.visual.gridX + 1\
          or playerY < (-1 * @gameManager.config.visual.gridY + 1) or playerY > 1
            # Player is out of bounds of grid.
            canMove = false
            log "Out of bounds!"


    reset: =>
        @codeEditor.resetEditor()
        @visual.startGame @config.visual
        @gameState = new MapGameState this, @visual, @config.visual.characters
        @commandMap = new MapGameCommands @gameState
        return

    runStudentCode: =>
        @interpreter.scanText @codeEditor.getStudentCode()
        @visual.startGame @config.visual
        @gameState = new MapGameState this, @visual, @config.visual.characters
        @commandMap = new MapGameCommands @gameState
        @interpreter.executeCommands @commandMap
        return

