Im making a game for a work on my college, but i got an error.
The game is working good till lvl 3 and kill the boss,and then when u win, and press any key to restart the game, the game restarts ok.... but when you kill the last lvl 1 enemy, it says (null pointer exeption here : enemigo4[i].dibujar();
Hello, im new on processing and im building a simple game like Space Invaders, but i got a problem
The game does not run, it says :
unexpected token: contador
i think that contador have something bad but i cant find it...
ive uploaded the game...
by the way , the game structure i think is not correct... is a total disorder... some one can take a look and correct it so i can see how the game have to be programed?
// termina el contador de regeneracion de enemigos
//Que pasa cuando hacemos un click ?
float posy = 525; class Arma {
float tam;
Arma (float posx_,float tam_){
posx = posx_; tam = tam_;
}
void dibujararma(){
ellipse (posx,posy,tam,tam); strokeWeight(3); line (posx,posy,posx,475);
}
void moverarma(){
if (posx <35){
posx=35;
}
if (posx >765){
posx=765;
}
if (mouseX < posx) {
posx = posx - 5;
}
if (mouseX > posx) {
posx = posx + 5;
} } }
class Enemigos {
float x,y; float tam; float velocidad; boolean vivo = true;
//constructor
Enemigos (float x_, float y_){
x = x_; y = y_; tam= 50; velocidad = random (0.5,1);
}
void mover (){
y += velocidad;
} //se dibujan los enemigos
void dibujar (){
if (vivo){ rectMode( CENTER ); fill (255,0,0); rect (x,y,tam,tam);
} }
void contador {
contador = contador + 10; println (contador);
fill (200); rect (400,0,170,2000); //contador de regeneracion de enemigos for ( int i=0 ; i<cantidad ; i++ ) {
enemigo1[i].dibujar(); enemigo1[i].mover();
}
if (contador >= 5000){
enemigo2[i].dibujar(); enemigo2[i].mover();
}
if (contador >= 10000){
enemigo3[i].dibujar(); enemigo3[i].mover();
}
}
}
class Bala {
Bala (float bx_, float by_){
posbx = bx_; posby = by_;
}
void dibujarbala (){
ellipse (posbx,posby,tambala/2,tambala);}
void dispararbala (){
posby--;}
}
Thanks a lot , THIS IS A GAME FOR A WORK ON MY UNIVERSITY, so its very important, and i havnt been doing the things quite right enought...... so this helps me a lot
Srry for my english, im argentinian (spanish latinoamerican).