I need help writing pacman with NGP for a school lab. I just started with java. I am NOT trying to have the project written for me, just need help getting started. There are two classes and an interface we need to use listed on the site below. The game board pieces are in the BoardPositions class(on site below) and i am not sure how to get them out of the array list and on to the drawing panel. The following for loop is what i am supposed to use:

for(Position p: BoardPositions.WALLS){
_gameBoard.put(p,new WallCell(this,p));
}

I am not sure what would be in the put method and what should be in the WallCell class. I also need to store the game board in a hashmap for later use and need to know how. I realize this is not the best description of the problem but am not sure how else to ask. If anyone would be interested in helping me i can give you more information.The site for the pacman classes is here and the site for the project description is below that. Thanks.

http://www.cse.buffalo.edu/faculty/adrienne/SP2006/cse115/Resources/115Classlibs/JavaDoc/
http://www.cse.buffalo.edu/faculty/adrienne/SP2006/cse115/Labs/Lab8/index.shtml

I will also post what i have so far if you want to look.

Please post what you have so far. Thanks!

public class GameBoard extends DrawingPanel implements Cell{
 
private java.util.HashMap<Position, BoardPositions> _hashMap;
private BoardPositions _bp;
 
public GameBoard(Container container, Game game) {
super(container);
this.setColor(java.awt.Color.black);
this.setDimension(new java.awt.Dimension(COLUMN_NUMBER * CELL_SIZE, ROW_NUMBER * CELL_SIZE));
 
_hashMap = new java.util.HashMap<Position, BoardPositions>();
 
}
 
public void createBoard(){
 
for(Position p: BoardPositions.WALLS){
this.put(p,new WallCell(this,p));
}
}
private void put(Position p, WallCell cell) {
 
}
}
 
 
public class Game extends Column {
 
private GameBoard _gB;
 
public Game(Container container) {
super(container);
this.setColor(java.awt.Color.black);
 
_gB = new GameBoard(this, this);
 
NGP.Containers.Row row = new NGP.Containers.Row(this);
StartButton st = new StartButton(row, this);
row.setColor(java.awt.Color.black);
}
 
public void start(){
_gB.createBoard();
}
}
 
 
public class WallCell {
 
private GameBoard _board;
private Position _position;
public WallCell(GameBoard board, Position p) {
super();
_board = board;
_position = p;
}
}
 
 
public interface Cell extends Constants {
public static final int COLUMN_NUMBER = 19;
public static final int ROW_NUMBER = 24;
}
 
 
public class StartButton extends PushButton {
private Game _game;
 
public StartButton(Container container, Game game) {
super(container, "Start");
}
 
public void release(){
_game.start();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.