// The Ship parameter should be changed to a general sprite which may involve changing the entire ship class into a class // but right now I'm not sure how it would be differentiated between which type of movement the sprite would get public void Update(GameTime gameTime, Ship ship) { // This is the top left corner of the view port I believe center = new Vector2(ship.position.X + (ship.rectangle.Width / 2) - GlobalClass.ScreenWidth / 2, ship.position.Y + (ship.rectangle.Height / 2) - GlobalClass.ScreenHeight / 2); // No idea what this does transform = Matrix.CreateScale(new Vector3(1, 1, 0)) * Matrix.CreateTranslation(new Vector3(-center.X, -center.Y, 0)); }
protected override void Initialize() { //Initialize the variable in GlobalClass GlobalClass.ScreenWidth = graphics.GraphicsDevice.Viewport.Width; GlobalClass.ScreenHeight = graphics.GraphicsDevice.Viewport.Height; //Initialize the player player = new Animation(Content.Load<Texture2D>(@"Textures/ExportSmallCharacter1"), new Vector2(0, 65), 65, 125); //Initialize the ship ship = new Ship(Content.Load<Texture2D>(@"Textures/Ship"), new Vector2(GlobalClass.ScreenWidth / 2, GlobalClass.ScreenHeight / 2)); ship.BulletTexture(Content.Load<Texture2D>(@"Textures/Bullet")); //Initialize the camera camera = new Camera(GraphicsDevice.Viewport); //Initialize the background backgroundTexture = Content.Load<Texture2D>(@"Textures/StarBackground"); backgroundPosition = new Vector2(0, 0); // Make sure the mouse is visible IsMouseVisible = true; base.Initialize(); }