Hello I am trying to create Pacman the game and I am stuck. I am starting to work on the consumables but I keep getting a null pointer error. I am using a PSape function with an array to create the two different kinds of eatables. It seems when ever the shape function tries to call on the array eats[] it returns a NPR. There is a good chance this is relatively simple but I figured I would ask.
Also, apologies if I am not posting to a specific layout, I am relatively knew to coding and this forum.
//declare varibales
GameControl gc;
Map map;
void setup() {
size(640, 480);
gc= new GameControl();
map= new Map();
imageMode(CENTER);
}//setup
void draw() {
println("x-axis "+gc.plyr.x);
println("y-axis "+gc.plyr.y);
map.display();
gc.runGame();
}//draw
void keyPressed() {
if (keyCode==LEFT) {
if (map.collideMap(gc.plyr.x-20, gc.plyr.y)) {
gc.plyr.move(0);
}//checking true or false boolean
}//move left
if (keyCode==RIGHT) {
if (map.collideMap(gc.plyr.x+20, gc.plyr.y)) {
gc.plyr.move(1);
}
}//move right
if (keyCode==UP) {
if (map.collideMap(gc.plyr.x, gc.plyr.y-20)) {
gc.plyr.move(2);
}
}//move up
if (keyCode==DOWN) {
if (map.collideMap(gc.plyr.x, gc.plyr.y+20)) {
gc.plyr.move(3);
}
}//move down
}//keypressed
class Collectables {
int xpos, ypos, numofcirc, circsize, circ2size, spacing;