blob: 7ee870aa5e4ac4e576a37d1b7ae85330807f69a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
public class Flummi extends Ball {
double bounceFaktor;
public Flummi(double neuerBounceFaktor) {
super();
bounceFaktor = neuerBounceFaktor;
super.RadiusSetzen(20);
super.FarbeSetzen("gruen");
}
public Flummi(int x, int y, double neuerBounceFaktor) {
super(x, y);
bounceFaktor = neuerBounceFaktor;
super.RadiusSetzen(20);
super.FarbeSetzen("gruen");
}
public void Ausführen() {
// Der Flummi liegt
if (y == 600-radius && geschwindigkeit > 0) {
return;
}
// Der Flummi faellt
geschwindigkeit += BESCHLEUNIGUNG; // Beschleunigung
int ny = y + (int)geschwindigkeit;
if (ny >= 600-radius) { // Der Flummi ist aufgeschlagen
ny = 600-radius;
geschwindigkeit = -1 * bounceFaktor * geschwindigkeit;
}
super.PositionSetzen(x, ny);
}
public void SonderTaste(int sondertaste) {}
public void Taste(char taste) {}
public void Geklickt(int x, int y , int anzahl) {}
}
|