public void Draw(SpriteBatch batch, Camera camera) { foreach (TileLayer layer in Layers) { layer.Draw(batch, camera); } }
public void Draw(SpriteBatch batch, Camera camera) { batch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend,null,null,null,null,camera.TransFormMatrix); for (int x = 0; x < map.GetLength(1); x++) { for (int y = 0; y < map.GetLength(0); y++) { int textureindex = map[y, x]; if (textureindex == -1) continue; Texture2D texture = tiletextures[textureindex]; batch.Draw( texture, new Rectangle( x * Engine.TileWidth, y * Engine.TileHeight, Engine.TileHeight, Engine.TileHeight), new Color(new Vector4(1f,1f,1f,alpha))); } } batch.End(); }