Example #1
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();
     }
 }
Example #2
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;
        }