29.01.2014 Aufrufe

Script Java

Script Java

Script Java

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

11.2 Vererbung<br />

}<br />

orientation = 0;<br />

public void forward(int distance) {<br />

int x = position.x +<br />

(int)Math.round(distance*Math.sin(Math.PI*orientation/180));<br />

int y = position.y -<br />

(int)Math.round(distance*Math.cos(Math.PI*orientation/180));<br />

graphics.drawLine(position.x, position.y, x, y);<br />

position.setLocation(x, y);<br />

}<br />

}<br />

public void right(int angle) {<br />

orientation = (orientation + angle) % 360;<br />

}<br />

public class PowerTurtle extends Turtle {<br />

public PowerTurtle(Graphics g) {super(g);}<br />

}<br />

public void polygon(int n, int size) {<br />

for (int i=0;i

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!