A problem with Processing code
in
Programming Questions
•
1 years ago
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?
I post the game in code for the ones that cant download the file: http://www.mediafire.com/file/wvy7l4u22yn5r6m/TankLand.rar
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).
THANKS!
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?
I post the game in code for the ones that cant download the file: http://www.mediafire.com/file/wvy7l4u22yn5r6m/TankLand.rar
- // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
// OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
// OOOOOOOOO0000000000000TANKLAND00000000OOOOOOOOOOOO
// OOOOOOOOOOOOOOOTANKLANDOOOOOOOOOOOOOOOOOOOOOOOOO00
// OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
// OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
// OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
//decalracion de variables
Enemigos enemigo1[], enemigo2[], enemigo3[];
Arma arma1;
Bala bala;
float tambala = 10;
int cantidad = 10;
int contador = 1;
int tamArma = 50;
float posx=400;
float posbx;
float posby;
boolean disparo = false;
void setup (){
smooth ();
size (800,600);
// se define la cantidad de enemigos
bala = new Bala (posbx,posby);
arma1 = new Arma (posx, tamArma);
enemigo1 = new Enemigos[ cantidad ];
enemigo2 = new Enemigos[ cantidad ];
enemigo3 = new Enemigos[ cantidad ];
for ( int i=0 ; i<cantidad ; i++ ) {
enemigo1[i] = new Enemigos ( i+random(25,775), 25);
enemigo2[i] = new Enemigos ( i*90+170, 25);
enemigo3[i] = new Enemigos ( i*90+170, 25);
}
}
void draw (){
background (0,100,0);
//Se dibujan los enemigos
//----------------------------------------
//Se ejecutan los dibujar / Mover
bala.dibujarbala();
// Cuando se dispara la bala ?
if (disparo = true) {
bala.dispararbala ();
}else{
posbx = posx;
posby = posy-40;
}
arma1.dibujararma();
arma1.moverarma();
Enemigos.contador();
}
// 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).
THANKS!
1