private void startTheGame_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.X >= 228 && e.X <= 394 && e.Y >= 132 && e.Y <= 149)
            {
                PlayerName player = new PlayerName();

                if (player.ShowDialog() == DialogResult.OK)
                {
                    playerN      = player.Player;
                    this.Visible = false;
                    Form1 f1 = new Form1(playerN);

                    f1.Visible = false;
                    f1.ShowDialog();
                    f1.Close();
                    this.Visible = true;
                }
            }
            else if (e.X >= 258 && e.X <= 357 && e.Y >= 185 && e.Y <= 200)
            {
                HighScore1 high = new HighScore1();
                high.ShowDialog();
            }
            else if (e.X >= 233 && e.X <= 370 && e.Y >= 236 && e.Y <= 252)
            {
                DevelopedBy db = new DevelopedBy();
                db.ShowDialog();
            }
        }
Example #2
0
        private void timer3_Tick(object sender, EventArgs e)
        {
            if (balls.Count == 0 && novLevel)
            {
                levelNo++;
                novLevel = false;
                timer3.Stop();
                newLevel(true);
            }
            nn = true; nn2 = true;
            foreach (Ball topka in balls)
            {
                double distance  = Math.Sqrt((topka.X - (hero.X + 10)) * (topka.X - (hero.X + 10)) + (topka.Y - hero.Y - 18) * (topka.Y - 18 - hero.Y));
                double distance2 = Math.Sqrt((topka.X - (hero.X + 6 + hero.img.Width / 2)) * (topka.X - (hero.X + 6 + hero.img.Width / 2)) + (topka.Y - 8 - hero.Y) * (topka.Y - 8 - hero.Y));
                double distance3 = Math.Sqrt((topka.X - (hero.X + 56)) * (topka.X - (hero.X + 56)) + (topka.Y - hero.Y - 23) * (topka.Y - 23 - hero.Y));
                double distance4 = Math.Sqrt((topka.X - (hero.X + 56)) * (topka.X - (hero.X + 56)) + (topka.Y - hero.Y - 68) * (topka.Y - 68 - hero.Y));

                if (distance <= topka.Radius || distance2 <= topka.Radius || distance3 <= topka.Radius || distance4 <= topka.Radius)
                {
                    lives--; timer1.Stop(); timer2.Stop(); timer3.Stop(); timer4.Stop();
                    nn = false; nn2 = false; drawTheSecondArrow = false;
                    if (lives <= 0)
                    {
                        pisinadatoteka();
                        gr.DrawString("Game Over " + playerName, new Font("Arial", 30.0F, FontStyle.Bold), new SolidBrush(Color.Blue), new Point(300, 250));
                        timer3.Stop();
                        HighScore1 high = new HighScore1();
                        high.ShowDialog();
                        Thread.Sleep(2000);
                    }
                    else
                    {
                        Updatethe();
                    }
                }
            }
        }