Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- class PoopBall extends Ball{
- private ArrayList<PoopBall> ballsPooped;
- public PoopBall(){
- super();
- setDiameter( 500 );
- ballsPooped = new ArrayList<PoopBall>();
- }
- public void move(){
- super.move();
- if( millis() % 1000 > 0 && millis() % 1000 < 20){
- setDiameter( getDiameter() / 2 );
- PoopBall b = new PoopBall();
- b.setDiameter( getDiameter() );
- b.setColor( getColor() );
- ballsPooped.add( b );
- }
- }
- public void display(){
- super.display();
- for( Ball b : ballsPooped ){
- b.display();
- b.move();
- b.bounce();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement