import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;
public class Board extends JPanel {
Pacman pacman;
Ghost ghost;
int blockSize = 24;
Color wallColor = Color.blue;
int [][] board ={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1},
{1,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1},
{1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
public Board() {
setBackground(Color.BLACK);
//addKeylistener(keyListener);
}
public void makeMaze(Graphics g){
int x,y;
for (x=0; x<16; x+=blockSize)
{
for (y=0; y<board.length; y+=blockSize)
{
{
if(board[x][y]==1)
{
g.drawRect(x+16*blockSize,y+16*blockSize,blockSize, blockSize);
g.setColor(wallColor);
//draw the walls as lines first (maybe rects not sure yet)
}
}
}
}
}
public void playGame(){
//if (dead){
//pacman.death();(pacman is dead display how he died i.e by hitting ghosts!) intersection
//}else {
//pacman.MovePacman(); (Moves pacman around with the directions of the board);
//pacman.DrawPacman(); (draws pacman as a drawOval(10,10,10,10)) in the pacman class
//ghost.MoveGhost(); (move the ghosts in random directions)
//checkMaze(); (checks wether dots are eaten or not)
//}
}
public void paint(Graphics g)
{
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
makeMaze(g2d);
g.dispose();
}
}