예제 #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();
        }