public void DrawFightMenu(Player player, Enemies enemy, GameImages images)
 {
     Clear();
     images.FightImage();
     images.EnemyStats(enemy);
     images.ActionMenu(player);
     images.BossFightMenu();
     images.AttributeMenu(player);
 }
        public void Kill(Player player, Enemies enemy, GameImages images, GameDialogue dialogue)// when player wins
        {
            int c = rand.Next(0, 45);

            SetCursorPosition(54, 40); Console.WriteLine($"As you stand vitorious over {enemy.Name}!");
            SetCursorPosition(54, 41); WriteLine($"You get ready to leave and spot gold coins around {enemy.Name}! You pick up {c} coins.");
            SetCursorPosition(54, 42); WriteLine("Press any key to continue...");
            ReadKey();
            player.Coin += c;
        }
        public void StoryFightMenu(Player player, Enemies enemy, GameImages images, GameDialogue dialogue)
        {
            CursorVisible = false;
restart:


            while (player.Health > 0 && enemy.Health > 0)
            {
                SetCursorPosition(58, 45);
                DrawFightMenu(player, enemy, images);
                SetCursorPosition(54, 40); WriteLine($" Press (A) to attack, (D) to Defend, (H) to heal....");
                SetCursorPosition(54, 40); WriteLine($"                                                                                      ");
                FightKeyHandling(player, enemy, images);
                ReadKey();
            }
            if (enemy.Health < 1)
            {
                DrawFightMenu(player, enemy, images);
                Kill(player, enemy, images, dialogue);
            }
            else if (player.Life > 0 && player.Health < 1)
            {
                DrawFightMenu(player, enemy, images);
                SetCursorPosition(54, 40); WriteLine($"You are dying. Do you have any elixirs? If so, press L to use it!");
                ConsoleKeyInfo keyInfo  = ReadKey(true);
                ConsoleKey     key; key = keyInfo.Key;
                switch (key)
                {
                case ConsoleKey.L:

                    if (player.Life > 0)
                    {
                        images.ActionMenu(player);
                        SetCursorPosition(54, 40); WriteLine($"In a deperate attempt, you reach into your sack and pull out an elixir.");
                        SetCursorPosition(54, 41); WriteLine($"Glowing bright green, you chug it as quickly as possible.");
                        SetCursorPosition(54, 42); WriteLine($" Atlas! You feel brand new and ready to continue the fight!");
                        SetCursorPosition(54, 43); WriteLine("Press any key to continue...");
                        player.Life--;
                        player.Health += 40;
                        ReadKey();
                        goto restart;
                    }
                    break;

                default:
                    Death(enemy, images, dialogue);
                    break;
                }
            }
            else if (player.Life == 0 && player.Health < 1)
            {
                Death(enemy, images, dialogue);
            }
        }
 public void Chapter(Player player, GameImages images)
 {
     //builds the chapter images and gameplay. Grid takes the .txt and populates a two-dimensional jagged array
     Clear();
     CurrentPlayer = player;
     grid          = GameImages.ParseFileToArray($"{gridname}");// creates grid. using enum
     CurrentLayout = new GameLayout(grid);
     CurrentImages = images;
     CurrentMenu   = new UserMenus();
     //run the world
     RunGameLoop();
 }
示例#5
0
        public GameContent(ContentManager content)
        {
            if (_gameAssets != null)
            {
                throw new Exception("This class is a singleton; use GameContent.GameAssets.");
            }

            Fonts  = new GameFonts(content);
            Images = new GameImages(content);
            Music  = new GameMusic(content);

            _gameAssets = this;
        }
        public void Death(Enemies enemy, GameImages images, GameDialogue dialogue)// when player dies
        {
            Clear();
            images.Death();
            SetCursorPosition(54, 40); WriteLine($"In a deperate attempt, you reach into your sack and see feel nothing.");
            SetCursorPosition(54, 41); WriteLine($"Feeling tired, you let your guard down {enemy.Name} deals the final blow. Dude you are dead!");
            SetCursorPosition(54, 42); WriteLine("Press any key to continue...");
            ReadKey();
            Clear();
            //go back to start menu
            images.TitlePage();
            images.MainMenu();

            bool mainMenu = true;

            while (mainMenu)
            {
                SetCursorPosition(113, 34);
                mainMenu = MainMenu(images);
            }
        }
示例#7
0
            public DB MakeDB()
            {
                try { System.IO.Directory.Delete(DBAddress, true); } catch { }

                MakeDB(ref SimpleDatas, "KeyValueDatas", (c) => c.Name);

                MakeDB(ref Groups, "Groups", (c) => c.Name);
                (Groups.Relation((c) => c.GroupParents, (c) => c.IsUpdateAble = ISUpdateAble),
                 Groups.Relation((c) => c.GroupChilds, (c) => c.IsUpdateAble = ISUpdateAble)).Join();

                MakeDB(ref Products, "Products", (c) => c.ProductName);
                (Products.Relation((c) => c.GroupParents, (c) => c.IsUpdateAble = ISUpdateAble),
                 Groups.Relation((c) => c.ProductChilds, (c) => c.IsUpdateAble = ISUpdateAble)).Join();

                MakeDB(ref GameDatas, "GameDatas", (c) => (string)c.Product.Key);
                (GameDatas.Relation((c) => c.Product, (c) => c.IsChild = true),
                 Products.Relation((c) => c.Game, (c) => c.IsUpdateAble = ISUpdateAble)).Join();

                MakeDB(ref GameImages, "GameImages", (c) => (string)c.Product.Key);
                (GameImages.Relation((c) => c.Product, (c) => c.IsChild = true),
                 Products.Relation((c) => c.Image, (c) => c.IsUpdateAble = ISUpdateAble)).Join();

                return(this);
            }
 /// <summary>
 /// Creates a new Game without any content.
 /// </summary>
 public Game() {
     AlternateTitles = new List<String>();
     Genres = new List<String>();
     Images = new GameImages();
 }
示例#9
0
        public Shop(Level level, DirectoryInfo imagesDirectory = null)
        {
            BackColor = GameColors.BackgroundColor;
            InitializeComponent();
            Location    = new Point(0, 0);
            MaximizeBox = false;
            GameImages.ImagesForShop();
            GameImages.PlayerImages.ImagesForSugar();

            this.level = level;

            var buttonBuy = new Button()
            {
                Text      = "Купить",
                Font      = new Font("Roboto", 15),
                Dock      = DockStyle.Fill,
                BackColor = GameColors.ButtonColor,
            };

            buttonBuy.Click += (sender, args) =>
            {
                if (current != null && level.player.TryRemoveCoins(current.GetPrice()))
                {
                    level.player.Tools.Add(current);
                }
            };

            var buttonBack = new Button()
            {
                Text      = "Назад",
                Font      = new Font("Roboto", 15),
                Dock      = DockStyle.Fill,
                BackColor = GameColors.ButtonColor,
            };

            buttonBack.Click += (sender, args) =>
            {
                this.Hide();
            };

            var textBox = new Label()
            {
                Text      = "Выберите покупку",
                TextAlign = ContentAlignment.MiddleCenter,
                Font      = new Font("Roboto", 25),
                Dock      = DockStyle.Fill,
                BackColor = GameColors.TextShopBackColor,
            };

            var picture = new PictureBox()
            {
                Image    = (GameImages.PlayerImages.Simple),
                Location = new Point(90, 90),
                Size     = new Size(200, 200),
                SizeMode = PictureBoxSizeMode.StretchImage,
            };

            var boots = new Button()
            {
                Image = GameImages.Boots,
                Dock  = DockStyle.Fill,
            };

            boots.Click += (sender, args) =>
            {
                current       = new Boots();
                textBox.Text  = current.GetName() + "; \n Цена - " + current.GetPrice().ToString();
                picture.Image = GameImages.PlayerImages.WithBoots;
            };

            var hat = new Button()
            {
                Image = GameImages.CoinMagnet,
                Dock  = DockStyle.Fill,
            };

            hat.Click += (sender, args) =>
            {
                current       = new Magnet();
                textBox.Text  = current.GetName() + "; \n Цена - " + current.GetPrice().ToString();
                picture.Image = (GameImages.PlayerImages.WithMagnet);
            };

            var student = new Button()
            {
                Image = GameImages.Student,
                Dock  = DockStyle.Fill
            };

            student.Click += (sender, args) =>
            {
                current       = new Student();
                textBox.Text  = current.GetName() + "; \n Цена - " + current.GetPrice().ToString();
                picture.Image = (GameImages.PlayerImages.WithStudent);
            };

            var table = new TableLayoutPanel();

            table.RowStyles.Add(new RowStyle(SizeType.Percent, 40));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 49));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 17));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 17));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 17));

            table.Controls.Add(buttonBuy, 1, 3);
            table.Controls.Add(buttonBack, 3, 3);
            table.Controls.Add(boots, 1, 1);
            table.Controls.Add(student, 2, 1);
            table.Controls.Add(hat, 3, 1);
            table.SetColumnSpan(textBox, 3);
            table.Controls.Add(textBox, 1, 0);
            Controls.Add(picture);
            table.Dock = DockStyle.Fill;
            Controls.Add(table);
        }
示例#10
0
 static MainWindow()
 {
     AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     GameImages.Touch();
 }
示例#11
0
        public Menu(DirectoryInfo imagesDirectory = null)
        {
            Location    = new Point(0, 0);
            MaximizeBox = false;
            InitializeComponent();
            GameImages.ImageBackGround();
            BackgroundImage = GameImages.backgroung;
            ClientSize      = new Size(860, 600);

            var play = new Button()
            {
                BackColor = Color.Yellow,
                Text      = "Играть",
                Font      = new Font("Roboto", 15),
                Size      = new Size(400, 50),
            };

            play.Click += (sender, args) =>
            {
                var coins3 = new List <Rectangle>();
                for (var y = 250; y <= 290; y += 40)
                {
                    for (var x = 250; x <= 80 + 50 * 10; x += 50)
                    {
                        coins3.Add(new Rectangle(x, y, 25, 25));
                    }
                }
                coins3.Add(new Rectangle(1000, 250, 25, 25));
                coins3.Add(new Rectangle(60, 30, 25, 25));
                coins3.Add(new Rectangle(95, 30, 25, 25));
                coins3.Add(new Rectangle(960, 165, 25, 25));

                var coins1 = new List <Rectangle>()
                {
                    new Rectangle(450, 300, 50, 50), new Rectangle(800, 400, 50, 50), new Rectangle(800, 150, 50, 50)
                };
                var coins2 = new List <Rectangle>()
                {
                    new Rectangle(200, 350, 50, 50), new Rectangle(550, 100, 50, 50)
                };
                for (var x = 0; x <= 150; x += 30)
                {
                    coins2.Add(new Rectangle(x, 275, 50, 50));
                }
                var player   = new Player(new Rectangle(25, 500, 50, 50), 2);
                var monster3 = new Monster[] { new Monster(320, 560, MovingDirection.Right, new Rectangle(380, 500, 50, 50)),
                                               new Monster(320, 740, MovingDirection.Left, new Rectangle(380, 145, 50, 50)),
                                               new Monster(580, 850, MovingDirection.Right, new Rectangle(480, 25, 50, 50)) };
                var monster2 = new Monster[] { new Monster(300, 550, MovingDirection.Right, new Rectangle(400, 400, 50, 50)),
                                               new Monster(250, 450, MovingDirection.Right, new Rectangle(300, 50, 50, 50)) };
                var finish3 = new Rectangle(880, 5, 75, 75);
                var finish  = new Rectangle(100, 75, 100, 75);
                var finish2 = new Rectangle(750, 175, 100, 75);
                var level3  = new LevelBuilder(1024, 600, finish3, new Rectangle(320, 265, 50, 80), null).AddPlayer(player).AddMonsters(monster3)
                              .AddWalls(new Rectangle(0, 550, 160, 50),
                                        new Rectangle(320, 550, 320, 50),
                                        new Rectangle(560, 500, 80, 50),
                                        new Rectangle(640, 450, 160, 50),
                                        new Rectangle(880, 400, 80, 50),
                                        new Rectangle(960, 325, 80, 50),
                                        new Rectangle(600, 350, 160, 25),
                                        new Rectangle(320, 350, 160, 25),
                                        new Rectangle(80, 300, 160, 25),
                                        new Rectangle(20, 225, 120, 25),
                                        new Rectangle(320, 195, 440, 25),
                                        new Rectangle(880, 195, 120, 25),
                                        new Rectangle(580, 75, 400, 25),
                                        new Rectangle(280, 95, 160, 25),
                                        new Rectangle(40, 70, 160, 25))
                              .AddCoins(coins3.ToArray())
                              .AddLava(new Rectangle(160, 550, 160, 50),
                                       new Rectangle(640, 550, 480, 50));
                var level2 = new LevelBuilder(1024, 600, finish2, new Rectangle(0, 275, 50, 70), level3).AddPlayer(player)
                             .AddMonsters(monster2)
                             .AddHints(new Hint(new Rectangle(0, 0, 1024, 600),
                                                "Остерегайтесь стаканчиков с кофе"))
                             .AddWalls(new Rectangle(0, 550, 150, 50),
                                       new Rectangle(150, 450, 400, 50),
                                       new Rectangle(0, 350, 150, 50),
                                       new Rectangle(0, 200, 150, 50),
                                       new Rectangle(600, 350, 200, 50),
                                       new Rectangle(250, 275, 200, 50),
                                       new Rectangle(500, 200, 150, 50),
                                       new Rectangle(750, 250, 100, 50),
                                       new Rectangle(200, 100, 300, 50))
                             .AddLava(new Rectangle(150, 550, 900, 50)).AddCoins(coins2.ToArray());

                var level1 = new LevelBuilder(1024, 600, finish, new Rectangle(0, 0, 0, 0), level2).AddPlayer(player)
                             .AddCoins(coins1.ToArray())
                             .AddLava(new Rectangle(250, 550, 400, 100))
                             .AddHints(new Hint(new Rectangle(0, 0, 1000, 1000),
                                                "Используйте A, D и пробел для перемещения "))
                             .AddWalls(new Rectangle(0, 550, 250, 100),
                                       new Rectangle(650, 550, 350, 100),
                                       new Rectangle(300, 450, 100, 50),
                                       new Rectangle(450, 400, 100, 50),
                                       new Rectangle(600, 480, 100, 50),
                                       new Rectangle(600, 300, 200, 50),
                                       new Rectangle(300, 200, 200, 50),
                                       new Rectangle(100, 150, 100, 50));
                new GameForm(level1).Show();
                this.Hide();
            };
            Controls.Add(play);
            var table = new TableLayoutPanel();

            table.BackgroundImage = GameImages.backgroung;
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 41));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 25));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 25));
            table.RowStyles.Add(new RowStyle(SizeType.Percent, 10));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 21));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 32));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 32));
            table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15));

            table.Controls.Add(play, 1, 1);
            table.SetColumnSpan(play, 2);
            table.Dock = DockStyle.Fill;
            Controls.Add(table);
        }
示例#12
0
 public void Shopkeeper(Player player, GameImages images)
 {
     CurrentImages.ShopKeeperImage();
     CurrentMenu.ShopkeeperMethod(CurrentPlayer, CurrentImages);
 }
示例#13
0
 public void UI_DrawGrayLevelImage(string imageID, int gx, int gy)
 {
     m_GameCanvas.AddImage(GameImages.GetGrayLevel(imageID), gx, gy);
 }
示例#14
0
 public void UI_DrawImage(string imageID, int gx, int gy, Color tint)
 {
     m_GameCanvas.AddImage(GameImages.Get(imageID), gx, gy, tint);
 }
示例#15
0
        public GameForm(LevelBuilder levelBuilder, DirectoryInfo imagesDirectory = null, int coins = -1, int lifes = -1)
        {
            GameImages.PlayerImages.ImagesForSugar();
            Location     = new Point(0, 0);
            MaximizeBox  = false;
            finish       = "финиш.png";
            shop         = "shop.png";
            PlayerImage  = GameImages.PlayerImages.Simple;
            LifeImage    = "жизнь.png";
            CoinImage    = "монетка.png";
            MonsterImage = "монстр.png";
            GameImages.ImagesForShop();
            toolImage = new Dictionary <TypeTool, Bitmap>();
            toolImage[TypeTool.Boot]    = GameImages.Boots;
            toolImage[TypeTool.Magnet]  = GameImages.CoinMagnet;
            toolImage[TypeTool.Student] = GameImages.Student;
            Controls.Add(hintLabel);
            yForHints            = 60;
            xForTool             = 100;
            fontForMoneyAndLifes = new Font("Arial", 30);
            this.levelBuilder    = levelBuilder;
            this.level           = levelBuilder.ToLevel();
            if (coins != -1)
            {
                level.player.Coins = coins;
            }
            if (lifes != -1)
            {
                level.player.Lifes = lifes;
            }
            FormBorderStyle = FormBorderStyle.FixedDialog;
            if (imagesDirectory == null)
            {
                imagesDirectory = new DirectoryInfo("Image");
            }
            foreach (var e in imagesDirectory.GetFiles("*.png"))
            {
                bitmaps[e.Name] = (Bitmap)Image.FromFile(e.FullName);
            }
            yForCoinsAndHearths = bitmaps[LifeImage].Height + 10;
            xForCoinsAndHearths = bitmaps[LifeImage].Width;
            ClientSize          = new Size(
                this.level.LevelWidth,
                yForCoinsAndHearths + yForHints + this.level.LevelHeight);

            keyWithTool = new Dictionary <TypeTool, Bitmap>();
            keyWithTool[TypeTool.Magnet]  = GameImages.PlayerImages.WithMagnet;
            keyWithTool[TypeTool.Student] = GameImages.PlayerImages.WithStudent;
            keyWithTool[TypeTool.Boot]    = GameImages.PlayerImages.WithBoots;

            brushesOfCells[CellType.Lava] = new SolidBrush(GameColors.LavaColor);
            brushesOfCells[CellType.Wall] = new SolidBrush(GameColors.WallColor);

            BackgroundImage = GetBackgroundImage(levelBuilder);

            spritesImages = new Dictionary <SpriteType, Bitmap>();
            spritesImages[SpriteType.Player]  = PlayerImage;
            spritesImages[SpriteType.Coin]    = bitmaps[CoinImage];
            spritesImages[SpriteType.Monster] = bitmaps[MonsterImage];

            picture = new PictureBox()
            {
                BackColor   = GameColors.ButtonColor,
                BorderStyle = BorderStyle.FixedSingle,
                Location    = new Point(level.LevelWidth - 3 * xForTool, ClientSize.Height - yForHints),
                Size        = new Size(xForTool, yForHints),
                SizeMode    = PictureBoxSizeMode.StretchImage,
            };
            Controls.Add(picture);

            picture1 = new PictureBox()
            {
                BackColor   = GameColors.ButtonColor,
                BorderStyle = BorderStyle.FixedSingle,
                Location    = new Point(level.LevelWidth - 2 * xForTool, ClientSize.Height - yForHints),
                Size        = new Size(xForTool, yForHints),
                SizeMode    = PictureBoxSizeMode.StretchImage,
            };
            Controls.Add(picture1);

            picture2 = new PictureBox()
            {
                BackColor   = GameColors.ButtonColor,
                BorderStyle = BorderStyle.FixedSingle,
                Location    = new Point(level.LevelWidth - xForTool, ClientSize.Height - yForHints),
                Size        = new Size(xForTool, yForHints),
                SizeMode    = PictureBoxSizeMode.StretchImage,
            };
            Controls.Add(picture2);

            hintLabel = new Label()
            {
                BackColor = GameColors.ButtonColor,
                Text      = "",
                Font      = new Font("Roboto", 15),
                Size      = new Size(level.LevelWidth - 3 * xForTool, yForHints),
                Location  = new Point(0, level.LevelHeight + yForCoinsAndHearths),
                TextAlign = ContentAlignment.MiddleLeft,
            };

            Controls.Add(hintLabel);
            timer          = new Timer();
            timer.Interval = 40;
            timer.Tick    += TimerTick;
            timer.Start();
        }
示例#16
0
        public void ChapBoss(Player player, GameImages images, GameDialogue dialogue, Enemies enemies, UserMenus menu)
        {
            Clear();

            menu.StoryFightMenu(CurrentPlayer, enemies, images, dialogue);
        }
示例#17
0
 public void AddTile(string imageID, Color color)
 {
     m_GameCanvas.AddTile(GameImages.Get(imageID), color);
 }
示例#18
0
 public void AppendTile(string imageID)
 {
     m_GameCanvas.AppendTile(GameImages.Get(imageID));
 }
示例#19
0
 void LoadResources()
 {
     Logger.WriteLine(Logger.Stage.INIT_GFX, "loading images...");
     GameImages.LoadResources(this);
     Logger.WriteLine(Logger.Stage.INIT_GFX, "loading images done");
 }
示例#20
0
        public void ShopkeeperMethod(Player player, GameImages images)
        {
            // Shopkepper method

            SetCursorPosition(105, 20); WriteLine("Shopkeeper: Welcome to my shop Ms. Traveler. ");
            SetCursorPosition(105, 20); WriteLine("How can I Help you.");
            SetCursorPosition(105, 21); WriteLine("Elta: Yea, show me what you got!");
            SetCursorPosition(105, 22); WriteLine("Would you like to buy or sell?.");
            SetCursorPosition(105, 37); WriteLine("(Enter S, D, G, or B to buy something)  ");
            SetCursorPosition(105, 38); WriteLine("Enter M to sell junk  ");
            SetCursorPosition(105, 23); WriteLine(" Press (ESC) to Exit.");
            CursorVisible = false;
            bool shop = true;

            while (shop == true)
            {
                images.ActionMenu(player);
                images.AttributeMenu(player);

                SetCursorPosition(105, 35); WriteLine($"You currently have {player.Coin} krubels ");

                ConsoleKeyInfo keyInfo  = Console.ReadKey(true);
                ConsoleKey     key; key = keyInfo.Key;

                if (player.Coin == 0)
                {
                    player.Coin = 0;

                    SetCursorPosition(54, 40); WriteLine("Shopkeeper: You need krubels to buy things. Sell something or get out. ");
                    SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                    ReadKey();
                    break;
                }
                else if (player.Coin > 1)
                {
                    switch (key)
                    {
                    case ConsoleKey.S:     //sword
                        if (player.Coin < 500)
                        {
                            SetCursorPosition(54, 40); WriteLine("you don't have enough krubels, try again");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }
                        else if (player.Coin >= 500)
                        {
                            player.Coin    -= 500;
                            player.Attack  += 40;
                            player.Defense += 10;
                            SetCursorPosition(54, 40); WriteLine($"You now have {player.Coin} Krubels, {player.Defense} defense, and do {player.Attack} damage.");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }
                        break;

                    case ConsoleKey.D:     //Dual_Pistols
                        if (player.Coin < 750)
                        {
                            SetCursorPosition(54, 40); WriteLine("you don't have enough krubels, try again");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }
                        else if (player.Coin >= 750)
                        {
                            player.Attack += 55;
                            player.Coin   -= 750;
                            SetCursorPosition(54, 40); WriteLine($"You now have {player.Coin} Krubels and do {player.Attack} damage.");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }

                        break;

                    case ConsoleKey.G:     //shotgun
                        if (player.Coin < 1000)
                        {
                            SetCursorPosition(54, 40); WriteLine("you don't have enough krubels, try again");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }
                        else if (player.Coin >= 1000)
                        {
                            player.Attack  += 80;
                            player.Defense += 10;
                            player.Coin    -= 1000;
                            SetCursorPosition(54, 40); WriteLine($"You now have {player.Coin} Krubels, {player.Defense} defense, and do {player.Attack} damage.");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }

                        break;

                    case ConsoleKey.B:     //Beets
                        if (player.Coin < 10)
                        {
                            SetCursorPosition(54, 40); WriteLine("you don't have enough krubels, try again");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }
                        else if (player.Coin >= 10)
                        {
                            if (player.Rejuvenation < 10)
                            {
                                player.Rejuvenation += 1;
                                SetCursorPosition(54, 40); WriteLine($"You have {player.Rejuvenation} beets");
                                player.Coin -= 10;
                                SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                                ReadKey();
                            }
                            else
                            {
                                SetCursorPosition(54, 40); WriteLine($"You are fully stocked with rejuvenating beets, my friend!");
                                SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                                ReadKey();
                            }
                        }

                        break;


                    case ConsoleKey.M:     //Moneybuyback
                        if (player.Junk > 0)
                        {
                            SetCursorPosition(54, 40); WriteLine(" I can give you all my junk");
                            int sell = player.Junk * 10;
                            SetCursorPosition(54, 40); WriteLine($"you earned ${sell} in junk buyback! ");
                            player.Coin += sell;
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }
                        else if (player.Junk == 0)
                        {
                            SetCursorPosition(54, 40); WriteLine($"It looks like you don;t have any junk to sell!");
                            SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                            ReadKey();
                        }
                        break;

                    case ConsoleKey.Escape:     //Moneybuyback
                        shop = false;
                        SetCursorPosition(54, 40); WriteLine("Thanks for shopping!");
                        SetCursorPosition(54, 41); WriteLine("Press any key to continue");
                        ReadKey();
                        Clear();
                        break;

                    default:
                        break;
                    }
                }
            }
        }
示例#21
0
 public void UI_DrawImageTransform(string imageID, int gx, int gy, float rotation, float scale)
 {
     m_GameCanvas.AddImageTransform(GameImages.Get(imageID), gx, gy, rotation, scale);
 }
示例#22
0
        public void FightKeyHandling(Player player, Enemies enemy, GameImages images)
        {
            SetCursorPosition(0, 38); WriteLine($" Press (A) to attack, (D) to Defend, (H) to heal");


            ConsoleKeyInfo keyInfo  = ReadKey(true);
            ConsoleKey     key; key = keyInfo.Key;


            switch (key)
            {
            case ConsoleKey.A:    //Attack

                int damage = enemy.Power - player.Armor;
                int attack = rand.Next(0, player.Attack) + rand.Next(1, 4);    //randomized damage value
                if (damage < 0)
                {
                    damage = 0;
                }
                SetCursorPosition(54, 40); WriteLine($"Elta wildy attacks, leaving herself open to take major damage from {enemy.Name} ");
                SetCursorPosition(54, 41); WriteLine($"Tip, press defend to shield and attack at the same time");
                SetCursorPosition(54, 42); WriteLine($"You lose  " + damage + "  health, and deal " + attack + "  damage");
                SetCursorPosition(54, 43); WriteLine("Press any key to continue...");
                player.Health -= damage;
                if (player.Health < 0)
                {
                    player.Health = 0;
                }
                enemy.Health -= attack;
                if (enemy.Health < 0)
                {
                    enemy.Health = 0;
                }
                images.AttributeMenu(player);
                images.EnemyStats(enemy);

                break;


            case ConsoleKey.D:    //Defend

                SetCursorPosition(54, 40); WriteLine($"Elta waits for {enemy.Name} to attack, but swiftly blocks only taking a");
                SetCursorPosition(54, 41); WriteLine($" small amount of damage and dealing heavy damage to Ocil with his gaurd down:");
                int defensedamage = (enemy.Power / 2) - player.Armor;
                if (defensedamage < 0)
                {
                    defensedamage = 0;
                }
                int counterattack = rand.Next(0, player.Attack * 2) + rand.Next(1, 4);
                SetCursorPosition(54, 43); WriteLine("You lose  " + defensedamage + "  health, and deal  " + counterattack + "  damage");
                SetCursorPosition(54, 44); WriteLine("Press any key to continue...");
                player.Health -= defensedamage;
                if (player.Health < 0)
                {
                    player.Health = 0;
                }
                enemy.Health -= counterattack;
                if (enemy.Health < 0)
                {
                    enemy.Health = 0;
                }
                images.AttributeMenu(player);
                images.EnemyStats(enemy);
                break;

            case ConsoleKey.H:    // heal
                if (player.Rejuvenation == 0)
                {
                    SetCursorPosition(54, 40); WriteLine("As you desperatly grasp for a beet in your sack, all that you feel is dirt");
                    int healingdamage = enemy.Power - player.Armor;

                    player.Health -= healingdamage;
                    if (healingdamage < 0)
                    {
                        healingdamage = 0;
                    }
                    SetCursorPosition(54, 41); WriteLine($" {enemy.Name}  strikes you with a mighty blow and you lose  " + healingdamage + "  health!");
                    SetCursorPosition(54, 42); WriteLine("Press any key to continue...");
                }
                else
                {
                    SetCursorPosition(54, 40); WriteLine("You reach into your sack and pull out a delicious beet. You devour it within seconds!");
                    int beetV = 10;
                    SetCursorPosition(54, 41); WriteLine("You gain " + beetV + " health");
                    SetCursorPosition(54, 42); WriteLine("Press any key to continue...");
                    player.Health += beetV;
                    player.Rejuvenation--;
                }
                images.AttributeMenu(player);
                images.EnemyStats(enemy);
                break;

            default:
                break;
            }
        }
示例#23
0
 public void UI_DrawTransparentImage(float alpha, string imageID, int gx, int gy)
 {
     m_GameCanvas.AddTransparentImage(alpha, GameImages.Get(imageID), gx, gy);
 }
示例#24
0
文件: Game.cs 项目: jizang/FamicomEmu
 /// <summary>
 /// Creates a new Game without any content.
 /// </summary>
 public Game()
 {
     AlternateTitles = new List <String>();
     Genres          = new List <String>();
     Images          = new GameImages();
 }