コード例 #1
0
ファイル: Form1.cs プロジェクト: ferhuertas/IPO2-PENNYWISE
        private void KidShooter_MouseClick(object sender, MouseEventArgs e)
        {
            Shoot();
            if (e.X > 515 && e.X < 585 && e.Y > 55 && e.Y < 77)
            {
                timerGameLoop.Start();
            }

            else if (e.X > 515 && e.X < 585 && e.Y > 80 && e.Y < 102)
            {
                timerGameLoop.Stop();
            }

            else if (e.X > 515 && e.X < 585 && e.Y > 105 && e.Y < 128)
            {
            }

            else if (e.X > 515 && e.X < 585 && e.Y > 131 && e.Y < 157)
            {
                timerGameLoop.Stop();
                DialogResult result = MessageBox.Show(this, " ¿De verdad quieres salir de este maravilloso juego?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    this.Close();
                }
            }
            else
            {
                //Hit condition which is called from Hit() method in CMole class
                //(e.X, e.Y) here is the center point position, not mole position
                if (_georgie.Hit(e.X, e.Y))
                {
                    splat        = true;
                    _sangre.Left = _georgie.Left - Resources.sangre.Width / 9;
                    _sangre.Top  = _georgie.Top - Resources.sangre.Height / 6;
                    _hits++;
                }
                else
                {
                    _misses++;
                }

                _totalShots  = _hits + _misses;
                _averageHits = (double)_hits / (double)_totalShots * 100.0;
            }
        }
コード例 #2
0
        private void KidShooter_MouseClick(object sender, MouseEventArgs e)
        {
            if (timeleft <= 15)
            {
                Shoot();

                //Hit condition which is called from Hit() method in CMole class
                //(e.X, e.Y) here is the center point position, not mole position
                if (_georgie.Hit(e.X, e.Y))
                {
                    splat        = true;
                    _sangre.Left = _georgie.Left - Resources.sangre.Width / 9;
                    _sangre.Top  = _georgie.Top - Resources.sangre.Height / 6;
                    _hits++;
                }
                else
                {
                    _misses++;
                }

                _totalShots  = _hits + _misses;
                _averageHits = (double)_hits / (double)_totalShots * 100.0;
            }
        }