/// <summary> /// Set the object that the camera should follow /// </summary> /// public void Follow(Player source, float rotationOffset) { Source = source; SourceRotationOffset = rotationOffset; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // Initialize the player class player = new Player(); input = new Input(); mainbg = new ParallaxingBackground(); bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); levelRenderer = new LevelLibrary.LevelRenderer(); // Camera that follows the player camera = new Camera(GraphicsDevice.Viewport, Vector2.Zero); camera.Follow(player, 0f); hud = new HUDisplay(); base.Initialize(); }