Arrays and Mouse Pressed
              in 
             Programming Questions 
              •  
              1 year ago    
            
 
           
             I have this exercise and I am not able to get it completely done.
            
             
            
            
             
            
            
             
              
             
            
            
             
            
            
             
            
            
              
           
 
            
           
             Do you have any suggestion for me?
            
            
             Thanks!
            
            
              Makes circles fall from wherever you click with the mouse. 
             
             - float [] ballFallX = new float [0];
 - float [] ballFallY = new float [0];
 - float [] xpos=new float[1];
 - float [] ypos=new float[1];
 - float x ;
 - float y ;
 - float gravity = 0.1;
 - float speed = 0;
 - float ballspeed;
 - void setup(){
 - size(700,700);
 - ballspeed=5;
 - }
 - void draw(){
 - background(0);
 - for (int i=0; i<ballFallX.length; i++)
 - {
 - ballFallX = append( ballFallX, xpos[i]);
 - ballFallY = append( ballFallY, ypos[i]);
 - ellipse(ballFallX[i],ballFallY[i],50,50);
 - println ("Here is the X array" +ballFallX[i]);
 - }
 - xpos[xpos.length-1]=x;
 - ypos[xpos.length-1]=y;
 - fill (200,0,111);
 - ellipse (x, y, 50, 50);
 - y=y+ballspeed;
 - }
 - void mousePressed (){
 - x = mouseX;
 - y = mouseY;
 - }
 
 
              
              1  
            
 
            