public void update(GameTime gametime, Master master) { //calculate the transform matrix transform = Matrix.Identity * //translate by negative position Matrix.CreateTranslation(-position.X, -position.Y, 0) * Matrix.CreateScale(scale) * //rotate about z axis //math.createrotationz(1.75f) * //translate by the origin amount Matrix.CreateTranslation(viewportwidth / 2, viewportheight / 2, 0); translate = Matrix.Identity * //translate by negative position Matrix.CreateTranslation(-position.X, -position.Y, 0) * //rotate about z axis //math.createrotationz(1.75f) * //translate by the origin amount Matrix.CreateTranslation(viewportwidth / 2, viewportheight / 2, 0); //delta so the movement seems smoooth float delta = (float)gametime.ElapsedGameTime.TotalSeconds; //get a rectangle which contains all the players Rectangle players = master.playerspace(); //pad the rectangle players.X -= 200; players.Y -= 200; players.Width += 400; players.Height += 400; position = smoothstep(position, new Vector2(players.Center.X, players.Center.Y), movespeed); //create a scale based on the the size of the player rectangle in respect to the original viewport size float xscale = viewportwidth / players.Width; float yscale = viewportheight/ players.Height; //use the largest scaling value, the smaller value scale will still include all the picture from the larger scale float newscale = (xscale < yscale) ? xscale : yscale; //clamp the scale to the min or max newscale = clamp(newscale, minscale, maxscale); //smooth the scaling scale = smoothstep(scale, newscale, scalespeed); //currently not using the rotation, but it is in there for future reference }