예제 #1
0
	void MainScene::Init()
	{
		SetPlayer();
		SetBall();
		SetBlock();

		primeDrawTime = GetTickCount() + 4000;
		UiDrawTime = GetTickCount() + 3000;
	}
예제 #2
0
void SetLine(int row, int c1, int c2, int c3, int c4, int c5, int c6)
{
     SetBall(row,1,c1);
     SetBall(row,2,c2);
     SetBall(row,3,c3);
     SetBall(row,4,c4);
     SetBall(row,5,c5);
     SetBall(row,6,c6);          
}
예제 #3
0
void KillBubbles()
{
     
int r,c;
                                
 for(r = 14; r > 0;r--)
  {
   for(c = 6; c > 0;c--)
    {
     if(BallPosition[r][c].colour > 200)
      {
       if(r == 1 || r == 3 || r == 5 || r == 7 || r == 9 || r == 11 || r == 13 || r == 15)
        {
      	 if(BallPosition[r+1][c].occupied == false)                //right up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
 		 if(BallPosition[r][c+1].occupied == false && c < 6)          //right...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r+1][c-1].occupied == false && c > 1)      //left up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r][c-1].occupied == false && c > 1)           //left...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         }//end of r==1...

       if(r == 2 || r == 4 || r == 6 || r == 8 || r == 10 || r == 12 || r == 14)
        {
      	 if(BallPosition[r+1][c+1].occupied == false && c < 6)     //right up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
 		 if(BallPosition[r][c+1].occupied == false && c < 6)          //right...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r+1][c].occupied == false)                 //left up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r][c-1].occupied == false && c > 1)           //left...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
        }//end of r=2...
        
        if(r == 3 || r == 5 || r == 7 || r == 9 || r == 11 || r == 13 || r == 15)
        {
      	 if(BallPosition[r-1][c].occupied == false)                 //down right
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r-1][c-1].occupied == false && c > 1)      //down left
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         }//end of r==1...

       if(r == 2 || r == 4 || r == 6 || r == 8 || r == 10 || r == 12 || r == 14)
        {
      	 if(BallPosition[r-1][c+1].occupied == false && c < 6)      //down right
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r-1][c].occupied == false)                 //down left
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
        }//end of r=2...
        
      }//end if colour > 200...
    }//end for c...
  }//end for r...

 for(r = 0; r < 15;r++)
  {
   for(c = 0; c < 7;c++)
    {
     if(BallPosition[r][c].colour > 200)
      {
       if(r == 1 || r == 3 || r == 5 || r == 7 || r == 9 || r == 11 || r == 13 || r == 15)
        {
      	 if(BallPosition[r+1][c].occupied == false)                //right up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
 		 if(BallPosition[r][c+1].occupied == false && c < 6)          //right...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r+1][c-1].occupied == false && c > 1)      //left up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r][c-1].occupied == false && c > 1)           //left...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         }//end of r==1...

       if(r == 2 || r == 4 || r == 6 || r == 8 || r == 10 || r == 12 || r == 14)
        {
      	 if(BallPosition[r+1][c+1].occupied == false && c < 6)     //right up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
 		 if(BallPosition[r][c+1].occupied == false && c < 6)          //right...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r+1][c].occupied == false)                 //left up...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}        
         if(BallPosition[r][c-1].occupied == false && c > 1)           //left...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}          
        }//end of r=2...
        
        if(r == 3 || r == 5 || r == 7 || r == 9 || r == 11 || r == 13 || r == 15)
        {
      	 if(BallPosition[r-1][c].occupied == false)           	 //down right...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r-1][c-1].occupied == false && c > 1)    //down left...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         }//end of r==1...

       if(r == 2 || r == 4 || r == 6 || r == 8 || r == 10 || r == 12 || r == 14)
        {
      	 if(BallPosition[r-1][c+1].occupied == false && c < 6)   //down right...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
         if(BallPosition[r-1][c].occupied == false)               //down left...
          {SetBall(r,c,0); ReDrawScreen();SDL_Delay(15); SDL_UpdateRect(DisplaySurface,0,0,0,0);}
        }//end of r=2...
        
      }//end if colour > 200...
    }//end for c...
  }//end for r...


  DropAllBalls();
}