public MainWindow() { #region Подготовка карты и панели меню InitializeComponent(); // Определяем вид разметки окна: область карты слева и меню справа Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content); // Определяем параметры карты: количество клеток по горизонтали и вертикали, размер клетки, // ширина декоративной рамки вокруг карты MapInfo = new CellMapInfo(35, 20, 50, 0); // Создаем карту и размещаем его в окне программы Map = MapCreator.GetUniversalMap(this, MapInfo); Lay.Attach(Map, 0); //Map.DrawGrid(); // выводим сетку // Указываем путь к папке с картинками Map.Library.ImagesFolder = new PathInfo { Path = "..\\..\\..\\..\\i", Type = PathType.Relative }; // Создаем панель инвентаря и размещаем ее в меню hppanel = new InventoryPanel(Map.Library, 150); //hppanel2 = new InventoryPanel(Map.Library, 150); //Items1 = new InventoryPanel(Map.Library, 50); //Items2 = new InventoryPanel(Map.Library, 50); Lay.Attach(hppanel, 1); //Lay.Attach(Items1, 1); //Lay.Attach(hppanel2, 1); //Lay.Attach(Items2, 1); hppanel.SetBackground(Brushes.Wheat); // Создаем текстовую панель и размещаем ее в меню Info = new TextArea_Vertical(); Lay.Attach(Info, 1); Info.AddTextBlock("expEnemy"); Info.AddTextBlock("expMine"); // определяем функцию, которая будет вызвана при нажатии на клавишу //Map.Keyboard.SetSingleKeyEventHandler(CheckKey); #endregion player = new GameObject(); player.y = 50; player.speed = 3; player.reload = 100000; player.ammo = 40; player.hp = 10; player.InventoryPanel = hppanel; addPictures(); //player.Name = Map.SetMapBackground("map"); Name Start = new Name(); Start.player = player; Start.ShowDialog(); timer.AddAction(BCE, 10); timer.AddAction(mishen, 30000); timer.AddAction(spaunEnemy, 3000); timer.AddAction(sudba, 60000); hppanel.AddItem("hp", "hp10"); hppanel.AddItem("box", "box", player.ammo.ToString()); }
public MainWindow() { InitializeComponent(); Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content); MapInfo = new CellMapInfo(10, 10, 40, 5); map = MapCreator.GetUniversalMap(this, MapInfo); Lay.Attach(map, 0); Inventory = new InventoryPanel(map.Library, 50, 14); Lay.Attach(Inventory, 1); map.Library.ImagesFolder = new PathInfo { Path = "..\\..\\images", Type = PathType.Relative }; map.Library.AddPicture("wall", "wall.png"); map.Library.AddPicture("player", "evil.png"); map.Library.AddPicture("gem", "gem_green.png"); player.CreatePlayer(map); map.Library.AddContainer("gem", "gem"); map.ContainerSetSize("gem", 40); map.ContainerSetCoordinate("gem", 180, 200); timer.AddAction(KeyCheck, 50); }
public MainWindow() { InitializeComponent(); // Определяем вид разметки окна: область карты слева и меню справа Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content); // Определяем параметры карты: количество клеток по горизонтали и вертикали, размер клетки, // ширина декоративной рамки вокруг карты MapInfo = new CellMapInfo(35, 20, 50, 0); // Создаем карту и размещаем его в окне программы Map = MapCreator.GetUniversalMap(this, MapInfo); Lay.Attach(Map, 0); //Map.DrawGrid(); // выводим сетку // Указываем путь к папке с картинками Map.Library.ImagesFolder = new PathInfo { Path = "..\\..\\..\\..\\i", Type = PathType.Relative }; // Создаем панель инвентаря и размещаем ее в меню addPictures(); Map.Keyboard.SetSingleKeyEventHandler(checkKey); Map.Library.AddContainer("player", "player", ContainerType.AutosizedSingleImage); Map.ContainerSetMaxSide("player", 100); Map.ContainerSetCoordinate("player", 960, 540); Platform.Map = Map; Platform platform = new Platform(); platform.SetCoordinate(960, 600); Platforms.Add(platform); timer.AddAction(gameCycle, 10); }
public MainWindow() { InitializeComponent(); map = MapCreator.CreateMap(this, 38, 20, 50); map.Library.AddPicture("wall", "wall.png"); map.Library.AddPicture("fire", "fire.png"); map.Library.AddPicture("Gem0", "gem_green.png"); map.Library.AddPicture("Gem1", "gem_blue.png"); map.Library.AddPicture("Gem2", "gem_red.png"); map.Library.AddPicture("stones", "stones.jpg"); map.SetMapBackground("stones"); map.Library.AddContainer("fire", "fire"); map.ContainerSetSize("fire", 50, 50); map.ContainerSetCoordinate("fire", FireX, FireY); map.ContainerSetZIndex("fire", 102); map.ContainerSetIndents("fire", 5, 5); for (int i = 0; i <= 2; i++) { SetGemX[i] = 500 + i * 10; SetGemY[i] = 500 - i * 10; } map.Library.AddContainer("wall", "wall"); map.ContainerSetSize("wall", 50, 50); map.ContainerSetCoordinate("wall", WallX, WallY); CreateContainers("Gem0", SetGemX[0], SetGemY[0], 101); map.ContainerSetZIndex("Gem0", 101); CreateContainers("Gem1", SetGemX[1], SetGemY[1], 101); map.ContainerSetZIndex("Gem1", 101); CreateContainers("Gem2", SetGemX[2], SetGemY[2], 101); map.ContainerSetZIndex("Gem2", 101); timer.AddAction(CheckKey, 10); //Done:Доделать движение: устранить эффект перепрыгивания стены, вернув координаты в исходное состояние; добавить 2 кнопки. //Dont know how:Сделать функцию, которая принимает все параметры контейнера и создает его, чтобы в основной программе можно было создать контейнер в одну строчку. //Done:Сделать так, чтобы после сбора кристалла он появлялся в случайном месте, но не ближе 100 пикселей к игроку. //* Продумать механику игры. }
public Game(int teams) { for (int i = 0; i < teams; i++) { teamUnits.Add(new List <UGameObjectBase>()); } timer.AddAction(EnemiesAct, 10); PriceList.Add("scavenger", 50); PriceList.Add("allyLightTank", 100); PriceList.Add("allyMediumTank", 250); PriceList.Add("Baneblade", 700); PriceList.Add("enemyLightTank", 100); tierList[0] = new Wave(); tierList[0].unitList.Add("enemyLightTank"); tierList[0].Resources = 1000; tierList[0].AvgSpawnInterval = 300; tierList[1] = new Wave(); tierList[1].unitList.Add("enemyLightTank"); tierList[1].Resources = 1000; tierList[1].AvgSpawnInterval = 300; }
public MainWindow() { InitializeComponent(); Lay = LayoutsFactory.GetLayout(LayoutType.Vertical, this.Content); MapInfo = new CellMapInfo(38, 20, 50, 5); map = MapCreator.GetUniversalMap(this, MapInfo); Lay.Attach(map, 0); Inventory = new InventoryPanel(map.Library, 50, 14); Lay.Attach(Inventory, 1); Helper.map = map; map.Library.ImagesFolder = new PathInfo { Path = "..\\..\\images", Type = PathType.Relative }; map.Library.AddPicture("wall", "wall.png"); map.Library.AddPicture("fire", "Fire0.png"); map.Library.AddPicture("Gem0", "gem_green.png"); map.Library.AddPicture("Gem1", "gem_blue.png"); map.Library.AddPicture("Gem2", "gem_red.png"); map.Library.AddPicture("stones", "stones.jpg"); map.Library.AddPicture("ghost0", "GHOST.png"); map.Library.AddPicture("ghost1", "GHOST1.png"); map.Library.AddPicture("ghost2", "GHOST2.png"); map.Library.AddPicture("gate closed", "gate_closed.png"); map.Library.AddPicture("chest", "Chest.png"); for (int I = 0; I <= 3; I++) { for (int j = 0; j <= 3; j++) { map.Library.AddPicture("Portal" + I.ToString() + j.ToString(), "Portal" + I.ToString() + j.ToString() + ".png"); } } string[] exp = new string[11]; string[] Fire = new string[10]; string[] Portal0 = new string[4]; string[] Portal1 = new string[4]; string[] Portal2 = new string[4]; string[] Portal3 = new string[4]; for (int i = 0; i <= 10; i++) { exp[i] = "exp" + i.ToString(); map.Library.AddPicture(exp[i], exp[i] + ".png"); } for (int i = 0; i <= 9; i++) { Fire[i] = "Fire" + i.ToString(); map.Library.AddPicture(Fire[i], Fire[i] + ".png"); } for (int i = 0; i <= 3; i++) { Portal0[i] = "Portal0" + i.ToString(); Portal1[i] = "Portal1" + i.ToString(); Portal2[i] = "Portal2" + i.ToString(); Portal3[i] = "Portal3" + i.ToString(); } map.Library.AddPicture("fon", "Fon.jpg"); map.SetMapBackground("stones"); Inventory.AddItem("Lives", "Fire0"); Inventory.SetBackground(Brushes.Transparent); AnimationDefinition a = new AnimationDefinition(); a.AddEqualFrames(50, exp); a.LastFrame = "exp10"; map.Library.AddAnimation("Explosion", a); AnimationDefinition b = new AnimationDefinition(); b.AddEqualFrames(80, Fire); b.LastFrame = "Fire9"; map.Library.AddAnimation("Fire", b); AnimationDefinition c = new AnimationDefinition(); c.AddEqualFrames(80, Portal0); c.LastFrame = "Portal03"; map.Library.AddAnimation("Portal0", c); AnimationDefinition d = new AnimationDefinition(); d.AddEqualFrames(80, Portal1); d.LastFrame = "Portal13"; map.Library.AddAnimation("Portal1", d); AnimationDefinition f = new AnimationDefinition(); f.AddEqualFrames(80, Portal2); f.LastFrame = "Portal23"; map.Library.AddAnimation("Portal2", f); AnimationDefinition e = new AnimationDefinition(); e.AddEqualFrames(80, Portal3); e.LastFrame = "Portal33"; map.Library.AddAnimation("Portal3", e); Helper.PlayerRun = Helper.PlayerWalk * 2; //map.Library.AddContainer("wall", "wall"); //map.ContainerSetSize("wall", 50, 50); //map.ContainerSetCoordinate("wall", WallX, WallY); CreateGems(); CreatePlayer(); CreateWalls(20, 500, 50, 1020); CreateWalls(975, 20, 1860, 50); CreateWalls(1880, 530, 50, 975); CreateWalls(950, 978, 1815, 50); CreateWalls(500, 500, 250, 250); for (int i = 0; i < 3; i++) { CreateEnemy(); } CreateContainers("Chest", 101, "chest"); map.ContainerSetCoordinate("Chest", 1000, 700); CreatePortals(0, 100, 200); CreatePortals(1, 800, 900); CreatePortals(2, 1000, 500); CreatePortals(3, 1800, 300); //map.Library.AddContainer("fon", "wall", ContainerType.TiledImage); //map.ContainerSetSize("fon", 50, 500); //map.ContainerSetTileSize("fon", 50, 50); //map.ContainerSetCoordinate("fon",25, 25); Player.SetCoordinates(80, 80); timer.AddAction(CheckKey, 10); timer.AddAction(MoveEnemies, 10); timer.AddAction(PlayerPlusEnemy, 10); //Done:Доделать движение: устранить эффект перепрыгивания стены, вернув координаты в исходное состояние; добавить 2 кнопки. //Dont know how:Сделать функцию, которая принимает все параметры контейнера и создает его, чтобы в основной программе можно было создать контейнер в одну строчку. //Done:Сделать так, чтобы после сбора кристалла он появлялся в случайном месте, но не ближе 100 пикселей к игроку. //Создать класс для кристала. //* Продумать механику игры. }