Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import processing.core.PApplet;
- public class Board {
- private Tile[][] board = new Tile[8][8];
- private int mouseX, mouseY;
- public Board()
- {
- int y = 0;
- for(int i = 0; i < 8; i++)
- {
- int x = 0;
- for (int j = 0; j < 8; j++)
- {
- board[i][j] = new Tile(x, y, null);
- x += 50;
- }
- y += 50;
- }
- 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);
- }
- }
- }
- }
- }
- public void draw(PApplet drawer)
- {
- for (int y = 0; y < 8; y++)
- {
- for (int x = 0; x < 8; x++)
- {
- board[y][x].draw(drawer);
- }
- }
- }
- public void clicked(int mouseX, int mouseY)
- {
- for (int y = 0; y < 8; y++)
- {
- for (int x = 0; x < 8; x++)
- {
- if (board[x][y].intersects(mouseX, mouseY))
- {
- board[x][y].setFillColor(Color.RED);
- }
- }
- }
- }
- public void move(int pMouseX, int pMouseY)
- {
- if ()
- }
- public Tile[][] getBoard()
- {
- return board;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement