8.581
Bearbeitungen
Jneug (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Jneug (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 171: | Zeile 171: | ||
{{Lösung:Start|Hauptprogramm}} | {{Lösung:Start|Hauptprogramm}} | ||
<syntaxhighlight lang="Java" line="1"> | <syntaxhighlight lang="Java" line="1"> | ||
Ballon | class Ballon { | ||
private float x, y, speed, size; | |||
public Ballon() { | |||
x = random(10, width-10); | |||
y = height-10; | |||
speed = random(20, 40)/10; | |||
size = random(20, 30); | |||
} | } | ||
public void draw() { | |||
noStroke(); | |||
fill(color(23, 235, 98)); | |||
ellipse(x, y, size*.7, size); | |||
} | } | ||
void | public void update() { | ||
y -= speed; | |||
} | |||
public float getY() { | |||
return y; | |||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{Lösung:End}} | {{Lösung:End}} |
Bearbeitungen