Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var viewMatrix = gameCamera.GetViewMatrix();
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, transformMatrix: viewMatrix);
- spriteBatch.Draw(background, new Vector2(-100, -200), null, Color.DarkRed, 0, new Vector2(), 1, SpriteEffects.None, 0);
- mapManager.currentMap.layerManager.DrawLayers(spriteBatch);
- player.Draw(spriteBatch);
- spriteBatch.End();
- foreach (Layer layer in layers)
- {
- for (int i = 0; i <= layer.height - 1; i++)
- {
- for (int j = 0; j <= layer.width - 1; j++)
- {
- if (layer.Tiles[i, j] != null && layer.Tiles[i, j].onScreen == true)
- {
- spriteBatch.Draw(layer.Tiles[i, j].tileSet.spriteSheet, layer.Tiles[i, j].position, layer.Tiles[i, j].sourceRect, Color.White);
- }
- }
- }
- }
- public Matrix GetViewMatrix()
- {
- return
- Matrix.CreateTranslation(new Vector3(-position.X, -position.Y, 0.0f)) *
- Matrix.CreateTranslation(new Vector3(-origin, 0.0f)) *
- Matrix.CreateScale(zoom, zoom, 1) *
- Matrix.CreateTranslation(new Vector3(origin, 0.0f));
- }
Add Comment
Please, Sign In to add comment