import java.awt.*;
import java.awt.event.*;
Robot robot;
int bNum = 20/*, confNum = 20*/;
int x,y;
int angleZ = 0;
float z,angleX,angleY;
float colourR = random(0,255),colourG = random(0,255),colourB = random(0,255);
float changeR = random(.1,1),changeB = random(.1,1),changeG = random(.1,1);
float eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ;
boolean moveBack = false, moveForward = false, moveLeft = false, moveRight = false, moveUp = false, moveDown = false, camUp = false, camDown = false, camLeft = false, camRight = false,shooting = false, onPlat = false;
PVector[] ballP = new PVector[bNum];//, confP = new PVector[confNum];
PVector[] ballV = new PVector[bNum];//, confV = new PVector[confNum];
int movespeed = 50, yVelocity = 0, yAcceleration = 0;
float sensitivity = .70, firerate = .1, threshold = 1, rampUp = 0;
int gX = 10000, gY = 50, gZ = 10000, distTerrain = 100, rowNum = gX /distTerrain, colNum = gZ /distTerrain ,terrainNum = rowNum * colNum, score = 0;;
int rN = 1000;
float rX[] = new float[rN];
float rY[] = new float[rN];
float rZ[] = new float[rN];
float rS[] = new float[rN];
boolean fireS [];
int [] [] terrainColour = new int [rowNum] [colNum];
PVector targetP = new PVector(random(-gX/2,gX/2),random(-6000,-1000),random(-gZ/2,gZ/2));
void setup(){
fullScreen(P3D);
x= width/2;
y = height/2;
z = 0;
sphereDetail(8,8);
eyeX = width/2 +2000;
eyeY = height/2 -1000;
eyeZ = (height/2.0) / tan(PI*30.0 / 180.0);
centerX = width/2+2000;
centerY = height/2-1000;
centerZ = 0;
upX = 0;
upY = 1;
upZ = 0;
fireS = new boolean[bNum];
for(int b = 0; b <= bNum - 1; b++){
ballP[b] = new PVector(0,0,0);
ballV[b] = new PVector(0,0,0);
fireS[b] = false;
}
/*for(int b = 0; b <= confNum - 1; b++){
confP[b] = new PVector(eyeX,eyeY,eyeZ);
confV[b] = new PVector(0,random(2,4),0);
}*/
for(int n = 0; n <= rN -1; n++){
rY[n] = random(-2500,500);
rX[n] = random(-2500,2500);
rZ[n] = random(-2500,2500);
rS[n] = random(10,25);
}
for(int p = 0; p < rowNum; p++){
for(int q = 0; q < colNum; q++){
//terrainColour[p][q] = int(random(200,255));
terrainColour[p][q] = int( sin(p) * sin(q) * 255);
}
}
noCursor();
try {
robot = new Robot();
robot.setAutoDelay(0);
}
catch (Exception e) {
e.printStackTrace();
}
}
void draw(){
yVelocity = constrain(yVelocity,-100,500);
angleX = constrain(angleX, radians(-75), radians(75));
background(0,200,255);
centerBot();
cameraMove();
translate(eyeX,eyeY,eyeZ);
rotateX(angleX);
rotateY(angleY);
translate(-eyeX,-eyeY,-eyeZ);
translate(width/2,height/2,0);
ambientLight(120, 120, 120, 0, 0, 0);
directionalLight(120,120,120,0,1,0);
colourChange();
translate(-width/2,-height/2,0);
box(16000);
// trail();
bullet();
shoot();
rectMode(CENTER);
ground();
stuff();
detectPlat();
target();
yVelocity += yAcceleration;
eyeY += yVelocity;
centerY += yVelocity;
if(!onPlat){
yAcceleration = 3;
}
else if(onPlat){
yAcceleration = 0;
yVelocity = 0;
}
}
void cameraMove(){
eyeX = constrain(eyeX,-8000,8000);
centerX = constrain(centerX,-8000,8000);
// eyeZ = constrain(eyeZ,-8000,8000);
//centerZ = constrain(centerZ,-8000,8000);
float cameraZ = ((height/2.0) / tan(PI*60.0/360.0));
perspective(PI/3.0, width/height, cameraZ/10.0, cameraZ*50.0);
camera(eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ);
crosshair();
if(moveBack){
eyeZ -= cos(angleY) * movespeed;
centerZ -= cos(angleY) * movespeed;
eyeX += sin(angleY) * movespeed;
centerX += sin(angleY) * movespeed;
}
if(moveForward){
eyeZ += cos(angleY) * movespeed;
centerZ += cos(angleY) * movespeed;
eyeX -= sin(angleY) * movespeed;
centerX -= sin(angleY) * movespeed;
}
if(moveLeft){
eyeX -= cos(angleY) * movespeed;
centerX -= cos(angleY) * movespeed;
eyeZ -= sin(angleY) * movespeed;
centerZ -= sin(angleY) * movespeed;
}
if(moveRight){
eyeX += cos(angleY) * movespeed;
centerX += cos(angleY) * movespeed;
eyeZ += sin(angleY) * movespeed;
centerZ += sin(angleY) * movespeed;
}
if(moveUp){
//eyeY -=movespeed;
//centerY -= movespeed;
if(yVelocity == 0){
yVelocity -= 50;
}
}
if(moveDown){
eyeY +=movespeed;
centerY += movespeed;
}
}
void centerBot(){
if(mouseX >= width/2 + 1){
angleY += radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
if (mouseX <= width/2 - 1){
angleY -= radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
if (mouseY >= height/ 2 + 1){
angleX -= radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
if (mouseY <= height/2 - 1){
angleX +=radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
}
void stuff(){
fill(255-colourR,255-colourG,255-colourB);
textSize(500);
pushMatrix();
textMode(CENTER);
rotateY(radians(angleZ));
text("Score:", 0,-1500);
text(score,0,-1000);
angleZ++;
popMatrix();
strokeWeight(5);
stroke(255,0,255);
for(int n = 0; n <= rN -1; n++){
rY[n] += rS[n];
line(rX[n],rY[n],rZ[n],rX[n],rY[n]-5,rZ[n]);
if(rY[n] >= 500){
rY[n] = -5000;
rX[n] = random(-5000,5000);
rZ[n] = random(-5000,5000);
}
}
}
void ground(){
strokeWeight(2);
translate(0,1000,0);
for(int p = 0; p < rowNum; p++){
for(int q = 0; q < colNum; q++){
if(p >= rowNum /3 && p <= 2 * rowNum/3 && q >= colNum /3 && q <= 2 * colNum/3){
fill(terrainColour[p][q],sin(q)* 255,sin(p) * 255,0);
}
else{
fill(sin(p) * 255,sin(q)* 255,terrainColour[p][q]);
}
pushMatrix();
translate(-gX/2 + p * distTerrain,0,-gZ/2 + q * distTerrain);
box(distTerrain,gY,distTerrain);
popMatrix();
}
}
}
void crosshair(){
translate(centerX,centerY,centerZ);
strokeWeight(1);
stroke(100,255,255);
beginShape();
vertex(0,0,0);
vertex(0,10,0);
vertex(0,-10,0);
vertex(0,0,0);
vertex(-10,0,0);
vertex(10,0,0);
endShape(POINTS);
noStroke();
translate(-centerX,-centerY,-centerZ);
}
/* void trail(){
stroke(colourR,colourG,colourB);
strokeWeight(2);
for(int d = 0; d < confNum; d++){
line(confP[d].x,confP[d].y,confP[d].z,confP[d].x,confP[d].y + 5,confP[d].z);
confP[d].add(confV[d]);
if(d >= 1){
line(confP[d].x,confP[d].y,confP[d].z,confP[d-1].x,confP[d-1].y,confP[d-1].z);
}
if(confP[d].y >= eyeY + 200||confP[d].y <= eyeY - 200){
confP[d].x = eyeX;
confP[d].y = eyeY ;
confP[d].z = eyeZ;
}
}
}*/
void target(){
pushMatrix();
translate(targetP.x,targetP.y,targetP.z);
noStroke();
fill(255,0,0);
box(600);
popMatrix();
}
void bullet(){
for( int c = 0; c < bNum; c++){
pushMatrix();
translate(ballP[c].x,ballP[c].y,ballP[c].z);
float op = dist(0,0,0,targetP.x - ballP[c].x,targetP.y - ballP[c].y + 1000,targetP.z - ballP[c].z);
if(fireS[c]){
fill(0,0,0);
// println(op);
}
else{
noFill();
}
noStroke();
sphere(5);
if(ballP[c].x >= gX - 5 || ballP[c].x <= -gX + 5|| ballP[c].z >= gZ- 5 || ballP[c].z <= -gZ + 5 || ballP[c].y <= -600 * gY - 512.5|| ballP[c].y >= gY + 512.5 ){
rampUp--;
threshold--;
fireS[c] = false;
}
if(op <= 300){
targetP.set(random(-gX/2,gX/2),random(-6000,-1000),random(-gZ/2,gZ/2));
stroke(255);
line(0,0,0,targetP.x - ballP[c].x,targetP.y - ballP[c].y + 1000,targetP.z - ballP[c].z);
score++;
}
ballP[c].add(ballV[c]);
popMatrix();
}
}
void shoot(){
if(shooting){
rampUp += firerate;
}
for(int c = 0; c < bNum; c++){
rampUp = constrain(rampUp,0,bNum);
threshold = constrain(threshold,1,bNum + 1);
if(shooting){
if(fireS[c]){
if(ballV[c].x == 0 && ballV[c].y == 0 && ballV[c].z == 0 ){
ballV[c].set(cos(angleX)* sin(angleY)*200,sin(angleX) * -200,cos(angleX) * cos(angleY)*-200);
}
}
}
if(!fireS[c]){
ballP[c].set(eyeX,eyeY,eyeZ);
ballV[c].set(0,0,0);
if(rampUp >= threshold){
fireS[c] = true;
threshold++;
}
}
if(rampUp <= threshold - 1){
threshold--;
}
}
if(!shooting){
rampUp = 0;
threshold = 1;
}
}
void detectPlat(){
if(eyeX >= -gX /2 && eyeX <= gX/2 && eyeZ >= -gZ /2 && eyeZ <= gZ/2 && eyeY >= 0 && eyeY <= 1000){
if(eyeX >= -1500 && eyeX <=1500 && eyeZ >= -1500 && eyeZ <= 1500){
onPlat = false;
}
else{
onPlat = true;
}
}
else{
onPlat = false;
}
if(eyeY >= 8000){
eyeY = -6000;
centerY = -6000;
}
}
void colourChange(){
if(colourB <= 0 || colourB >= 255){
changeB *= -1;
}
if(colourR <= 0 || colourR >= 255){
changeR *= -1;
}
if(colourG <= 0 || colourG >= 255){
changeG *= -1;
}
colourG += changeG;
colourB += changeB;
colourR += changeR;
fill(colourR,colourG,colourB);
//noFill();
noStroke();
// stroke(colourR,colourG,colourB);
}
void keyPressed(){
if(key == 'r'){
eyeX = width/2+2000;
eyeY = height/2-1000;
eyeZ = (height/2.0) / tan(PI*30.0 / 180.0);
centerX = width/2+2000;
centerY = height/2-1000;
centerZ = 0;
shooting = false;
score = 0;
}
if(key == 'w'){
moveBack = true;
}
if(key == 's'){
moveForward = true;
}
if(key == 'a'){
moveLeft = true;
}
if(key == 'd'){
moveRight = true;
}
if(key == ' '){
moveUp = true;
}
if(key == CODED){
if(keyCode == SHIFT){
if(eyeY>= 100){
// moveDown = true;
}
}
}
}
void keyReleased(){
if(key == 'w'){
moveBack = false;
}
if(key == 's'){
moveForward = false;
}
if(key == 'a'){
moveLeft = false;
}
if(key == 'd'){
moveRight = false;
}
if(key == ' '){
moveUp = false;
}
if(key == CODED){
if(keyCode == SHIFT){
moveDown = false;
}
}
}
void mousePressed(){
for(int c = 0; c <= bNum - 1; c++){
ballP[c].set(eyeX,eyeY,eyeZ);
ballV[c].set(0,0,0);
shooting = true;
}
}
void mouseReleased(){
shooting = false;
}
import java.awt.event.*;
Robot robot;
int bNum = 20/*, confNum = 20*/;
int x,y;
int angleZ = 0;
float z,angleX,angleY;
float colourR = random(0,255),colourG = random(0,255),colourB = random(0,255);
float changeR = random(.1,1),changeB = random(.1,1),changeG = random(.1,1);
float eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ;
boolean moveBack = false, moveForward = false, moveLeft = false, moveRight = false, moveUp = false, moveDown = false, camUp = false, camDown = false, camLeft = false, camRight = false,shooting = false, onPlat = false;
PVector[] ballP = new PVector[bNum];//, confP = new PVector[confNum];
PVector[] ballV = new PVector[bNum];//, confV = new PVector[confNum];
int movespeed = 50, yVelocity = 0, yAcceleration = 0;
float sensitivity = .70, firerate = .1, threshold = 1, rampUp = 0;
int gX = 10000, gY = 50, gZ = 10000, distTerrain = 100, rowNum = gX /distTerrain, colNum = gZ /distTerrain ,terrainNum = rowNum * colNum, score = 0;;
int rN = 1000;
float rX[] = new float[rN];
float rY[] = new float[rN];
float rZ[] = new float[rN];
float rS[] = new float[rN];
boolean fireS [];
int [] [] terrainColour = new int [rowNum] [colNum];
PVector targetP = new PVector(random(-gX/2,gX/2),random(-6000,-1000),random(-gZ/2,gZ/2));
void setup(){
fullScreen(P3D);
x= width/2;
y = height/2;
z = 0;
sphereDetail(8,8);
eyeX = width/2 +2000;
eyeY = height/2 -1000;
eyeZ = (height/2.0) / tan(PI*30.0 / 180.0);
centerX = width/2+2000;
centerY = height/2-1000;
centerZ = 0;
upX = 0;
upY = 1;
upZ = 0;
fireS = new boolean[bNum];
for(int b = 0; b <= bNum - 1; b++){
ballP[b] = new PVector(0,0,0);
ballV[b] = new PVector(0,0,0);
fireS[b] = false;
}
/*for(int b = 0; b <= confNum - 1; b++){
confP[b] = new PVector(eyeX,eyeY,eyeZ);
confV[b] = new PVector(0,random(2,4),0);
}*/
for(int n = 0; n <= rN -1; n++){
rY[n] = random(-2500,500);
rX[n] = random(-2500,2500);
rZ[n] = random(-2500,2500);
rS[n] = random(10,25);
}
for(int p = 0; p < rowNum; p++){
for(int q = 0; q < colNum; q++){
//terrainColour[p][q] = int(random(200,255));
terrainColour[p][q] = int( sin(p) * sin(q) * 255);
}
}
noCursor();
try {
robot = new Robot();
robot.setAutoDelay(0);
}
catch (Exception e) {
e.printStackTrace();
}
}
void draw(){
yVelocity = constrain(yVelocity,-100,500);
angleX = constrain(angleX, radians(-75), radians(75));
background(0,200,255);
centerBot();
cameraMove();
translate(eyeX,eyeY,eyeZ);
rotateX(angleX);
rotateY(angleY);
translate(-eyeX,-eyeY,-eyeZ);
translate(width/2,height/2,0);
ambientLight(120, 120, 120, 0, 0, 0);
directionalLight(120,120,120,0,1,0);
colourChange();
translate(-width/2,-height/2,0);
box(16000);
// trail();
bullet();
shoot();
rectMode(CENTER);
ground();
stuff();
detectPlat();
target();
yVelocity += yAcceleration;
eyeY += yVelocity;
centerY += yVelocity;
if(!onPlat){
yAcceleration = 3;
}
else if(onPlat){
yAcceleration = 0;
yVelocity = 0;
}
}
void cameraMove(){
eyeX = constrain(eyeX,-8000,8000);
centerX = constrain(centerX,-8000,8000);
// eyeZ = constrain(eyeZ,-8000,8000);
//centerZ = constrain(centerZ,-8000,8000);
float cameraZ = ((height/2.0) / tan(PI*60.0/360.0));
perspective(PI/3.0, width/height, cameraZ/10.0, cameraZ*50.0);
camera(eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ);
crosshair();
if(moveBack){
eyeZ -= cos(angleY) * movespeed;
centerZ -= cos(angleY) * movespeed;
eyeX += sin(angleY) * movespeed;
centerX += sin(angleY) * movespeed;
}
if(moveForward){
eyeZ += cos(angleY) * movespeed;
centerZ += cos(angleY) * movespeed;
eyeX -= sin(angleY) * movespeed;
centerX -= sin(angleY) * movespeed;
}
if(moveLeft){
eyeX -= cos(angleY) * movespeed;
centerX -= cos(angleY) * movespeed;
eyeZ -= sin(angleY) * movespeed;
centerZ -= sin(angleY) * movespeed;
}
if(moveRight){
eyeX += cos(angleY) * movespeed;
centerX += cos(angleY) * movespeed;
eyeZ += sin(angleY) * movespeed;
centerZ += sin(angleY) * movespeed;
}
if(moveUp){
//eyeY -=movespeed;
//centerY -= movespeed;
if(yVelocity == 0){
yVelocity -= 50;
}
}
if(moveDown){
eyeY +=movespeed;
centerY += movespeed;
}
}
void centerBot(){
if(mouseX >= width/2 + 1){
angleY += radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
if (mouseX <= width/2 - 1){
angleY -= radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
if (mouseY >= height/ 2 + 1){
angleX -= radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
if (mouseY <= height/2 - 1){
angleX +=radians(sqrt(dist(width/2,height/2,mouseX,mouseY)) * sensitivity);
robot.mouseMove(x,y);
}
}
void stuff(){
fill(255-colourR,255-colourG,255-colourB);
textSize(500);
pushMatrix();
textMode(CENTER);
rotateY(radians(angleZ));
text("Score:", 0,-1500);
text(score,0,-1000);
angleZ++;
popMatrix();
strokeWeight(5);
stroke(255,0,255);
for(int n = 0; n <= rN -1; n++){
rY[n] += rS[n];
line(rX[n],rY[n],rZ[n],rX[n],rY[n]-5,rZ[n]);
if(rY[n] >= 500){
rY[n] = -5000;
rX[n] = random(-5000,5000);
rZ[n] = random(-5000,5000);
}
}
}
void ground(){
strokeWeight(2);
translate(0,1000,0);
for(int p = 0; p < rowNum; p++){
for(int q = 0; q < colNum; q++){
if(p >= rowNum /3 && p <= 2 * rowNum/3 && q >= colNum /3 && q <= 2 * colNum/3){
fill(terrainColour[p][q],sin(q)* 255,sin(p) * 255,0);
}
else{
fill(sin(p) * 255,sin(q)* 255,terrainColour[p][q]);
}
pushMatrix();
translate(-gX/2 + p * distTerrain,0,-gZ/2 + q * distTerrain);
box(distTerrain,gY,distTerrain);
popMatrix();
}
}
}
void crosshair(){
translate(centerX,centerY,centerZ);
strokeWeight(1);
stroke(100,255,255);
beginShape();
vertex(0,0,0);
vertex(0,10,0);
vertex(0,-10,0);
vertex(0,0,0);
vertex(-10,0,0);
vertex(10,0,0);
endShape(POINTS);
noStroke();
translate(-centerX,-centerY,-centerZ);
}
/* void trail(){
stroke(colourR,colourG,colourB);
strokeWeight(2);
for(int d = 0; d < confNum; d++){
line(confP[d].x,confP[d].y,confP[d].z,confP[d].x,confP[d].y + 5,confP[d].z);
confP[d].add(confV[d]);
if(d >= 1){
line(confP[d].x,confP[d].y,confP[d].z,confP[d-1].x,confP[d-1].y,confP[d-1].z);
}
if(confP[d].y >= eyeY + 200||confP[d].y <= eyeY - 200){
confP[d].x = eyeX;
confP[d].y = eyeY ;
confP[d].z = eyeZ;
}
}
}*/
void target(){
pushMatrix();
translate(targetP.x,targetP.y,targetP.z);
noStroke();
fill(255,0,0);
box(600);
popMatrix();
}
void bullet(){
for( int c = 0; c < bNum; c++){
pushMatrix();
translate(ballP[c].x,ballP[c].y,ballP[c].z);
float op = dist(0,0,0,targetP.x - ballP[c].x,targetP.y - ballP[c].y + 1000,targetP.z - ballP[c].z);
if(fireS[c]){
fill(0,0,0);
// println(op);
}
else{
noFill();
}
noStroke();
sphere(5);
if(ballP[c].x >= gX - 5 || ballP[c].x <= -gX + 5|| ballP[c].z >= gZ- 5 || ballP[c].z <= -gZ + 5 || ballP[c].y <= -600 * gY - 512.5|| ballP[c].y >= gY + 512.5 ){
rampUp--;
threshold--;
fireS[c] = false;
}
if(op <= 300){
targetP.set(random(-gX/2,gX/2),random(-6000,-1000),random(-gZ/2,gZ/2));
stroke(255);
line(0,0,0,targetP.x - ballP[c].x,targetP.y - ballP[c].y + 1000,targetP.z - ballP[c].z);
score++;
}
ballP[c].add(ballV[c]);
popMatrix();
}
}
void shoot(){
if(shooting){
rampUp += firerate;
}
for(int c = 0; c < bNum; c++){
rampUp = constrain(rampUp,0,bNum);
threshold = constrain(threshold,1,bNum + 1);
if(shooting){
if(fireS[c]){
if(ballV[c].x == 0 && ballV[c].y == 0 && ballV[c].z == 0 ){
ballV[c].set(cos(angleX)* sin(angleY)*200,sin(angleX) * -200,cos(angleX) * cos(angleY)*-200);
}
}
}
if(!fireS[c]){
ballP[c].set(eyeX,eyeY,eyeZ);
ballV[c].set(0,0,0);
if(rampUp >= threshold){
fireS[c] = true;
threshold++;
}
}
if(rampUp <= threshold - 1){
threshold--;
}
}
if(!shooting){
rampUp = 0;
threshold = 1;
}
}
void detectPlat(){
if(eyeX >= -gX /2 && eyeX <= gX/2 && eyeZ >= -gZ /2 && eyeZ <= gZ/2 && eyeY >= 0 && eyeY <= 1000){
if(eyeX >= -1500 && eyeX <=1500 && eyeZ >= -1500 && eyeZ <= 1500){
onPlat = false;
}
else{
onPlat = true;
}
}
else{
onPlat = false;
}
if(eyeY >= 8000){
eyeY = -6000;
centerY = -6000;
}
}
void colourChange(){
if(colourB <= 0 || colourB >= 255){
changeB *= -1;
}
if(colourR <= 0 || colourR >= 255){
changeR *= -1;
}
if(colourG <= 0 || colourG >= 255){
changeG *= -1;
}
colourG += changeG;
colourB += changeB;
colourR += changeR;
fill(colourR,colourG,colourB);
//noFill();
noStroke();
// stroke(colourR,colourG,colourB);
}
void keyPressed(){
if(key == 'r'){
eyeX = width/2+2000;
eyeY = height/2-1000;
eyeZ = (height/2.0) / tan(PI*30.0 / 180.0);
centerX = width/2+2000;
centerY = height/2-1000;
centerZ = 0;
shooting = false;
score = 0;
}
if(key == 'w'){
moveBack = true;
}
if(key == 's'){
moveForward = true;
}
if(key == 'a'){
moveLeft = true;
}
if(key == 'd'){
moveRight = true;
}
if(key == ' '){
moveUp = true;
}
if(key == CODED){
if(keyCode == SHIFT){
if(eyeY>= 100){
// moveDown = true;
}
}
}
}
void keyReleased(){
if(key == 'w'){
moveBack = false;
}
if(key == 's'){
moveForward = false;
}
if(key == 'a'){
moveLeft = false;
}
if(key == 'd'){
moveRight = false;
}
if(key == ' '){
moveUp = false;
}
if(key == CODED){
if(keyCode == SHIFT){
moveDown = false;
}
}
}
void mousePressed(){
for(int c = 0; c <= bNum - 1; c++){
ballP[c].set(eyeX,eyeY,eyeZ);
ballV[c].set(0,0,0);
shooting = true;
}
}
void mouseReleased(){
shooting = false;
}