"___ is not a constructor" Error message

I have been trying to get an old code I wrote, a long time ago, to work(its probably a mess). And I was wondering why it gives me the error message “[something] is not a constructor”. I do not expect anyone to read my mess of a code, but I would like to know some examples for what could be the issue, and then I will go through the code myself. When I greytext what it says is not a constructor, something else is suddenly not a constructor. At the time (and now) I didnt know what a constructor was, so I shouldnt have used one in the code at all.

“player2” is the first thing that is not a constructor in the error message.

Here is the code if you want to have a quick look(I copied it to docs and back into processing, it was a long time ago, but the reason I get errors may be because I didnt copy everything) :

boolean[] keys;
powerup2 powerup2;
powerup powerup;
player player1;
player2 player2;
int bulletX = 0;
int y = 500;
int ySpeed = 7;
int bulletDisplay = 0;
int xSpeed = 15;
int bulletY = 500;
int y2 = 500;
int bulletX2 = 1500;
int bulletY2 = 500;
int bulletDisplay2 = 0;
int ySpeed2 = 7;
int xSpeed2 = 15;
int playerSize = 20;
Ball b;
PlayerBar PB;
Brick br;
boolean[] keys = keys = new boolean[2];
int gameRun = 1;
void setup() {
  size(600, 500);
 
  b = new Ball();
  PB = new PlayerBar();
  br = new Brick();
 
  keys[0] = false;
  keys[1] = false;
}
void draw() {
  background(0);
  b.display();
  PB.display();
  br.display();
  if (gameRun == 1) {
    b.move();
    b.bounce();
    b.death();
    PB.move();
    PB.limitedSpace();
  }
}

void keyPressed() {
  if (key == 'a') {
    keys[0] = true;
  }
  if (key == 'd') {
    keys[1] = true;
  }
}
void keyReleased() {
  if (key == 'a') {
    keys[0] = false;
  }
  if (key == 'd') {
    keys[1] = false;
  }
}
int player2Size =20;
int bulletSize = 10;
int bullet2Size = 10;
int x = 50;
int x2 = 1450;
int playerKills = 0;
int playerDeaths = 0;
int player2Kills = 0;
int player2Deaths = 0;
float startGame = 0;
void setup() {
size(1500, 1000, P2D);
player1 = new player();
player2 = new player2();
powerup = new powerup();
powerup2 = new powerup2();
keys = new boolean[6];
keys[0]=false;
keys[1]=false;
keys[2]=false;
keys[3]=false;
keys[4]=false;
keys[5]=false;
}

void draw(){
background(0);
fill(70, 70, 70);
ellipse(0, 500,40,40);
ellipse(width, 500,40,40);
if(startGame < 201){
startGame = startGame + 1;
textSize(50);
fill(0,255,0);
text("Get Ready..", width/2-150, height/2-100);
}
player1.display();
player2.display2();
powerup.powerupDisplay();
powerup.powerupSpawn();
powerup2.powerupSpawn();
powerup2.powerupDisplay();

if(startGame > 200){
player1.controls();
player1.shoot();
player1.bullet();
player1.bulletOffScrean();
player1.bulletSpeed();
player1.playerInScreen();
player1.bulletControl();

player2.controls2();
player2.shoot2();
player2.bullet2();
player2.bulletOffScrean2();
player2.bulletSpeed2();
player2.playerInScreen2();
player2.bulletControl2();

powerup.powerupAimbot();
powerup.powerupGet();
powerup.powerupFinished();

powerup.powerupAimbot2();
powerup.powerupFinished2();
powerup.powerupGet2();

powerup2.powerupShot();
powerup2.powerupFinished();
powerup2.powerupGet();

powerup2.powerupShot2();
powerup2.powerupFinished2();
powerup2.powerupGet2();

float d = dist(bulletX, bulletY, x2, y2);
if(d < bulletSize + player2Size){
bulletX = 0;
y = 500;
ySpeed = 5;
bulletDisplay = 0;
xSpeed = 15;
bulletY = 500;
y2 = 500;
bulletX2 = 1500;
bulletY2 = 500;
bulletDisplay2 = 0;
ySpeed2 = 5;
xSpeed2 = 15;
playerSize = 20;
player2Size = 20;
bulletSize = 10;
bullet2Size = 10;
x = 50;
x2 = 1450;
playerKills = playerKills +1;
player2Deaths = player2Deaths +1;
startGame = 150;
 }
 float d2 = dist(bulletX2, bulletY2, x, y);
if(d2 < bullet2Size + playerSize){
bulletX = 0;
y = 500;
ySpeed = 5;
bulletDisplay = 0;
xSpeed = 15;
bulletY = 500;
y2 = 500;
bulletX2 = 1500;
bulletY2 = 500;
bulletDisplay2 = 0;
ySpeed2 = 5;
xSpeed2 = 15;
playerSize = 20;
player2Size = 20;
bulletSize = 10;
bullet2Size = 10;
x = 50;
x2 = 1450;
player2Kills = player2Kills +1;
playerDeaths = playerDeaths +1;
startGame = 150;
 }
 textSize(25);
 fill(0, 255, 0);
 text("Kills:     " + playerKills, 50, 100);
 fill(255, 0, 0);
 text("Deaths:    " + playerDeaths, 50, 125);
 fill(0, 255, 0);
 text("Kills:     " + player2Kills, 1300, 100);
 fill(255, 0, 0);
 text("Deaths:    " + player2Deaths, 1300, 125);
 fill(0, 255, 0);
  if(playerKills > playerDeaths){
  text("RED Player Leads!", 650, 100);
  }
  if(player2Kills > player2Deaths){
   text("BLUE Player Leads!", 650, 100);
  }
 }
  float d3 = dist(bulletX2, bulletY2, bulletX, bulletY);
  if(d3 < bulletSize+bullet2Size){
   bulletDisplay2 = 0;
   bulletX2 = width;
   ySpeed2 = 6;
   bulletY2 = 500;

   bulletDisplay = 0;
   bulletX = 0;
   ySpeed = 6;
   bulletY = 500;
 }
 float d4 = dist(bulletX, bulletY, bulletX2, bulletY2);
 if(d4 < bullet2Size+bulletSize){
    bulletDisplay2 = 0;
   bulletX2 = width;
   ySpeed2 = 6;
   bulletY2 = 500;

   bulletDisplay = 0;
   bulletX = 0;
  ySpeed = 6;
   bulletY = 500;
 }
}

void keyPressed() {
  if(key == 'w')
   keys[0]=true;  
   if(key == 's')
   keys[1]=true;
  if(key == 'q')
   keys[2]=true;
  
  if(keyCode == UP)
   keys[3]=true;
   if(keyCode == DOWN)
   keys[4]=true;
    if(keyCode == LEFT)
   keys[5]=true;
}

void keyReleased() {
  if(key == 'w')
   keys[0]=false; 
   if(key == 's')
   keys[1]=false;  
   if(key == 'q')
   keys[2]=false;

   if(keyCode == UP)
   keys[3]=false;
    if(keyCode == DOWN)
   keys[4]=false;
    if(keyCode == LEFT)
   keys[5]=false;
}

class player {
void display(){
  fill(255, 0, 0);
  ellipse(x, y, playerSize*2, playerSize*2);
 }

 void controls() {
  if(keys[0]) {
   y = y - ySpeed;
  }
  if(keys[1]) {
   y = y + ySpeed;
  }
 }
   void shoot() {
   if(keys[2]) {
   bulletDisplay = 1;
   }
  }
   void bullet() {
   if(bulletDisplay > 0){
   fill(255, 0, 255);
   noStroke();
   ellipse(bulletX, bulletY, bulletSize*2, bulletSize*2);
   }
  }
  void bulletOffScrean() {
   if(bulletX > 1510 || bulletY > height-25 || bulletY < 25) {
   bulletDisplay = 0;
   bulletX = 0;
   ySpeed = 7;
   bulletY = 500;
   }
  } 
   void bulletSpeed(){
   if(bulletDisplay > 0){
  bulletX = bulletX + xSpeed;    
   }
  }
  void playerInScreen() {
   if(y > height-25){
   y = y - 7;
   }
   if(y < 25){
   y = y + 7;
   }
  }
  void bulletControl() {
  if(bulletDisplay > 0) {
  ySpeed = 5;
  if(keys[0]) {
  bulletY = bulletY-5;
  }
  if(keys[1]) {
  bulletY = bulletY+5;
  }
   }
  }
}

class player2 {
void display2(){
  fill(0, 0, 255);
  ellipse(x2, y2, player2Size*2, player2Size*2);
 }

 void controls2() {
  if(keys[3]) {
   y2 = y2 - ySpeed2;
  }
  if(keys[4]) {
   y2 = y2 + ySpeed2;
  }
 }
   void shoot2() {
   if(keys[5]) {
   bulletDisplay2 = 1;
   }
  }
   void bullet2() {
   if(bulletDisplay2 > 0){
   fill(0, 255, 0);
   noStroke();
   ellipse(bulletX2, bulletY2, bullet2Size*2, bullet2Size*2);
   }
  }
  void bulletOffScrean2() {
   if(bulletX2 < -10 || bulletY2 > height-25 || bulletY2 < 25) {
   bulletDisplay2 = 0;
   bulletX2 = width;
   ySpeed2 = 7;
   bulletY2 = 500;
   }
  } 
   void bulletSpeed2(){
   if(bulletDisplay2 > 0){
  bulletX2 = bulletX2 - xSpeed2;    
   }
  }
  void playerInScreen2() {
   if(y2 > height-25){
   y2 = y2 - 7;
   }
   if(y2 < 25){
   y2 = y2 + 7;
   }
  }
  void bulletControl2() {
  if(bulletDisplay2 > 0) {
  ySpeed2 = 5;
  if(keys[3]) {
  bulletY2 = bulletY2-5;
  }
  if(keys[4]) {
  bulletY2 = bulletY2+5;
  }
   }
  }
}


class powerup {
float powerupSpawnTime = 5000;
int powerupSize = 20;
int powerX = 10;
int powerY = 10;
int powerupAimbot = 0;
float powerupFinished = 500;
int powerupAimbot2 = 0;
float powerupFinished2 = 500;
void powerupDisplay() {
 if(powerupSpawnTime <2){
  powerX = width/2;
  powerY = 300;
 fill(random(255), random(255), random(255));
 ellipse(powerX, powerY, powerupSize*2, powerupSize*2);
  }
 }
 void powerupSpawn(){
 if(powerupSpawnTime > 1){
 powerupSpawnTime = powerupSpawnTime -1;
 println("PowerupSpawnTime: "+powerupSpawnTime);
  }
 }
 void powerupGet(){
 float d5 = dist(bulletX2, bulletY2, powerX, powerY);
 if(d5 < powerupSize+bullet2Size){
  powerupAimbot = powerupAimbot +1;
  powerupSpawnTime = 5000;
  }
 }
  void powerupGet2(){
 float d6 = dist(bulletX, bulletY, powerX, powerY);
 if(d6 < powerupSize+bulletSize){
  powerupAimbot2 = 1;
  powerupSpawnTime = 5000;
  }
 }

 void powerupAimbot(){
 if(powerupAimbot > 0){
  bulletY2 = y;
  powerupFinished = powerupFinished -1;
 println("PowerupFinished:  "+powerupFinished);
  powerX = 100;
 powerY = 100;
  }
 }
  void powerupAimbot2(){
 if(powerupAimbot2 > 0){
  bulletY = y2;
  powerupFinished2 = powerupFinished2 -1;
  println("PowerupFinished:  "+powerupFinished2);
  powerX = 100;
  powerY = 100;
  }
 }
 void powerupFinished(){
 if(powerupFinished < 1){
 powerupFinished = 1000;
 bulletY2 = y2;
 powerupAimbot = 0;
 powerX = 10;
 powerY = 10;
 powerupSpawnTime = 5000;
  }
 }
 void powerupFinished2(){
 if(powerupFinished2 < 1){
 powerupFinished2 = 1000;
 bulletY = y;
 powerupAimbot2 = 0;
 powerX = 10;
 powerY = 10;
 powerupSpawnTime = 5000;
  }
 }
}



class powerup2 {
float powerupSpawnTime = 8000;
int powerupSize = 20;
int powerX = 0;
int powerY = 0;
int powerupShot = 0;
float powerupFinished = 500;
int powerupShot2 = 0;
float powerupFinished2 = 500;
void powerupDisplay() {
 if(powerupSpawnTime <2){
  powerX = width/2;
  powerY = 600;
 fill(random(255), random(255), random(255));
 ellipse(powerX, powerY, powerupSize*2, powerupSize*2);
  }
 }
 void powerupSpawn(){
 if(powerupSpawnTime > 1){
 powerupSpawnTime = powerupSpawnTime -1;
 println("PowerupSpawnTimeShot: "+powerupSpawnTime);
  }
 }
 void powerupGet(){
 float d6 = dist(bulletX2, bulletY2, powerX, powerY);
 if(d6 < powerupSize+bullet2Size){
  powerupShot = 1;
  powerupSpawnTime = 5000;
  }
 }
  void powerupGet2(){
 float d7 = dist(bulletX, bulletY, powerX, powerY);
 if(d7 < powerupSize+bulletSize){
  powerupShot2 = 1;
  powerupSpawnTime = 5000;
  }
 }

 void powerupShot(){
 if(powerupShot > 0){
  powerupFinished = powerupFinished -1;
 println("PowerupFinishedShot:  "+powerupFinished);
 fill(0, 255, 0);
 bullet2Size = 30;
  powerX = 100;
  powerY = 100;
  }
 }
 void powerupShot2(){
 if(powerupShot2 > 0){
 fill(255, 0, 255);
  powerupFinished2 = powerupFinished2 -1;
 println("PowerupFinishedShot:  "+powerupFinished);
 fill(255, 0, 255);
 bulletSize = 30;
  powerX = 100;
  powerY = 100;
  }
 }
 void powerupFinished(){
 if(powerupFinished < 1){
 powerupFinished = 1000;
 bullet2Size = 10;
 powerupShot = 0;
 powerX = 10;
 powerY = 10;
 powerupSpawnTime = 5000;
  }
 }
 void powerupFinished2(){
 if(powerupFinished2 < 1){
 powerupFinished2 = 1000;
 bulletSize = 10;
 powerupShot2 = 0;
 powerX = 10;
 powerY = 10;
 powerupSpawnTime = 5000;
  }
 }
}
1 Like

please format your code using

</> code tag

Hello!

You posted 2 sketches: the functions setup() and draw() and keyPressed() are duplicate.

Please post anew.

Also your code formatting is bad.

See code runs (i didn’t have constructor issues though)

Chrisir

int player2Size =20;
int bulletSize = 10;
int bullet2Size = 10;
int x = 50;
int x2 = 1450;

int playerKills = 0;
int playerDeaths = 0;
int player2Kills = 0;
int player2Deaths = 0;

// boolean[] keys;
powerup2 powerup2;
powerup powerup;
player player1;
player2 player2;

float startGame = 0;

boolean[] keys;

int bulletX = 0;
int y = 500;
int ySpeed = 7;
int bulletDisplay = 0;
int xSpeed = 15;
int bulletY = 500;
int y2 = 500;
int bulletX2 = 1500;
int bulletY2 = 500;
int bulletDisplay2 = 0;
int ySpeed2 = 7;
int xSpeed2 = 15;
int playerSize = 20;

void setup() {
  size(1500, 1000, P2D);
  player1 = new player();
  player2 = new player2();
  powerup = new powerup();
  powerup2 = new powerup2();
  keys = new boolean[6];
  keys[0]=false;
  keys[1]=false;
  keys[2]=false;
  keys[3]=false;
  keys[4]=false;
  keys[5]=false;
}

void draw() {
  background(0);
  fill(70, 70, 70);
  ellipse(0, 500, 40, 40);
  ellipse(width, 500, 40, 40);
  if (startGame < 201) {
    startGame = startGame + 1;
    textSize(50);
    fill(0, 255, 0);
    text("Get Ready…", width/2-150, height/2-100);
  }
  player1.display();
  player2.display2();
  powerup.powerupDisplay();
  powerup.powerupSpawn();
  powerup2.powerupSpawn();
  powerup2.powerupDisplay();

  if (startGame > 200) {
    player1.controls();
    player1.shoot();
    player1.bullet();
    player1.bulletOffScrean();
    player1.bulletSpeed();
    player1.playerInScreen();
    player1.bulletControl();

    player2.controls2();
    player2.shoot2();
    player2.bullet2();
    player2.bulletOffScrean2();
    player2.bulletSpeed2();
    player2.playerInScreen2();
    player2.bulletControl2();

    powerup.powerupAimbot();
    powerup.powerupGet();
    powerup.powerupFinished();

    powerup.powerupAimbot2();
    powerup.powerupFinished2();
    powerup.powerupGet2();

    powerup2.powerupShot();
    powerup2.powerupFinished();
    powerup2.powerupGet();

    powerup2.powerupShot2();
    powerup2.powerupFinished2();
    powerup2.powerupGet2();

    float d = dist(bulletX, bulletY, x2, y2);
    if (d < bulletSize + player2Size) {
      bulletX = 0;
      y = 500;
      ySpeed = 5;
      bulletDisplay = 0;
      xSpeed = 15;
      bulletY = 500;
      y2 = 500;
      bulletX2 = 1500;
      bulletY2 = 500;
      bulletDisplay2 = 0;
      ySpeed2 = 5;
      xSpeed2 = 15;
      playerSize = 20;
      player2Size = 20;
      bulletSize = 10;
      bullet2Size = 10;
      x = 50;
      x2 = 1450;
      playerKills = playerKills +1;
      player2Deaths = player2Deaths +1;
      startGame = 150;
    }
    float d2 = dist(bulletX2, bulletY2, x, y);
    if (d2 < bullet2Size + playerSize) {
      bulletX = 0;
      y = 500;
      ySpeed = 5;
      bulletDisplay = 0;
      xSpeed = 15;
      bulletY = 500;
      y2 = 500;
      bulletX2 = 1500;
      bulletY2 = 500;
      bulletDisplay2 = 0;
      ySpeed2 = 5;
      xSpeed2 = 15;
      playerSize = 20;
      player2Size = 20;
      bulletSize = 10;
      bullet2Size = 10;
      x = 50;
      x2 = 1450;
      player2Kills = player2Kills +1;
      playerDeaths = playerDeaths +1;
      startGame = 150;
    }
    textSize(25);
    fill(0, 255, 0);
    text("Kills: " + playerKills, 50, 100);
    fill(255, 0, 0);
    text("Deaths: " + playerDeaths, 50, 125);
    fill(0, 255, 0);
    text("Kills: " + player2Kills, 1300, 100);
    fill(255, 0, 0);
    text("Deaths: " + player2Deaths, 1300, 125);
    fill(0, 255, 0);
    if (playerKills > playerDeaths) {
      text("RED Player Leads!", 650, 100);
    }
    if (player2Kills > player2Deaths) {
      text("BLUE Player Leads!", 650, 100);
    }
  }
  float d3 = dist(bulletX2, bulletY2, bulletX, bulletY);
  if (d3 < bulletSize+bullet2Size) {
    bulletDisplay2 = 0;
    bulletX2 = width;
    ySpeed2 = 6;
    bulletY2 = 500;

    bulletDisplay = 0;
    bulletX = 0;
    ySpeed = 6;
    bulletY = 500;
  }
  float d4 = dist(bulletX, bulletY, bulletX2, bulletY2);
  if (d4 < bullet2Size+bulletSize) {
    bulletDisplay2 = 0;
    bulletX2 = width;
    ySpeed2 = 6;
    bulletY2 = 500;

    bulletDisplay = 0;
    bulletX = 0;
    ySpeed = 6;
    bulletY = 500;
  }
}

void keyPressed() {
  if (key == 'w')
    keys[0]=true;
  if (key == 's')
    keys[1]=true;
  if (key == 'q')
    keys[2]=true;

  if (keyCode == UP)
    keys[3]=true;
  if (keyCode == DOWN)
    keys[4]=true;
  if (keyCode == LEFT)
    keys[5]=true;
}

void keyReleased() {
  if (key == 'w')
    keys[0]=false;
  if (key == 's')
    keys[1]=false;
  if (key == 'q')
    keys[2]=false;

  if (keyCode == UP)
    keys[3]=false;
  if (keyCode == DOWN)
    keys[4]=false;
  if (keyCode == LEFT)
    keys[5]=false;
}

class player {
  void display() {
    fill(255, 0, 0);
    ellipse(x, y, 8, 8);
  }

  void controls() {
    if (keys[0]) {
      y = y - ySpeed;
    }
    if (keys[1]) {
      y = y + ySpeed;
    }
  }
  void shoot() {
    if (keys[2]) {
      bulletDisplay = 1;
    }
  }
  void bullet() {
    if (bulletDisplay > 0) {
      fill(255, 0, 255);
      noStroke();
      ellipse(bulletX, bulletY, 8, 8);
    }
  }
  void bulletOffScrean() {
    if (bulletX > 1510 || bulletY > height-25 || bulletY < 25) {
      bulletDisplay = 0;
      bulletX = 0;
      ySpeed = 7;
      bulletY = 500;
    }
  }
  void bulletSpeed() {
    if (bulletDisplay > 0) {
      bulletX = bulletX + xSpeed;
    }
  }
  void playerInScreen() {
    if (y > height-25) {
      y = y - 7;
    }
    if (y < 25) {
      y = y + 7;
    }
  }
  void bulletControl() {
    if (bulletDisplay > 0) {
      ySpeed = 5;
      if (keys[0]) {
        bulletY = bulletY-5;
      }
      if (keys[1]) {
        bulletY = bulletY+5;
      }
    }
  }
}

class player2 {
  void display2() {
    fill(0, 0, 255);
    ellipse(x2, y2, 8, 8);
  }

  void controls2() {
    if (keys[3]) {
      y2 = y2 - ySpeed2;
    }
    if (keys[4]) {
      y2 = y2 + ySpeed2;
    }
  }
  void shoot2() {
    if (keys[5]) {
      bulletDisplay2 = 1;
    }
  }
  void bullet2() {
    if (bulletDisplay2 > 0) {
      fill(0, 255, 0);
      noStroke();
      ellipse(bulletX2, bulletY2, 9, 9);
    }
  }
  void bulletOffScrean2() {
    if (bulletX2 < -10 || bulletY2 > height-25 || bulletY2 < 25) {
      bulletDisplay2 = 0;
      bulletX2 = width;
      ySpeed2 = 7;
      bulletY2 = 500;
    }
  }
  void bulletSpeed2() {
    if (bulletDisplay2 > 0) {
      bulletX2 = bulletX2 - xSpeed2;
    }
  }
  void playerInScreen2() {
    if (y2 > height-25) {
      y2 = y2 - 7;
    }
    if (y2 < 25) {
      y2 = y2 + 7;
    }
  }
  void bulletControl2() {
    if (bulletDisplay2 > 0) {
      ySpeed2 = 5;
      if (keys[3]) {
        bulletY2 = bulletY2-5;
      }
      if (keys[4]) {
        bulletY2 = bulletY2+5;
      }
    }
  }
}

class powerup {
  float powerupSpawnTime = 5000;
  int powerupSize = 20;
  int powerX = 10;
  int powerY = 10;
  int powerupAimbot = 0;
  float powerupFinished = 500;
  int powerupAimbot2 = 0;
  float powerupFinished2 = 500;
  void powerupDisplay() {
    if (powerupSpawnTime <2) {
      powerX = width/2;
      powerY = 300;
      fill(random(255), random(255), random(255));
      ellipse(powerX, powerY, 8, 8);
    }
  }
  void powerupSpawn() {
    if (powerupSpawnTime > 1) {
      powerupSpawnTime = powerupSpawnTime -1;
      println("PowerupSpawnTime: "+powerupSpawnTime);
    }
  }
  void powerupGet() {
    float d5 = dist(bulletX2, bulletY2, powerX, powerY);
    if (d5 < powerupSize+bullet2Size) {
      powerupAimbot = powerupAimbot +1;
      powerupSpawnTime = 5000;
    }
  }
  void powerupGet2() {
    float d6 = dist(bulletX, bulletY, powerX, powerY);
    if (d6 < powerupSize+bulletSize) {
      powerupAimbot2 = 1;
      powerupSpawnTime = 5000;
    }
  }

  void powerupAimbot() {
    if (powerupAimbot > 0) {
      bulletY2 = y;
      powerupFinished = powerupFinished -1;
      println("PowerupFinished: "+powerupFinished);
      powerX = 100;
      powerY = 100;
    }
  }
  void powerupAimbot2() {
    if (powerupAimbot2 > 0) {
      bulletY = y2;
      powerupFinished2 = powerupFinished2 -1;
      println("PowerupFinished: "+powerupFinished2);
      powerX = 100;
      powerY = 100;
    }
  }
  void powerupFinished() {
    if (powerupFinished < 1) {
      powerupFinished = 1000;
      bulletY2 = y2;
      powerupAimbot = 0;
      powerX = 10;
      powerY = 10;
      powerupSpawnTime = 5000;
    }
  }
  void powerupFinished2() {
    if (powerupFinished2 < 1) {
      powerupFinished2 = 1000;
      bulletY = y;
      powerupAimbot2 = 0;
      powerX = 10;
      powerY = 10;
      powerupSpawnTime = 5000;
    }
  }
}

class powerup2 {
  float powerupSpawnTime = 8000;
  int powerupSize = 20;
  int powerX = 0;
  int powerY = 0;
  int powerupShot = 0;
  float powerupFinished = 500;
  int powerupShot2 = 0;
  float powerupFinished2 = 500;

  void powerupDisplay() {
    if (powerupSpawnTime <2) {
      powerX = width/2;
      powerY = 600;
      fill(random(255), random(255), random(255));
      ellipse(powerX, powerY, 9, 9);
    }
  }
  void powerupSpawn() {
    if (powerupSpawnTime > 1) {
      powerupSpawnTime = powerupSpawnTime -1;
      println("PowerupSpawnTimeShot: "+powerupSpawnTime);
    }
  }
  void powerupGet() {
    float d6 = dist(bulletX2, bulletY2, powerX, powerY);
    if (d6 < powerupSize+bullet2Size) {
      powerupShot = 1;
      powerupSpawnTime = 5000;
    }
  }
  void powerupGet2() {
    float d7 = dist(bulletX, bulletY, powerX, powerY);
    if (d7 < powerupSize+bulletSize) {
      powerupShot2 = 1;
      powerupSpawnTime = 5000;
    }
  }

  void powerupShot() {
    if (powerupShot > 0) {
      powerupFinished = powerupFinished -1;
      println("PowerupFinishedShot: "+powerupFinished);
      fill(0, 255, 0);
      bullet2Size = 30;
      powerX = 100;
      powerY = 100;
    }
  }
  void powerupShot2() {
    if (powerupShot2 > 0) {
      fill(255, 0, 255);
      powerupFinished2 = powerupFinished2 -1;
      println("PowerupFinishedShot: "+powerupFinished);
      fill(255, 0, 255);
      bulletSize = 30;
      powerX = 100;
      powerY = 100;
    }
  }
  void powerupFinished() {
    if (powerupFinished < 1) {
      powerupFinished = 1000;
      bullet2Size = 10;
      powerupShot = 0;
      powerX = 10;
      powerY = 10;
      powerupSpawnTime = 5000;
    }
  }
  void powerupFinished2() {
    if (powerupFinished2 < 1) {
      powerupFinished2 = 1000;
      bulletSize = 10;
      powerupShot2 = 0;
      powerX = 10;
      powerY = 10;
      powerupSpawnTime = 5000;
    }
  }
}
//
1 Like

I only had access to the open processing website when I posted this. I copied your code and run it in the application instead and it worked.

I really appreciate your help! :smiley:

1 Like