// Update is called once per frame
 void Update()
 {
     if (typing.GetBattleState() != InputManager.BattleState.Started && typing.GetBattleState() != InputManager.BattleState.Gameovered &&
         typing.GetSignState() != InputManager.SignState.Started && !typing.levelFinished())
     {
         if (Input.GetButtonDown("Right"))
         {
             ++dir;
             if (dir > Direction.West)
             {
                 dir = Direction.North;
             }
             compass.text = directionText[(int)dir];
             CheckEncounters();
             MovementStuff();
             DisplayWalls();
         }
         if (Input.GetButtonDown("Left"))
         {
             --dir;
             if (dir < Direction.North)
             {
                 dir = Direction.West;
             }
             compass.text = directionText[(int)dir];
             CheckEncounters();
             MovementStuff();
             DisplayWalls();
         }
         if (Input.GetButtonDown("Forward"))
         {
             int[] forwardXMovements = new int[] { 0, 1, 0, -1 };
             int[] forwardYMovements = new int[] { -1, 0, 1, 0 };
             int   potentialCameraX  = forwardXMovements[(int)dir];
             int   potentialCameraY  = forwardYMovements[(int)dir];
             if (isBlockAtPointRelative(potentialCameraX, potentialCameraY) != BlockType.Block)
             {
                 if (isBlockAtPointRelative(potentialCameraX, potentialCameraY) == BlockType.Door)
                 {
                     gameinfo.door();
                 }
                 else
                 {
                     gameinfo.move();
                 }
                 cameraX += potentialCameraX;
                 cameraY += potentialCameraY;
                 UpdateMinimap();
                 MovementStuff();
             }
             else if (isBlockAtPointRelative(potentialCameraX, potentialCameraY) == BlockType.Block)
             {
                 gameinfo.mistake();
             }
             CheckEncounters();
             DisplayWalls();
         }
         if (Input.GetButtonDown("Backward"))
         {
             int[] forwardXMovements = new int[] { 0, -1, 0, 1 };
             int[] forwardYMovements = new int[] { 1, 0, -1, 0 };
             int   potentialCameraX  = forwardXMovements[(int)dir];
             int   potentialCameraY  = forwardYMovements[(int)dir];
             if (isBlockAtPointRelative(potentialCameraX, potentialCameraY) != BlockType.Block)
             {
                 if (isBlockAtPointRelative(potentialCameraX, potentialCameraY) == BlockType.Door)
                 {
                     gameinfo.door();
                 }
                 else
                 {
                     gameinfo.move();
                 }
                 cameraX += potentialCameraX;
                 cameraY += potentialCameraY;
                 UpdateMinimap();
                 MovementStuff();
             }
             else if (isBlockAtPointRelative(potentialCameraX, potentialCameraY) == BlockType.Block)
             {
                 gameinfo.mistake();
             }
             CheckEncounters();
             DisplayWalls();
         }
     }
     if (Input.GetButtonDown("Space") && gameinfo.isEnding(cameraY, cameraX))
     {
         gameinfo.AdvanceFloor();
         LoadMap(true);
         typing.AdvanceCalc();
     }
 }