define('isr/player', ['jquery', 'isr', 'isr/config', 'isr/entity'], function($, Game, Config, Entity) {
   console.log('Entity')
   console.log(Entity)
   var $activeScene;
   var $activeCharacter;
   
   // current player position
   var playerMovState = {
      'x' : 0,
      'y' : 2,
      'facing' : 'up',
      // var to indicate if character is currently moving
      'moving' : false
   };
   var lives = 3;
   var startTime = 0;
   
   
   Game.director.on('scene:change', function(sceneName) {
      console.log('switched scene to ' +sceneName);
      $activeScene = $('#' + sceneName);
      $activeCharacter = $activeScene.find('#character');
   });
   
   $('body').keyup(function(e) {
      console.log('Player movement listener reporting to duty');
      var charPos = $activeCharacter.offset();
      // W || Arrow up
      var up = ~~((e.keyCode === 87) || (e.keyCode === 38));
      // S || Arrow down
      var down = ~~((e.keyCode === 83) || (e.keyCode === 40));
      // A || Arrow left
      var left = ~~((e.keyCode === 65) || (e.keyCode === 37));
      // D || Arrow right
      var right = ~~((e.keyCode === 68) || (e.keyCode === 39));
      // space for interaction
      var space = ~~(e.keyCode === 32);
      var direction;

      if (up) {
         direction = 'up';
      } else if (down) {
         direction = 'down';
      } else if (left) {
         direction = 'left';
      } else if (right) {
         direction = 'right';
      }

      /*var newPos = {
         left : charPos.left,
         top : charPos.top
      };*/
      
      // move player
      if (!playerMovState.moving && direction) {
        Entity.move({
           'elemMovState' : playerMovState,
           '$scene' : $activeScene,
           '$element' : $activeCharacter,
           'direction' : direction
        });
      }
      
      if (space) {
         doAction();
      }
      e.stopPropagation();
      e.preventDefault();
      e.stopImmediatePropagation();
      return false;
   });
   
   /**
    * Function to do stuff like fight or talk
    */
   var doAction = function() {
      // first check direction
      var targetTile = {
         x : playerMovState.x,
         y : playerMovState.y
      };
      switch(playerMovState.facing) {
         case 'up':
            targetTile.y += 1;
         break;
         case 'down':
            targetTile.y -= 1;
         break;
         case 'left':
            targetTile.x -= 1;
         break;
         case 'right':
            targetTile.y += 1;
         break;
      }
      // check if on there is sth on the tile the player is facing to interact with
      var interactableStuff = $activeScene.find('#x' + targetTile.x + '-y' + targetTile.y + ' .interactable');
      interactableStuff.each(function(index) {
         if ($(this).hasClass('attackable')) {
            // TODO do fancy animation
         } else if ($(this).hasClass('talkable')) {
            alert('Your are talking to someone');
         }
      });
      if (interactableStuff.length === 0) {
         //TODO add fancy sword swing into empty air
         alert('You successfully killed empty air');
      }
   };
   
   var decreaseLives = function() {
      lives--;
      if (lives === 0) {
         alert('Game over');
         location.reload();
      }
   };
   
   return {
      'playerMovState' : playerMovState,
      'decreaseLives' : decreaseLives
   };
}); 
@@ -104,102 +104,296 @@
 %0A   
-console.log('Entity')%0A   console.log(Entity)%0A   var $activeScene;%0A   var $activeCharacter;%0A   
+var $activeScene;%0A   var $activeCharacter;%0A   var scenePlayer = %7B%0A      'church' : %7B'x': 8, 'y' : 9%7D,%0A      'family' : %7B'x': 8, 'y' : 9%7D,%0A      'temple-1' : %7B'x': 8, 'y' : 9%7D,%0A      'temple-2' : %7B'x': 8, 'y' : 9%7D,%0A      'war-1' : %7B'x': 0, 'y' : 3%7D,%0A      'war-2' : %7B'x': 0, 'y' : 3%7D%0A   %7D;
 %0A   
@@ -687,24 +687,232 @@
 ceneName) %7B%0A
+      // save current player pos to scenePlayer%0A      if ($activeScene) %7B%0A         scenePlayer%5B$activeScene%5B0%5D.id%5D.x = playerMovState.x;%0A         scenePlayer%5B$activeScene%5B0%5D.id%5D.y = playerMovState.y;%0A      %7D%0A
       consol
@@ -984,32 +984,39 @@
 ' + sceneName);%0A
+      %0A
       $activeCha
@@ -1047,19 +1047,329 @@
 nd('
-#character'
+.character');%0A      // get last player pos of player of this scene%0A      playerMovState.x = scenePlayer%5BsceneName%5D.x;%0A      playerMovState.y = scenePlayer%5BsceneName%5D.y;%0A      $activeCharacter.offset(%7B%0A         'left' : playerMovState.x * Config.tiles.width,%0A         'top' : playerMovState.y * Config.tiles.height%0A      %7D
 );%0A 
@@ -2524,24 +2524,306 @@
  : direction
+,%0A           'callback' : function() %7B%0A              // trigger global playerMoved and scene specific playerMoved events%0A              Game.director.currentScene.trigger('playerMoved', playerMovState);%0A              Game.director.trigger('playerMoved', playerMovState);%0A           %7D
 %0A        %7D);

set player start coordinates per scene + save coords per scene