예제 #1
0
        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();
        }
예제 #2
0
        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();
        }