protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Art.Load(Content); map = new TileMap(input, (int)Static.MapSize.X, (int)Static.MapSize.Y); camera.Position = new Vector2(Static.ScreenSize.X / 2, Static.ScreenSize.Y / 2); }
protected override void Initialize() { // Character character = new Character(Content.Load<Texture2D>("character_stand"), new Vector2(100,100), new Vector2(1f,1f), new Vector2(64,128)); // Tiles var blockTexture = Content.Load<Texture2D>("glowy_tile_multicolor"); tileMap = new TileMap(new Vector2(64, 64), blockTexture); tileMap.AddNewLayer(); var layer = tileMap.GetTileLayerByIndex(0); var rnd = new Random(); for (int x = 0; x < graphics.GraphicsDevice.Viewport.Width / 64 + 1; x++) { for (int y = 0; y < graphics.GraphicsDevice.Viewport.Height / 64 + 1; y++) { var animation = new TileAnimation(blockTexture, new Vector2(512, 512), rnd.Next(200, 500)); layer.AddNewTileToLayer(new Vector2(64, 64), new Vector2(x * 64, y* 64), Color.White, blockTexture, animation); } } base.Initialize(); }
public PathFinding(TileMap map) { this.map = map; openList = new List<Tile>(); closedList = new List<Tile>(); start = map.Map[5, 5]; end = map.Map[10, 10]; AStar(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); myMap = new TileMap(Content.Load<Texture2D>(@"Textures\TileSets\mousemap")); hilight = Content.Load<Texture2D>(@"Textures\TileSets\hilight"); Tile.TileSetTexture = Content.Load<Texture2D>(@"Textures\TileSets\part4_tileset"); //pericles6 = Content.Load<SpriteFont>(@"Fonts\Pericles6"); Camera.ViewWidth = this.graphics.PreferredBackBufferWidth; Camera.ViewHeight = this.graphics.PreferredBackBufferHeight; Camera.WorldWidth = ((myMap.MapWidth-2) * Tile.TileStepX); Camera.WorldHeight = ((myMap.MapHeight-2) * Tile.TileStepY); Camera.DisplayOffset = new Vector2(baseOffsetX, baseOffsetY); // TODO: use this.Content to load your game content here }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); treasureChestTexture = Texture2D.FromStream(GraphicsDevice, new System.IO.StreamReader("content/treasurechest.png").BaseStream); doorTexture = Texture2D.FromStream(GraphicsDevice, new System.IO.StreamReader("content/door.png").BaseStream); tileMap = Content.Load<TileMap>("Maps/OneHouseTest"); sprite = new AnimatedSprite(Content.Load<Texture2D>("Sprites/npc3")); sprite.OriginOffset = new Vector2(16, 30); NPC npc = new NPC(Content.Load<Texture2D>("Sprites/npc3"), dialog, Content.Load<Script>("Scripts/NPC1")); npc.Target = sprite; npcs.Add(npc); npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/amg2"), null, null)); npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/avt1"), null, null)); npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/avt2"), null, null)); npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/npc6"), null, null)); }
/// <summary> /// Standard MapCursor constructor. /// </summary> /// <param name="parentMap">The map which the cursor is tied to.</param> public MapCursor( TileMap parentMap ) { this.parentMap = parentMap; }
public MapSaved(TileMap <MapCellType> map) { this.map = map; savedCells = new Dictionary <Point, MapCellType>(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); myMap = new TileMap( Content.Load<Texture2D>(@"Textures\TileSets\mousemap"), Content.Load<Texture2D>(@"Textures\TileSets\part9_slopemaps")); hilight = Content.Load<Texture2D>(@"Textures\TileSets\hilight"); Tile.TileSetTexture = Content.Load<Texture2D>(@"Textures\TileSets\part4_tileset"); pericles6 = Content.Load<SpriteFont>(@"Fonts\Pericles6"); Camera.ViewWidth = this.graphics.PreferredBackBufferWidth; Camera.ViewHeight = this.graphics.PreferredBackBufferHeight; Camera.WorldWidth = ((myMap.MapWidth-2) * Tile.TileStepX); Camera.WorldHeight = ((myMap.MapHeight-2) * Tile.TileStepY); Camera.DisplayOffset = new Vector2(baseOffsetX, baseOffsetY); vlad = new SpriteAnimation(Content.Load<Texture2D>(@"Textures\Characters\T_Vlad_Sword_Walking_48x48")); vlad.AddAnimation("WalkEast", 0, 48 * 0, 48, 48, 8, 0.1f); vlad.AddAnimation("WalkNorth", 0, 48 * 1, 48, 48, 8, 0.1f); vlad.AddAnimation("WalkNorthEast", 0, 48 * 2, 48, 48, 8, 0.1f); vlad.AddAnimation("WalkNorthWest", 0, 48 * 3, 48, 48, 8, 0.1f); vlad.AddAnimation("WalkSouth", 0, 48 * 4, 48, 48, 8, 0.1f); vlad.AddAnimation("WalkSouthEast", 0, 48 * 5, 48, 48, 8, 0.1f); vlad.AddAnimation("WalkSouthWest", 0, 48 * 6, 48, 48, 8, 0.1f); vlad.AddAnimation("WalkWest", 0, 48 * 7, 48, 48, 8, 0.1f); vlad.AddAnimation("IdleEast", 0, 48 * 0, 48, 48, 1, 0.2f); vlad.AddAnimation("IdleNorth", 0, 48 * 1, 48, 48, 1, 0.2f); vlad.AddAnimation("IdleNorthEast", 0, 48 * 2, 48, 48, 1, 0.2f); vlad.AddAnimation("IdleNorthWest", 0, 48 * 3, 48, 48, 1, 0.2f); vlad.AddAnimation("IdleSouth", 0, 48 * 4, 48, 48, 1, 0.2f); vlad.AddAnimation("IdleSouthEast", 0, 48 * 5, 48, 48, 1, 0.2f); vlad.AddAnimation("IdleSouthWest", 0, 48 * 6, 48, 48, 1, 0.2f); vlad.AddAnimation("IdleWest", 0, 48 * 7, 48, 48, 1, 0.2f); vlad.Position = new Vector2(100, 100); vlad.DrawOffset = new Vector2(-24, -38); vlad.CurrentAnimation = "WalkEast"; vlad.IsAnimating = true; // TODO: use this.Content to load your game content here }
/* Sets the map to which the tile layer is tied. * Note that this is called automatically when a layer is added to a tile map. */ public void SetParentMap( TileMap parentMap ) { ParentMap = parentMap; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Texture2D tilesetTexture = Content.Load<Texture2D>(@"TileSets\TileSet3"); tileset = new TileSet(tilesetTexture, 8, 8, 32, 32); List<TileSet> tilesets = new List<TileSet>(); tilesets.Add(tileset); MapLayer Layer = new MapLayer(500,500); for (int y = 0; y < Layer.Height; y++) { for (int x = 0; x < Layer.Width; x++) { Layer.SetTile(0, x, y); } } List<MapLayer> mapLayers = new List<MapLayer>(); mapLayers.Add(Layer); map = new TileMap(tilesets, mapLayers); // TODO: use this.Content to load your game content here }