Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import balaji.shapes.Rectangle;
- import processing.core.PApplet;
- public class Board {
- Tile[][] board = new Tile[8][8];
- public Board()
- {
- int y = 0;
- boolean black = false;
- for(int i = 0; i < 8; i++)
- {
- black = !black;
- int x = 0;
- for (int j = 0; j < 8; j++)
- {
- board[i][j] = new Tile(x, y, null);
- x += 50;
- }
- y += 50;
- }
- }
- public void draw(PApplet drawer)
- {
- for(int i = 0; i < 8; i++)
- {
- for (int j = 0; j < 8; j++)
- {
- if (i%2 == 0)
- {
- if (j%2 == 0)
- {
- board[i][j].setFillColor(Color.BLACK);
- } else
- {
- board[i][j].setFillColor(Color.WHITE);
- }
- } else
- {
- if (j%2 != 0)
- {
- board[i][j].setFillColor(Color.BLACK);
- } else
- {
- board[i][j].setFillColor(Color.WHITE);
- }
- }
- board[i][j].draw(drawer);
- }
- }
- }
- public Tile[][] getBoard()
- {
- return board;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement