Advertisement
ffpaladin

Breakout00 Red Bricks

Jul 10th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.  
  2.    
  3.     public void run() {
  4.         addBricks();
  5.     }
  6.    
  7.   //=============
  8.    
  9.     private void addBricks() {
  10.         for (int i = 0; i<NBRICK_ROWS; i++) {
  11.             //Color color = getColorForRow(i);
  12.             addRow(BRICK_SEP/2,BRICK_Y_OFFSET + i*(BRICK_HEIGHT + BRICK_SEP), new Color(255,0,0)) ;
  13.         }
  14.     }
  15.    
  16.     private void addRow(int rowX, int rowY, Color color) {
  17.         for(int i= 0; i< NBRICKS_PER_ROW; i++ ) {
  18.            
  19.             int brickX = rowX + (i* BRICK_SEP) + (i* BRICK_WIDTH);
  20.            
  21.             GRect rect = new GRect (brickX, rowY, BRICK_WIDTH, BRICK_HEIGHT);
  22.            
  23.             rect.setFilled(true) ;
  24.             rect.setColor(color);
  25.             rect.setFillColor(color);
  26.             add(rect);
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement