//kretanje pomocu misa - slobodna linija
        private void freehandMouseMove(MouseEventArgs e)
        {
            int gotovo = 0;
            int i, j;

            int boxXstart = 0, boxXend = 0, boxYstart, boxYend;

            if (dragging && mouseDownPoint.X > 0 && mouseDownPoint.X < rWidth &&
                mouseDownPoint.Y > 0 && mouseDownPoint.Y < rHeight)
            {
                for (i = 0; i < 20; i++)
                {
                    boxYstart = 0;
                    boxYend   = 0;
                    boxXstart = boxXend;
                    boxXend  += rWidth;
                    for (j = 0; j < 20; j++)
                    {
                        if (gotovo == 0)
                        {
                            boxYstart = boxYend;
                            boxYend  += rHeight;
                            if (e.X >= finishX && e.Y >= finishY)
                            {
                                gotovo = 1;
                                zatvori();
                            }
                            else if (mazeCells[i, j] == 1 || mazeCells[i, j] == 3 && boxXstart <e.X &&
                                                                                                boxXend> e.X && boxYstart <e.Y && boxYend> e.Y)
                            {
                                if (mazeCells[i, j] == 3)
                                {
                                    Bodovanje.skupljenPlijen();
                                    mazeCells[i, j] = 1;
                                    Rectangle rect = new Rectangle(boxXstart, boxYstart, 25, 25);
                                    lab.FillRectangle(Brushes.Ivory, rect);
                                }
                                mouseStart = mouseEnd;
                                mouseEnd   = new Point(e.X, e.Y);

                                lab.DrawLine(pen, mouseStart, mouseEnd);

                                this.Invalidate();
                            }
                            else if (mazeCells[i, j] == 0 && boxXstart <= e.X &&
                                     boxXend >= e.X && boxYstart <= e.Y && boxYend >= e.Y)
                            {
                                again(1);
                            }
                        }
                    }
                }
            }
            else if (dragging == false)
            {
                again(1);
            }
        }
 //kretanje pomocu misa
 private void simpleMouseMove(MouseEventArgs e)
 {
     if (dragging)
     {
         if (mouseDownPoint.X - e.X <= x + 20 && e.X < x && mazeX - 1 >= 0)
         {
             if (mazeCells[mazeX - 1, mazeY] == 2)
             {
                 makeRect();
                 x -= 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeX--;
             }
             else if (mazeCells[mazeX - 1, mazeY] == 1 || mazeCells[mazeX - 1, mazeY] == 3)
             {
                 x -= 25;
                 if (mazeCells[mazeX - 1, mazeY] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeX--;
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
         else if (e.X - mouseDownPoint.X <= x + 20 && e.X > x + 25 && mazeX + 1 <= 19)
         {
             if (mazeCells[mazeX + 1, mazeY] == 2)
             {
                 makeRect();
                 x += 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeX++;
             }
             else if (mazeCells[mazeX + 1, mazeY] == 1 || mazeCells[mazeX + 1, mazeY] == 3)
             {
                 x += 25;
                 if (mazeCells[mazeX + 1, mazeY] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeX++;
                 if (e.X >= finishX && e.Y >= finishY)
                 {
                     zatvori();
                 }
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
         else if (mouseDownPoint.Y - e.Y <= y + 20 && e.Y < y && mazeY - 1 >= 0)
         {
             if (mazeCells[mazeX, mazeY - 1] == 2)
             {
                 makeRect();
                 y -= 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeY--;
             }
             else if (mazeCells[mazeX, mazeY - 1] == 1 || mazeCells[mazeX, mazeY - 1] == 3)
             {
                 y -= 25;
                 if (mazeCells[mazeX, mazeY - 1] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeY--;
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
         else if (e.Y - mouseDownPoint.Y <= y + 20 && e.Y >= y + 25 && mazeY + 1 <= 19)
         {
             if (mazeCells[mazeX, mazeY + 1] == 2)
             {
                 makeRect();
                 y += 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeY++;
             }
             else if (mazeCells[mazeX, mazeY + 1] == 1 || mazeCells[mazeX, mazeY + 1] == 3)
             {
                 y += 25;
                 if (mazeCells[mazeX, mazeY + 1] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeY++;
                 if (e.X >= finishX && e.Y >= finishY)
                 {
                     zatvori();
                 }
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
     }
 }
 //kretanje pomocu tipkovnice
 private void FormLevel_KeyDown(object sender, KeyEventArgs e)
 {
     if (useM == false && useM_free == false)
     {
         if (e.KeyCode == Keys.Left && mazeX - 1 >= 0)
         {
             if (mazeCells[mazeX - 1, mazeY] == 2)
             {
                 makeRect();
                 x -= 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeX--;
             }
             else if (mazeCells[mazeX - 1, mazeY] == 1 || mazeCells[mazeX - 1, mazeY] == 3)
             {
                 x -= 25;
                 if (mazeCells[mazeX - 1, mazeY] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeX--;
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
         else if (e.KeyCode == Keys.Right && mazeX + 1 <= 19)
         {
             if (mazeCells[mazeX + 1, mazeY] == 2)
             {
                 makeRect();
                 x += 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeX++;
             }
             else if (mazeCells[mazeX + 1, mazeY] == 1 || mazeCells[mazeX + 1, mazeY] == 3)
             {
                 x += 25;
                 if (mazeCells[mazeX + 1, mazeY] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeX++;
                 if (mazeX == 18 && mazeY == 18)
                 {
                     zatvori();
                 }
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
         else if (e.KeyCode == Keys.Up && mazeY - 1 >= 0)
         {
             if (mazeCells[mazeX, mazeY - 1] == 2)
             {
                 makeRect();
                 y -= 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeY--;
             }
             else if (mazeCells[mazeX, mazeY - 1] == 1 || mazeCells[mazeX, mazeY - 1] == 3)
             {
                 y -= 25;
                 if (mazeCells[mazeX, mazeY - 1] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeY--;
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
         else if (e.KeyCode == Keys.Down && mazeY + 1 <= 19)
         {
             if (mazeCells[mazeX, mazeY + 1] == 2)
             {
                 makeRect();
                 y += 25;
                 mazeCells[mazeX, mazeY] = 1;
                 mazeY++;
             }
             else if (mazeCells[mazeX, mazeY + 1] == 1 || mazeCells[mazeX, mazeY + 1] == 3)
             {
                 y += 25;
                 if (mazeCells[mazeX, mazeY + 1] == 3)
                 {
                     Bodovanje.skupljenPlijen();
                 }
                 mazeY++;
                 if (mazeX == 18 && mazeY == 18)
                 {
                     zatvori();
                 }
                 mazeCells[mazeX, mazeY] = 2;
             }
         }
     }
 }