public void Draw(SpriteBatch spriteBatch, MapTexturePack texturePack) { //Draw platforms for (int i = 0; i < mapPlatforms.Count; i++) { mapPlatforms[i].Draw(spriteBatch, texturePack); } }
public GameMap(Random random, GraphicsDevice graphicsDevice, GameSession gameSession) { this.gameSession = gameSession; mapArchitecture = MapArchitectures[random.Next(0, MapArchitectures.Length)]; texturePack = MapTexturePacks[random.Next(0, MapTexturePacks.Length)].Deploy(); ReferenceMap = new CollisionReferenceMap <RigidBody>(MapStandards.REFERENCE_MAP_RESOLUTION, MapStandards.REFERENCE_MAP_RESOLUTION, MapStandards.MAP_SIZE, MapStandards.MAP_SIZE); ParticleReferenceMap = new CollisionReferenceMap <RigidBody>(MapStandards.REFERENCE_MAP_RESOLUTION, MapStandards.REFERENCE_MAP_RESOLUTION, MapStandards.MAP_SIZE, MapStandards.MAP_SIZE); NoCollideMap = new CollisionReferenceMap <RigidBody>(1, 1, MapStandards.MAP_SIZE, MapStandards.MAP_SIZE); parallaxBackground = new ParallaxBackground(texturePack.BackgroundImages); camera = new Camera(this, graphicsDevice); AddArchitectureCollision(); }
public void Draw(SpriteBatch spriteBatch, MapTexturePack texturePack) { float textureScale = MapStandards.TILE_SIZE / texturePack.PlatformTexturePack.PlatformTop[0].Width; for (int i = 0; i < TileLength; i++) { if (i == 0) { spriteBatch.Draw(texturePack.PlatformTexturePack.PlatformTop[(int)PlatformTexturePack.PlatformTexture.Left], new Vector2(position[0] + (i * MapStandards.TILE_SIZE), position[1]), null, Microsoft.Xna.Framework.Color.White, 0, Vector2.Zero, textureScale, SpriteEffects.None, 0); } else if (i == TileLength - 1) { spriteBatch.Draw(texturePack.PlatformTexturePack.PlatformTop[(int)PlatformTexturePack.PlatformTexture.Right], new Vector2(position[0] + (i * MapStandards.TILE_SIZE), position[1]), null, Microsoft.Xna.Framework.Color.White, 0, Vector2.Zero, textureScale, SpriteEffects.None, 0); } else { spriteBatch.Draw(texturePack.PlatformTexturePack.PlatformTop[(int)PlatformTexturePack.PlatformTexture.Middle], new Vector2(position[0] + (i * MapStandards.TILE_SIZE), position[1]), null, Microsoft.Xna.Framework.Color.White, 0, Vector2.Zero, textureScale, SpriteEffects.None, 0); } } for (int i = 0; i < TileLength; i++) { if (i == 0) { spriteBatch.Draw(texturePack.PlatformTexturePack.PlatformBottom[(int)PlatformTexturePack.PlatformTexture.Left], new Vector2(position[0] + (i * MapStandards.TILE_SIZE), position[1] + MapStandards.TILE_SIZE), null, Microsoft.Xna.Framework.Color.White, 0, Vector2.Zero, textureScale, SpriteEffects.None, 0); } else if (i == TileLength - 1) { spriteBatch.Draw(texturePack.PlatformTexturePack.PlatformBottom[(int)PlatformTexturePack.PlatformTexture.Right], new Vector2(position[0] + (i * MapStandards.TILE_SIZE), position[1] + MapStandards.TILE_SIZE), null, Microsoft.Xna.Framework.Color.White, 0, Vector2.Zero, textureScale, SpriteEffects.None, 0); } else { spriteBatch.Draw(texturePack.PlatformTexturePack.PlatformBottom[(int)PlatformTexturePack.PlatformTexture.Middle], new Vector2(position[0] + (i * MapStandards.TILE_SIZE), position[1] + MapStandards.TILE_SIZE), null, Microsoft.Xna.Framework.Color.White, 0, Vector2.Zero, textureScale, SpriteEffects.None, 0); } } }