Пример #1
0
 private void generateNewCircleAfterClick()
 {
     if (krugovi.Count <= 3 && krugovi.Count > 0)
     {
         random = new Random();
         generateRandomNumber();
         CircleTreta circle = new CircleTreta(randomX, randomY);
         circle.changeBrush(pnlIgra.BackColor);
         krugovi.Add(circle);
     }
 }
Пример #2
0
        private void pnlIgra_MouseClick(object sender, MouseEventArgs e)
        {
            if (krugovi.Count > 0)
            {
                bool        found = false;
                CircleTreta temp  = null;
                foreach (CircleTreta krug in krugovi)
                {
                    if (krug.Clicked(e.X, e.Y))
                    {
                        krug.isClicked = true;
                        krug.changeBrush(pnlIgra.BackColor);
                        generateNewCircleAfterClick();
                        pnlIgra.Invalidate();
                        found  = true;
                        poeni += 300;
                        temp   = krug;
                        break;
                    }
                }

                if (temp != null)
                {
                    krugovi.Remove(temp);
                }

                if (found == false)
                {
                    if (hard == true)
                    {
                        players.Add(new Player(Form1.Ime, poeni, 2));
                        serialize();
                        najdobarRezultat();
                        lblPrethodniPoeni.Text = poeni.ToString();
                        stopGame();
                    }
                    else
                    {
                        poeni -= 100;
                    }
                }

                lblPoeni.Text = poeni.ToString();
            }
        }
Пример #3
0
 private void generateNewCircles()
 {
     random  = new Random();
     randomX = random.Next(15, pnlWidth - 15);
     randomY = random.Next(15, pnlHeight - 15);
     if (krugovi.Count >= 2)
     {
         generateRandomNumber();
         CircleTreta circle = new CircleTreta(randomX, randomY);
         circle.changeBrush(pnlIgra.BackColor);
         krugovi.Add(circle);
     }
     else
     {
         for (int i = 0; i < 2; i++)
         {
             generateRandomNumber();
             CircleTreta circle = new CircleTreta(randomX, randomY);
             circle.changeBrush(pnlIgra.BackColor);
             krugovi.Add(circle);
         }
     }
 }