Making an array of objects
              in 
             Programming Questions 
              •  
              2 years ago    
            
 
           
             Okie, I've made an object to hold and update these blob things that should fly all over the screen. Now, to make managing them easier, I stored them in an array.
            
            
//The class name is "enemy"
enemy[] Boop;
            
void setup(){
for (int i = 0;i < 10; i ++){
Boop[i] = new Enemy();
}
}
            
Am I initializing something wrong? I seem to be getting a null pointer exception.
 
           
 
            
           //The class name is "enemy"
enemy[] Boop;
void setup(){
for (int i = 0;i < 10; i ++){
Boop[i] = new Enemy();
}
}
Am I initializing something wrong? I seem to be getting a null pointer exception.
 
              
              1  
            
 
            
 
 
          