public IGameObject CreateBrickTile(Vector2 position) { var createdObject = new BrickTile(position); var sprite = new FixedSprite(createdObject, dungeonSpriteAtlas, new Rectangle(984, 45, 16, 16)); createdObject.Sprite = sprite; return(createdObject); }
public void HandleTile(String value, int i, int j) { Tile tile = null; switch (value) { case "1": tile = new FloorTile(new Vector2(j, i)); break; case "2": tile = new LargeTreeTile(new Vector2(j * 33, i * 29)); break; case "3": tile = new BrickTile(new Vector2(j, i)); break; case "4": tile = new QuestionMarkTile(new Vector2(j, i)); break; case "5": tile = new BushTile(new Vector2(j * 33, i * 32)); break; case "6": tile = new CloudTile(new Vector2(j * 33, i * 33)); break; } if (tile != null) { AddTile(tile); } }
private static void SpawnFromString(IRoom room, SpriteBatch spriteBatch, string spawnType, int offsetX, int offsetY, int gridX, int gridY) { int posX = offsetX + gridX * RoomConstants.TileLength; int posY = offsetY + gridY * RoomConstants.TileLength; Point position = new Point(posX, posY); IBlock blockType; INpc npcType; IItem itemType; IBackground backgroundType; switch (spawnType) { //Blocks case RoomConstants.Block: blockType = new Square(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.BrickTile: blockType = new BrickTile(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.GapTile: blockType = new GapTile(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.Fire: position.X += RoomConstants.TileLength / 2; blockType = new Fire(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.LadderTile: backgroundType = new LadderTile(spriteBatch, position); room.AllObjects.Spawn(backgroundType); break; case RoomConstants.Stairs: blockType = new Stairs(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.FishStatue: blockType = new FishStatues(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.DragonStatue: blockType = new DragonStatues(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.BlueGrass: backgroundType = new TileBlueGrass(spriteBatch, position); room.AllObjects.Spawn(backgroundType); break; case RoomConstants.Water: blockType = new TileWater(spriteBatch, position); room.AllObjects.Spawn(blockType); break; case RoomConstants.MovableBlock: blockType = new MovableSquare(spriteBatch, position); ((RoomWithMovableSquare)room).AddMovableSquare((MovableSquare)blockType); room.AllObjects.Spawn(blockType); break; //Npcs case RoomConstants.Aquamentus: position.Y += RoomConstants.TileLength / 2; npcType = new Aquamentus(spriteBatch, position, room.AllObjects); room.AllObjects.Spawn(npcType); break; case RoomConstants.Bat: npcType = new Bat(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.Goriya: npcType = new Goriya(spriteBatch, position, room.AllObjects); room.AllObjects.Spawn(npcType); break; case RoomConstants.Hand: npcType = new Hand(spriteBatch, position, ((RoomWallMaster)room).GetWallMasterRoomToJumpTo()); room.AllObjects.Spawn(npcType); break; case RoomConstants.Jelly: npcType = new Jelly(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.OldMan: position.X += RoomConstants.TileLength / 2; npcType = new OldMan(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.Skeleton: npcType = new Skeleton(spriteBatch, position); room.AllObjects.Spawn(npcType); break; case RoomConstants.SpikeTrap: npcType = new SpikeTrap(spriteBatch, position, room.AllObjects.GetPlayer(0)); room.AllObjects.Spawn(npcType); break; //Items case RoomConstants.Compass: itemType = new CompassItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Heart: position.X += (int)(4 * RoomConstants.SpriteMultiplier); position.Y += (int)(4 * RoomConstants.SpriteMultiplier); itemType = new HeartItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Key: itemType = new KeyItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Map: itemType = new MapItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Triforce: position.X += (int)(12 * RoomConstants.SpriteMultiplier); position.Y += (int)(2 * RoomConstants.SpriteMultiplier); itemType = new TriforceItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.HeartContainer: itemType = new HeartContainerItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; case RoomConstants.Bow: itemType = new BowItem(spriteBatch, position); room.AllObjects.Spawn(itemType); break; default: break; } }