コード例 #1
0
        private void Game_Load(object sender, EventArgs e)
        {
            panelNextBattle.Hide();
            panelDeath.Hide();
            PctrMonster.BorderStyle    = BorderStyle.None;
            pctrNextBattle.BorderStyle = BorderStyle.None;
            panelDeath.BorderStyle     = BorderStyle.None;
            btnDeathBottom.FlatAppearance.BorderSize = 0;
            btnDeathTop.FlatAppearance.BorderSize    = 0;
            btnAttack.FlatAppearance.BorderSize      = 0;
            btnBottomWin.FlatAppearance.BorderSize   = 0;
            btnBackpack.FlatAppearance.BorderSize    = 0;
            btnRunAway.FlatAppearance.BorderSize     = 0;
            btnSpells.FlatAppearance.BorderSize      = 0;
            HunterAttacking.Hide();
            lblBattleCounter.Text = battleCounter.ToString();
            lblGoldCoins.Text     = CoinDrop.ToString();

            // This determines which monster the player will be battling.
            if (battleCounter == 1)
            {
                PctrMonster.Image = MonsterImages.GreenSlime;
            }
            if (battleCounter == 1)
            {
                PctrMonster.Image = MonsterImages.SnakeEasy;
            }
            if (battleCounter == 2)
            {
                PctrMonster.Image = MonsterImages.GoblinEasy;
            }
            if (battleCounter == 3)
            {
                PctrMonster.Image = MonsterImages.CockatriceEasy;
            }
            if (battleCounter == 4)
            {
                PctrMonster.Image = MonsterImages.LizardEasy;
            }
            if (battleCounter == 5)
            {
                PctrMonster.Image = MonsterImages.RatEasy;
            }
            if (battleCounter == 6)
            {
                PctrMonster.Image = MonsterImages.ScorpionEasy;
            }
            if (battleCounter == 7)
            {
                PctrMonster.Image = MonsterImages.WolfEasy;
            }
            if (battleCounter == 8)
            {
                PctrMonster.Image = MonsterImages.GhostEasy;
            }
            if (battleCounter == 9)
            {
                PctrMonster.Image = MonsterImages.DragonEasy;
            }
        }
コード例 #2
0
 // This displays the hunter attacking animation for 3 timer ticks.
 private void TimerAttack_Tick(object sender, System.EventArgs e)
 {
     timerAttack++;
     if (timerAttack >= 3)
     {
         HunterAttacking.Hide();
         HunterStanding.Show();
         TimerAttack.Stop();
     }
 }
コード例 #3
0
        public async void btnAttack_Click(object sender, System.EventArgs e)
        {
            btnAttack.Enabled = false;
            HunterStanding.Hide();
            HunterAttacking.Show();
            TimerAttack.Start();

            RandomPlayerAttack();
            if (EnemyHealthBar.Width != 0)
            {
                // Animation for the monster to "flinch" when attacking
                await Task.Delay(1000);

                PctrMonster.Location = new Point(490, 210);
                RandomEnemyAttack();
                await Task.Delay(300);

                PctrMonster.Location = new Point(500, 200);
                await Task.Delay(100);
            }
            btnAttack.Enabled = true;
        }