need help with pacman game!!
1.how to draw a corridor for pacman in corridor class??:confused:
(the code is given below)
corridor class:
import java.awt.*;
public class Corridor {
private int startX, startY, length;
private boolean isHorizontal;
public Corridor(int x, int y, int length, boolean isHorizontal) {
}
}
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// METHOD FOR CHECKING IF PARAMETER POSITION, x, y,
// IS ON THE CORRIDOR
//-------------------------------------------------------------------
public boolean isOnCorridor(int x, int y) {
return false;
}
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// METHOD FOR DRAWING A SINGLE CORRIDOR OBJECT
//-------------------------------------------------------------------
public void drawCorridor(Graphics g) {
}
}
constants:
import java.awt.*;
public class A3Constants {
private static final int CORRIDORS_TOP = 40;
private static final int CORRIDORS_LEFT = 40;
private static final int CORRIDORS_MAX_LENGTH = 510;
public static final int OUTER_EDGE = 10;
public static final int INNER_EDGE = 10;
public static final int BOTTOM_EDGE = 60;
public static final int WINDOW_WIDTH = CORRIDORS_MAX_LENGTH + OUTER_EDGE * 2 + INNER_EDGE * 2;
public static final int WINDOW_HEIGHT = CORRIDORS_MAX_LENGTH + OUTER_EDGE * 2 + INNER_EDGE * 2 + BOTTOM_EDGE;
public static final int[] HORIZONTAL_CORRIDORS_DATA = {
200,200,150,
200,300,150,
50,500,450
};
public static final int[] VERTICAL_CORRIDORS_DATA = {
300,150,150,
350,250,250,
250,450,50
};
//-------------------------------------------------------------------
// There are 3 values to define one corridor, therefore the number
// of corridors is equal to the length divide by 3.
//-------------------------------------------------------------------
public static final int NUMBER_OF_HORIZONTAL_CORRIDORS = HORIZONTAL_CORRIDORS_DATA.length / 3;
public static final int NUMBER_OF_VERTICAL_CORRIDORS = VERTICAL_CORRIDORS_DATA.length / 3;
public static final int TOTAL_NUMBER_OF_CORRIDORS = NUMBER_OF_HORIZONTAL_CORRIDORS + NUMBER_OF_VERTICAL_CORRIDORS;