Hello I have a little mini project and i need help concerning making once object go from one object into another. I have two scripts here. The first is the file i will be submitting for my project and its a box shooting and once it detects the circles, the circles disappear. Once the circle is disappeared i would want this explosion to happen but i don't know how to go about that. Here is the first script.
float px, py;
float vx, vy;
float minX, maxX;
ArrayList bullets;
int cols= 1;
int rows =2;
int cols_select;
int rows_select;
Alien[][] aliens = new Alien[cols][rows];
int deadAliens=0;
int lastGuy=0;
void setup(){
size( 600, 600, P3D );
bullets = new ArrayList();
minX = 150;
maxX = 450;
vx = 2;
vy = 2;
px = minX; // position px in minX at the start
py = 100 ; // posiiton py in the middle of the sketch
for (int i=0; i< cols; i++){
for (int j=0; j<rows; j++){
aliens[i][j] = new Alien(100, 300, 300, 360, i*100, j*150, 200,1);
}
}
fill(0,200,0,100);
}
void draw(){
background(255);
for (int i=0; i< cols; i++){
for(int j=0; j<rows; j++){
aliens[i][j].display();
aliens[i][j].move();
aliens[i][j].shift();
aliens[i][j].exitStageLeft();
}
}
for (int i=0; i < bullets.size(); i++) {
Bullet b = (Bullet) bullets.get(i);
b.display();
b.fire();
if(b.finished()){
bullets.remove(b);
}
for (int k=0; k< cols; k++){
for(int j=0; j<rows; j++){
if(b.intersect(aliens[k][j])){
bullets.remove(b);
aliens[k][j].destroyed();
deadAliens=deadAliens+1;
}
}
}
}
// Move box to x,y,z
pushMatrix();
fill(0,200,0,100);
rect(250,550,20,20);
popMatrix();
//Draw a box with size 50
}
class Alien {
color h;
color s;
color b;
float a;
float xpos;
float true_xpos;
float true_ypos;
float ypos;
float zpos;
float xspeed;
float d;
float r;
boolean imaDeadAlien=false;
Alien(color h_, color s_, color b_, float a_, float xpos_, float ypos_, float zpos_, float xspeed_){
Hello everyone i'm currently trying to make a simple game but first im trying to get the core basics before i start designing and think about more complex ideas. I'm still very new in Processing and have been following the tutorials but right now i'm in a bit of a slump. I have a rectangle and i want to make it so that when you press spacebar smaller rectangles come out of it ( in my finished product its supposed to be bullets). The target is simply this ellipse in the air moving back and forth. If someone can please help me with a shooting script and once it collides the target the ellipse disappears , I would really appreciate. Thanks a lot in advance !!
Hello i've just been recently using processing for one of my classes and I need help in moving a sphere left and right. I know its something really simple and I have been looking at the reference guide but all i find is info on the translate tool and that would work except i need the sphere to go from point A to point B then back to point A again. Thanks for the help in advance !!!