Beispiel #1
0
        void checkBirdImpact(Colums colTemp)
        {
            //Lấy chim ra
            birdX = bird.getBird().Location.X;
            birdY = bird.getBird().Location.Y;

            //Cột dưới
            colBotomX = colTemp.getColBotom().Location.X;
            colBotomY = colTemp.getColBotom().Location.Y;

            if (
                (colBotomX <= birdX + 33 && birdY + 28 >= colBotomY) &&
                birdX <= colBotomX + 43
                )
            {
                timerColum.Enabled  = false;
                timerOfBird.Enabled = false;
            }
            //Cột trên
            colTopX = colTemp.getColTop().Location.X;
            colTopY = colTemp.getColTop().Location.Y;

            if (
                (colTopX <= birdX + 33 && birdY <= colTopY + colTemp.getColTop().Height) &&
                birdX <= colTopX + 43
                )
            {
                timerColum.Enabled  = false;
                timerOfBird.Enabled = false;
            }
        }
Beispiel #2
0
        void circleLifeColums(Colums before, Colums current)
        {
            pointBrefore = before.getColBotom().Location.X + before.getColBotom().Width + 100;
            if (current.getColBotom().Location.X + 43 <= 0)
            {
                temp          = current.getColBotom();
                temp.Location = new Point(pointBrefore, rd.Next(110, 234));

                current.setColBotom(temp);
            }
        }
Beispiel #3
0
        Colums defineColum(int distance)
        {
            PictureBox colBotom = new PictureBox();

            colBotom.Location  = new System.Drawing.Point(distance, rd.Next(110, 234));
            colBotom.Image     = new Bitmap(Application.StartupPath + @"./cotDuoi.png");
            colBotom.SizeMode  = PictureBoxSizeMode.AutoSize;
            colBotom.BackColor = Color.Transparent;
            panel1.Controls.Add(colBotom);

            PictureBox colTop = new PictureBox();

            colTop.Image     = new Bitmap(Application.StartupPath + @"./cotTren.png");
            colTop.SizeMode  = PictureBoxSizeMode.AutoSize;
            colTop.BackColor = Color.Transparent;
            panel1.Controls.Add(colTop);

            Colums col = new Colums(colTop, colBotom);

            return(col);
        }
Beispiel #4
0
 void columMove(Colums col)
 {
     col.getColBotom().Left -= 1;
     col.getColTop().Left   -= 1;
 }
Beispiel #5
0
 void defineColums()
 {
     col1 = defineColum(300);
     col2 = defineColum(col1.getColBotom().Location.X + col1.getColBotom().Width + 100);
     col3 = defineColum(col2.getColBotom().Location.X + col2.getColBotom().Width + 100);
 }