Exemplo n.º 1
0
        private int Apropiate()
        {
            int a = 0;

            for (int i = 0; i < 4; i++)
            {
                if (RectTop[i].X < RectTop[a].X)
                {
                    a = i;
                }
            }

            return(a);
        }
Exemplo n.º 2
0
        private void Ini()
        {
            RectTop = new List <Rectangle>();
            RectBot = new List <Rectangle>();
            X       = new List <int>();
            retea   = new ReteaNeuronala(6, 3, 4);

            Rectangle aT = new Rectangle(400, 0, 30, rnd.Next(100, 280));
            Rectangle bT = new Rectangle(700, 0, 30, rnd.Next(100, 280));
            Rectangle cT = new Rectangle(1000, 0, 30, rnd.Next(100, 280));
            Rectangle dT = new Rectangle(1300, 0, 30, rnd.Next(100, 280));

            List <int> aux = new List <int>();

            aux.Add(430 - aT.Height);
            aux.Add(430 - bT.Height);
            aux.Add(430 - cT.Height);
            aux.Add(430 - dT.Height);

            Rectangle aB = new Rectangle(400, 600 - aux[0], 30, aux[0]);
            Rectangle bB = new Rectangle(700, 600 - aux[1], 30, aux[1]);
            Rectangle cB = new Rectangle(1000, 600 - aux[2], 30, aux[2]);
            Rectangle dB = new Rectangle(1300, 600 - aux[3], 30, aux[3]);


            RectTop.Add(aT);
            RectTop.Add(bT);
            RectTop.Add(cT);
            RectTop.Add(dT);
            RectBot.Add(aB);
            RectBot.Add(bB);
            RectBot.Add(cB);
            RectBot.Add(dB);


            X.Add(400);
            X.Add(700);
            X.Add(1000);
            X.Add(1300);


            flappyBird.Location = new Point(55, 144);
            this.MaximumSize    = new Size(1044, 639);
            alive = true;
        }
Exemplo n.º 3
0
        void UpDate()
        {
            if (alive)
            {
                int              lungimeA;
                int              lungimeB;
                Rectangle        a;
                Rectangle        b;
                List <Rectangle> aux  = new List <Rectangle>();
                List <Rectangle> aux1 = new List <Rectangle>();


                for (int i = 0; i < 4; i++)
                {
                    lungimeA = RectTop[i].Height;
                    lungimeB = RectBot[i].Height;

                    X[i] = X[i] - speed;

                    if (X[i] < -30)
                    {
                        a = new Rectangle(1300, 0, 30, rnd.Next(100, 280));
                        int r = 430 - a.Height;
                        b    = new Rectangle(1300, 600 - r, 30, r);
                        X[i] = 1300;
                    }
                    else
                    {
                        a = new Rectangle(X[i], 0, 30, lungimeA);
                        b = new Rectangle(X[i], 600 - lungimeB, 30, lungimeB);
                    }

                    aux.Add(a);
                    aux1.Add(b);
                }
                RectTop = aux;
                RectBot = aux1;
            }
            else
            {
                Ini();
            }
        }