public virtual void Update(GameTime gameTime) { CurrentLevel.Update(gameTime); if (CurrentLevel.GameOver) { GameEnvironment.GameStateManager.SwitchTo("gameOverState"); } else if (CurrentLevel.Completed) { CurrentLevel.Solved = true; GameEnvironment.GameStateManager.SwitchTo("levelFinishedState"); } //GameEnvironment.Camera.Position = player.GlobalPosition - GameEnvironment.Screen.ToVector2() / 2; GameObject player = CurrentLevel.Find("player"); //Camera positie en mee beweging if (player != null) { GameEnvironment.Camera.Position = new Vector2(MathHelper.Clamp(player.GlobalPosition.X - GameEnvironment.Screen.X / 2, 0, CurrentLevel.LevelSize.X - GameEnvironment.Screen.X), MathHelper.Clamp(player.GlobalPosition.Y - GameEnvironment.Screen.Y / 2, 0, CurrentLevel.LevelSize.Y - GameEnvironment.Screen.Y)); } else { GameEnvironment.Camera.Position = Vector2.Zero; } }