public class Ball extends Kreis implements Zeichenfenster.AktionsEmpfaenger { static final double BESCHLEUNIGUNG = 5; double geschwindigkeit = 0; public Ball() { super(); Zeichenfenster.AktionsEmpfängerEintragen(this); } public Ball(int x, int y) { this(); super.PositionSetzen(x, y); } public void Ausführen() { // Der Ball liegt if (y == 600-radius) { return; } // Der Ball faellt geschwindigkeit += BESCHLEUNIGUNG; // Beschleunigung int ny = y + (int)geschwindigkeit; if (ny >= 600-radius) { // Der Ball ist aufgeschlagen ny = 600-radius; geschwindigkeit = 0; } super.PositionSetzen(x, ny); } public void SonderTaste(int sondertaste) {} public void Taste(char taste) {} public void Geklickt(int x, int y , int anzahl) {} }