class Beam extends General { boolean missileBeam; //true when the beam is a missile PImage missileBeamImg; Beam(int xPos, int yPos, boolean missile) { super(xPos, yPos); missileBeam = missile; missileBeamImg = loadImage("missile.png"); } //Drawing beams shot by player 1 void drawBeam1() { pushMatrix(); translate(x, y); if (missileBeam) { //draw missiles if the player has in missile mode rotate(PI/2); image(missileBeamImg, -10, -10, 20, 20); } else { //draw normal beams rectMode(CENTER); fill(255, 0, 0); noStroke(); rotate(PI/2); fill(255); stroke(0, 0, 255); strokeWeight(3); rect(0, 0, 5, 30); } popMatrix(); } //Drawing beams shot by player 2 void drawBeam2() { pushMatrix(); translate(x, y); if (missileBeam) { //draw missiles if the player has in missile mode rotate(-PI/2); image(missileBeamImg, -10, -10, 20, 20); } else { //draw normal beams rectMode(CENTER); fill(255, 0, 0); noStroke(); rotate(PI/2); fill(255); stroke(255, 0, 0); strokeWeight(3); rect(0, 0, 5, 30); } popMatrix(); } void setY(int yPos) { y = y + yPos; } void setX(int xPos) { x = x + xPos; } //Removing beams void destroyBeam(ArrayList b) { b.remove(this); } }