protected override void LoadContent() { base.LoadContent(); Texture2D tilesetTexture = this.GameRef.Content.Load<Texture2D>(@"Tilesets\grounds_tileset"); Tileset tilesetGround = new Tileset(tilesetTexture, TilesSize, TilesSize, 4, 1); tilesetTexture = this.GameRef.Content.Load<Texture2D>(@"Tilesets\obstacles_tileset"); Tileset tilesetObstacles = new Tileset(tilesetTexture, TilesSize, TilesSize, 4, 2); tilesetTexture = this.GameRef.Content.Load<Texture2D>(@"Tilesets\buildings_tileset"); Tileset tilesetBuildings = new Tileset(tilesetTexture, TilesSize, TilesSize, 8, 2); List<Tileset> tilesets = new List<Tileset>() { tilesetGround, tilesetObstacles, tilesetBuildings }; MapLayer ground = new MapLayer(TxtMapReader.Load(@"Content\Maps\FinalMap.txt", 1)); MapLayer obstacles = new MapLayer(TxtMapReader.Load(@"Content\Maps\FinalMap.txt", 2)); MapLayer buildings = new MapLayer(TxtMapReader.Load(@"Content\Maps\FinalMap.txt", 3)); List<MapLayer> mapLayers = new List<MapLayer>() { ground, obstacles, buildings }; this.map = new TileMap(tilesets, mapLayers); tilesetTexture = this.GameRef.Content.Load<Texture2D>(@"Tilesets\fourTanks"); Tileset tanksTileset = new Tileset(tilesetTexture, TilesSize, TilesSize, 4, 1); this.player.Tank = new XTankWarsLibrary.SpriteClasses.MovableSprite(tanksTileset, new Tile(0, 0)); }
public TileMap(Tileset tileset, MapLayer layer) { this.tilesets = new List<Tileset>(1) { tileset }; this.mapLayers = new List<MapLayer>(1) { layer }; mapWidth = this.mapLayers[0].Width; mapHeight = this.mapLayers[0].Height; }
public MovableSprite(Tileset tileset, Tile tile) { this.tileset = tileset; this.tile = tile; this.isRotating = true; this.rotationAngle = 0.0f; this.speed = DefaultSpeed; this.direction = Direction.Up; this.formerDirection = Direction.Up; }