Пример #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (humanAttack.IsDeath() && humanAttack.numberOfKilled == 2)
     {
         humanAttack              = new HumanAttack(pictureBoxPlayer, pictureBoxGhost, progressBarHuman, progressBarGhost, 2, 3);
         pictureBoxGhost.Visible  = true;
         progressBarGhost.Visible = true;
         pictureBoxBat.Visible    = false;
         progressBarBat.Visible   = false;
         monsterPic = pictureBoxGhost;
         monsterBar = progressBarGhost;
     }
     else if (humanAttack.IsDeath() && humanAttack.numberOfKilled == 3)
     {
         humanAttack              = new HumanAttack(pictureBoxPlayer, pictureBoxGhoul, progressBarHuman, progressBarGhoul, 4, 4);
         pictureBoxGhoul.Visible  = true;
         progressBarGhoul.Visible = true;
         pictureBoxGhost.Visible  = false;
         progressBarGhost.Visible = false;
         monsterPic = pictureBoxGhoul;
         monsterBar = progressBarGhoul;
     }
     else if (humanAttack.IsDeath() && humanAttack.numberOfKilled == 4)
     {
         timerGame.Stop();
         MessageBox.Show("Win");
         pictureBoxGhoul.Visible  = false;
         progressBarGhoul.Visible = false;
     }
 }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            monsterBar       = progressBarBat;
            monsterPic       = pictureBoxBat;
            buttonDown.Text  = char.ConvertFromUtf32(8595);
            buttonUp.Text    = char.ConvertFromUtf32(8593);
            buttonLeft.Text  = char.ConvertFromUtf32(8592);
            buttonRight.Text = char.ConvertFromUtf32(8594);
            moveHuman        = new MoveHuman(progressBarHuman);
            moveMonster      = new MoveMonster(pictureBoxPlayer, progressBarBat);
            humanAttack      = new HumanAttack(pictureBoxPlayer, monsterPic, progressBarHuman, monsterBar, 0, 2);
            itemV            = new ItemsViasble(pictureBoxPlayer, pictureBoxSwordItem, pictureBoxBowItem, pictureBoxMaceItem, pictureBoxPotionBlueItem, pictureBoxPotionRedItem,
                                                pictureBoxSwordList, pictureBoxBowList, pictureBoxMaceList, pictureBoxPotionBlueList, pictureBoxPotionRedList);
            initList();

            pictureBoxPlayer.BringToFront();
        }