Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ball[] balls;
- void setup(){
- size(640,480);
- balls = new Ball[10];
- initBalls();
- }
- void initBalls(){
- for(int i = 0; i < balls.length; i++) balls[i] = new Ball();
- //make any of the balls a different type here. Right now they are all type Ball.
- }
- void draw(){
- background(255);
- for(Ball b : balls){
- b.display();
- b.move();
- b.bounce();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement