Guys, am new to processing and would like to get some help with my piece of code.I want to shoot circles and for some reason I have only one bullet coming from my gun. and also some tips on the collision if possible. Your help will be highly be appreciated thank you
int bulNum = 1000;
Bullet[]bullets = new Bullet[bulNum];
int ballsFalling = 10;
Ball[] balls = new Ball[ballsFalling];
void setup(){
size(500,500);
for(int i = 0; i < bullets.length;i++){
bullets[i] = new Bullet(0,height);
}
for (int i = 0; i < balls.length;i++) {
balls[i]= new Ball();
}
}
void draw(){
background(0);
for(int i = 0; i < bullets.length;i++){
bullets[i].run();
}
for (int i = 0; i < balls.length;i++) {
balls[i].run();
}
}
class Ball {
// global variables
float x= random (0,width);
float y = random (10,height);
// function
void run(){
moveDown();
Display();
}
void Display(){
fill(245,100,150);
//image(bird,x,y,40,40);
ellipse(x,y,40,40);
y = y + 1;
}
void moveDown(){
if( y > height){
x= random (0,width);;
y = random(-500);
}
}
}
class Bullet {
float x;
float y;
int dy = 0;
float bulletHeight = 5;
float Xspeed;
Bullet(int x, int y){