Skip to content

Instantly share code, notes, and snippets.

@kenpower
Created November 8, 2012 12:50
Show Gist options
  • Select an option

  • Save kenpower/4038610 to your computer and use it in GitHub Desktop.

Select an option

Save kenpower/4038610 to your computer and use it in GitHub Desktop.
drawing enemies with a moving overhead 2d camera
//drawing enemies with a moving camera
Vector3 cameraPos = new Vector3(-camera.Position.X, -camera.Position.Y, 0);
Matrix cameraTrans = Matrix.CreateTranslation(cameraPos);
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null,cameraTrans);
foreach(Sprite s in sprites)
s.Draw(gameTime,spriteBatch, true);
spriteBatch.End();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment