public GameInitializer() { InitializeComponent(); Game pokemon = Game.Instance; pokemon.Title = "Pokémon"; pokemon.GameWidth = 800; pokemon.GamePathName = "Pokemon"; Area newBarkTown = NewBarkTown.Instance.Area; pokemon.Areas.Add(newBarkTown); pokemon.Areas.Add(RouteOne.Instance.Area); pokemon.CurrentArea = newBarkTown; pokemon.NextArea = newBarkTown; IPlayableCharacter red = ((IPlayableCharacter)CellObjectFactory.Build(CellObjectType.Hero)); red.BattleAttacks.Add(BattleAttackFactory.Build(AttackName.Stab)); red.ItemInventory.Add(InventoryItemFactory.Build(ItemName.SmallHealthPotion)); pokemon.PlayableCharacter = red; red.Position = (10, 8); InitializeGame(); }
public void resetArea() { Area = new Area(); int areaWidth = 20; int areaHeight = 14; Area.SetAreaGrid(areaWidth, areaHeight); Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Grass); Area.AreaMusic = new MediaHandler("new_bark_town.mp3"); //Area.AreaMusic = new MediaHandler(""); ICellObject N = CellObjectFactory.Build(CellObjectType.Npc); ICellObject E = CellObjectFactory.Build(CellObjectType.Enemy); ICellObject S = CellObjectFactory.Build(CellObjectType.SmallHouse); ICellObject M = CellObjectFactory.Build(CellObjectType.MediumHouse); ICellObject B = CellObjectFactory.Build(CellObjectType.BigHouse); ICellObject T = CellObjectFactory.Build(CellObjectType.Tree); ICellObject V = CellObjectFactory.Build(CellObjectType.Merchant); ICellObject R = CellObjectFactory.Build(CellObjectType.Sign); ICellObject F = CellObjectFactory.Build(CellObjectType.Flower); ICellObject P = new Portal(RouteOne.Instance.Area, (30, 7), GameEvent.EventTypes.Enter, true, RouteOne.Instance); ICellObject p = new Portal(RouteOne.Instance.Area, (30, 8), GameEvent.EventTypes.Enter, true, RouteOne.Instance); ICellObject e = new Portal(ElmsLab.Instance.Area, (5, 7), GameEvent.EventTypes.Collision, true, ElmsLab.Instance); ICellObject _ = null; ICellObject x = null; ICellObject I = null; ICellObject[][] area = { // 1 10 20 // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { T, T, T, T, T, T, B, x, x, x, x, x, T, T, T, T, T, T, T, T }, //1 new ICellObject[] { I, I, I, I, I, I, x, _, _, _, _, x, I, I, I, I, I, I, I, I }, //2 new ICellObject[] { T, T, T, F, F, F, x, _, _, _, _, x, _, _, M, x, x, x, T, T }, //3 new ICellObject[] { I, I, _, F, _, _, x, x, e, x, x, x, _, _, x, _, _, x, I, I }, //4 new ICellObject[] { T, T, _, _, _, _, N, _, _, _, _, _, _, _, x, _, _, x, _, T }, //5 new ICellObject[] { I, I, _, _, _, _, _, _, _, _, _, _, _, R, x, x, x, x, _, I }, //6 new ICellObject[] { P, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //7 new ICellObject[] { p, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, E, _, _, I }, //8 new ICellObject[] { T, T, T, T, S, x, x, x, _, _, _, _, _, _, _, _, _, _, T, T }, //9 new ICellObject[] { I, I, I, I, x, x, x, x, _, _, _, _, S, x, x, x, _, _, I, I }, //10 new ICellObject[] { T, T, _, V, _, _, _, _, _, _, _, _, x, x, x, x, _, _, T, T }, //11 new ICellObject[] { I, I, _, _, _, _, _, _, _, _, _, _, _, _, F, _, _, _, I, I }, //12 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //13 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I } //14 }; for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } }
public void resetArea() { Area = new Area(); int areaWidth = 30; int areaHeight = 12; Area.SetAreaGrid(areaWidth, areaHeight); Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Grass); Area.AreaMusic = new MediaHandler("route_one.mp3"); //Area.AreaMusic = new MediaHandler(""); ICellObject N = CellObjectFactory.Build(CellObjectType.Npc); ICellObject E = CellObjectFactory.Build(CellObjectType.Enemy); ICellObject S = CellObjectFactory.Build(CellObjectType.SmallHouse); ICellObject M = CellObjectFactory.Build(CellObjectType.MediumHouse); ICellObject B = CellObjectFactory.Build(CellObjectType.BigHouse); ICellObject T = CellObjectFactory.Build(CellObjectType.Tree); ICellObject H = CellObjectFactory.Build(CellObjectType.FancyHouse); ICellObject F = CellObjectFactory.Build(CellObjectType.Flower); ICellObject P = new Portal(NewBarkTown.Instance.Area, (1, 7), GameEvent.EventTypes.Enter, true, NewBarkTown.Instance); ICellObject p = new Portal(NewBarkTown.Instance.Area, (1, 8), GameEvent.EventTypes.Enter, true, NewBarkTown.Instance); ICellObject _ = null; ICellObject x = null; ICellObject I = null; ICellObject[][] area = { // 1 10 20 30 // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //1 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //2 new ICellObject[] { T, T, T, T, T, T, T, T, H, x, x, x, x, _, _, _, _, _, T, T, T, T, T, T, T, T, T, T, T, T }, //3 new ICellObject[] { I, I, I, I, I, I, I, I, x, _, _, _, x, _, _, _, F, _, I, I, I, I, I, I, I, I, I, I, I, I }, //4 new ICellObject[] { T, _, F, F, F, F, _, _, x, _, _, _, x, _, _, F, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //5 new ICellObject[] { I, _, F, F, F, F, _, _, x, x, x, x, x, _, _, _, _, _, _, _, _, _, _, F, _, _, _, _, _, I }, //6 new ICellObject[] { T, _, F, F, F, F, _, _, _, _, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, _, _, _, P }, //7 new ICellObject[] { I, _, _, _, _, _, _, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, _, _, F, _, _, _, p }, //8 new ICellObject[] { T, _, _, F, _, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //9 new ICellObject[] { I, _, _, _, _, _, _, _, F, _, _, _, _, _, _, _, _, F, F, F, F, _, _, _, _, _, _, _, _, I }, //10 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //11 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //12 }; for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } }
public void resetArea() { Area = new Area(); int areaWidth = 10; int areaHeight = 7; Area.SetAreaGrid(areaWidth, areaHeight); Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Floor); Area.AreaMusic = new MediaHandler("shop.mp3"); ICellObject N = CellObjectFactory.Build(CellObjectType.Npc); ICellObject L = CellObjectFactory.Build(CellObjectType.LabThing); ICellObject B = CellObjectFactory.Build(CellObjectType.Bookshelf); ICellObject R = CellObjectFactory.Build(CellObjectType.Rug); ICellObject P = new Portal(NewBarkTown.Instance.Area, (9, 5), GameEvent.EventTypes.Enter, true, NewBarkTown.Instance); ICellObject _ = null; ICellObject x = null; ICellObject[][] area = { // 1 10 // 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { _, B, x, _, _, _, _, _, _, _ }, //1 new ICellObject[] { _, _, _, _, N, _, _, _, _, _ }, //2 new ICellObject[] { _, B, x, _, _, _, _, L, x, _ }, //3 new ICellObject[] { _, _, _, _, _, _, _, _, _, _ }, //4 new ICellObject[] { _, _, _, _, _, _, _, _, _, _ }, //5 new ICellObject[] { L, x, _, _, _, _, _, _, _, _ }, //6 new ICellObject[] { _, _, _, _, P, P, _, _, _, _ }, //7 }; for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } //Placing a rug over the portal Area.SetCellObjectGridPosition(5, 7, R); }
public GameInitializer() { InitializeComponent(); Game newGame = Game.Instance; newGame.Title = "Name your game here"; //Set total width of the game window in pixels newGame.GameWidth = 800; //Set this property to be the name of the game in your file structure. Used for finding the path // for the asset files newGame.GamePathName = "EmptyProject"; // Create a singleton object in the areas folder and instanciate it here Area firstArea = FirstArea.Instance.Area; // Add the area to the game newGame.Areas.Add(firstArea); //Set firstArea to be the starting area when you run the game newGame.CurrentArea = firstArea; //Change this to travel to a new area newGame.NextArea = firstArea; //Use a cell object factory to create a playable character to be used in the game IPlayableCharacter hero = (IPlayableCharacter)CellObjectFactory.Build(CellObjectFactory.CellObjectType.Hero); //From the battle attack factory, give your hero an attack to be used in battle hero.BattleAttacks.Add(BattleAttackFactory.Build(BattleAttackFactory.AttackName.Stab)); //From the inventory item factory, give your hero an item to keep in their inventory hero.ItemInventory.Add(InventoryItemFactory.Build(InventoryItemFactory.ItemName.SmallHealthPotion)); //Set your hero to be the playable character of the game newGame.PlayableCharacter = hero; //Set the start position of the character in the game hero.Position = (6, 6); //Start game InitializeGame(); }
public FirstArea() { Area = new Area(); // Set how many cells the area should have int areaWidth = 30; int areaHeight = 12; Area.SetAreaGrid(areaWidth, areaHeight); // Set a sprite that will fill the entire board Area.BackgroundCellObject = CellObjectFactory.Build(CellObjectType.Grass); // Upload a tune to the assets folder and play it when the player enters the area Area.AreaMusic = new MediaHandler("firstAreaMusic.mp3"); // To easily build an area, you can bind each object you plan to use on the screen in a single character // variable. You can then draw the board using code like below. Cell objects with "null" will be empty. // since some objects are larger than one cell you can place empty variables in the spaces they occupy to make // readability easier. // If you want to place more than one object in a cell you can either place it into the code like so: // Area.SetCellObjectGridPosition(8,8,cellObject); // Or draw a new area with another two dimentional array and place it on top of the other one // To move to a new area you can create a portal and select the new area like below. instead of "FirstArea" you can // enter the area the portal shall lead to, the start position, how the event will be triggered and if the cell // can be stepped on // ICellObject P = new Portal(SecondArea.Instance.Area, (1,7), GameEvent.EventTypes.Enter, true); ICellObject T = CellObjectFactory.Build(CellObjectType.Tree); ICellObject _ = null; // "I" represents the lower side of a tree ICellObject I = null; // hero position is decided in the game initializer or when traveling. // the x shows where the hero will be placed according to the initializer ICellObject x = null; // Objects are placed in their top left part in the grid. // If a 2x4 object is placed at at the 1x1 space, 1x2, 1x3, 1x4, 2x2, 2x3, and 2x4 will be ocupied ICellObject[][] area = { // 1 10 20 30 // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //1 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //2 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //3 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I }, //4 new ICellObject[] { T, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //5 new ICellObject[] { I, _, _, _, _, x, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, I }, //6 new ICellObject[] { T, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //7 new ICellObject[] { I, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, I }, //8 new ICellObject[] { T, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, T }, //9 new ICellObject[] { I, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, I }, //10 new ICellObject[] { T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T }, //11 new ICellObject[] { I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I } //12 }; // Can't touch this for (int i = 0; i < areaHeight; i++) { for (int j = 0; j <= areaWidth - 1; j++) { if (area[i][j] != null) { Area.SetCellObjectGridPosition(j + 1, i + 1, area[i][j]); } } } /* * * ,-===-. _ * :__ __: (#) * ______ [__]=[__] \\ _ * '---___) ) (| c_) |) ((\( 3 )) * / / |.-=_=-.| \ \ * / / \ \_/ / \ \ * / /__.------`---'------.__\ \ * / \ \ # / / \ * `-------\ \#/ /-------' )) \ / --- / \ |o / \ |o / \ |o / \ ______ >-----<_______ \ (( \ / \ / \ / \ .-------. / \ \ / / \ \ / / \ __\___\ /___/__ \ '----^-' '-^----' )) \ */ }