import objectdraw.*;
import java.awt.*;

/**
 * Write a description of Bouncer here.
 * 
 */
public class Bouncer extends ActiveObject {

    private double MAX=30;
    private double STEP=1;
    private double DELAY=10;

    private DrawableInterface d;
    
    public Bouncer(DrawableInterface d) {
        this.d = d;
        this.start();
    }

    private void bounce(int dir) {
        int height = 0;
        while (height < MAX) {
            d.move(0,dir*STEP);
            pause(DELAY);
            height++;
        }
        height = 0;
        while (height < MAX) {
            d.move(0,-dir*STEP);
            pause(DELAY);            
            height++;
        }        
    }
    
    public void run() {
        pause(10*DELAY);
        this.bounce(1);
        this.bounce(-1);
    }
    
    
    
}
