示例#1
0
文件: Form1.cs 项目: tfgui2/CS_test
 private void CheckPad(MyPad pad, MyBall ball)
 {
     if (pad.CheckInter(ball))
     {
         ball.velo.Y = -2;
     }
 }
示例#2
0
文件: Form1.cs 项目: tfgui2/CS_test
 private void CheckRightWall(MyBall ball)
 {
     if (ball.pos.X >= stageWidth)
     {
         ball.velo.X = -2;
     }
 }
示例#3
0
文件: Form1.cs 项目: tfgui2/CS_test
 private void CheckTopWall(MyBall ball)
 {
     if (ball.pos.Y <= 0)
     {
         ball.velo.Y = 2;
     }
 }
示例#4
0
文件: Form1.cs 项目: tfgui2/CS_test
 private void CheckLeftWall(MyBall ball)
 {
     if (ball.pos.X <= 0)
     {
         ball.velo.X = 2;
     }
 }
示例#5
0
文件: Form1.cs 项目: tfgui2/CS_test
        private void CheckBottom(MyBall ball)
        {
            if (ball.pos.Y > pad.pos.Y + 10)
            {
                gameEnd = true;

                MessageBox.Show("game end");
            }
        }
示例#6
0
文件: Form1.cs 项目: tfgui2/CS_test
 private void CheckBlocks(MyBall ball)
 {
     for (int j = 0; j < 2; j++)
     {
         for (int i = 0; i < 5; i++)
         {
             blocks[i, j].Check(ball);
         }
     }
 }
示例#7
0
文件: MyBlock.cs 项目: tfgui2/CS_test
        public void Check(MyBall ball)
        {
            if (hide)
            {
                return;
            }

            if (this.CheckInter(ball))
            {
                hide        = true;
                ball.velo.X = -ball.velo.X;
                ball.velo.Y = -ball.velo.Y;
            }
        }
示例#8
0
文件: Form1.cs 项目: tfgui2/CS_test
        private void Form1_Load(object sender, EventArgs e)
        {
            pad    = new MyPad();
            ball   = new MyBall();
            blocks = new MyBlock[5, 2];
            for (int j = 0; j < 2; j++)
            {
                for (int i = 0; i < 5; i++)
                {
                    blocks[i, j] = new MyBlock();
                }
            }

            this.ResetPosition();

            timer1.Start();
        }