Ejemplo n.º 1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            PlayerPicture.Image = PlayerHitImg;
            timer2.Start();

            if (Battle.PlayerHPLeft == Atributes.MaxHP)
            {
                this.timer1.Start();
            }

            Battle.MonsterHPLeft -= Battle.ComputePlayerStrike(Atributes.Damage, Atributes.CriticalChance);
            MonsterHPGone         = Monsters.MonsterHP - Battle.MonsterHPLeft;

            MonsterG = Graphics.FromImage(Monsterbmp);
            MonsterG.Clear(Color.Red);
            MonsterG.FillRectangle(Brushes.Gray, (Single)(Battle.MonsterHPLeft * MonsterHPUnit), 0, (Single)(MonsterHPGone * MonsterHPUnit), (Single)(HPBarHeight));
            MonsterG.DrawString(Battle.MonsterHPLeft + "/" + Monsters.MonsterHP.ToString(), new Font("Arial", HPBarHeight / 2), Brushes.Black, new PointF(HPBarWidth / 2 - HPBarHeight, HPBarHeight / 10));
            MonsterHPBar.Image = Monsterbmp;

            if (Battle.CheckForDeath(Battle.MonsterHPLeft))
            {
                this.timer1.Stop();

                WinLostForm WonForm = new WinLostForm(this, _f2);
                WonForm.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            MonsterPicture.Image = MonsterHitImg;
            timer3.Start();

            Battle.PlayerHPLeft -= Battle.ComputeMonsterStrike(Monsters.MonsterDmg, Monsters.MonsterCrit);
            PlayerHPGone         = Atributes.MaxHP - Battle.PlayerHPLeft;

            PlayerG = Graphics.FromImage(Playerbmp);
            PlayerG.Clear(Color.Red);
            PlayerG.FillRectangle(Brushes.Gray, (Single)(Battle.PlayerHPLeft * PlayerHPUnit), 0, (Single)(PlayerHPGone * PlayerHPUnit), (Single)(HPBarHeight));
            PlayerG.DrawString(Battle.PlayerHPLeft.ToString() + "/" + Atributes.MaxHP.ToString(), new Font("Arial", HPBarHeight / 2), Brushes.Black, new PointF(HPBarWidth / 2 - HPBarHeight, HPBarHeight / 10));
            PlayerHPBar.Image = Playerbmp;

            if (Battle.CheckForDeath(Battle.PlayerHPLeft))
            {
                this.timer1.Stop();

                WinLostForm LostForm = new WinLostForm(this, _f2);
                LostForm.ShowDialog();
            }
        }