Hallo
ich habe jezt ein paar Wochen Informatik in der Schule und wollte wir programmieren gerade eine Dartscheibe etc.
Nun würde ich den Pfiel gerne bunt machen.
Könnt ihr mir helfen?
Hier erstmal das, was ich bislang alles programmiert habe:
import sum.kern.*;
/**
* @author
* @version
*/
public class Dart
{
// Bezugsobjekte
Bildschirm hatBildschirm;
Stift hatStift;
Maus hatMaus;
// Attribute
// Konstruktor
public Dart()
{
hatBildschirm = new Bildschirm (800,600);
hatStift = new Stift();
hatMaus = new Maus();
}
// Dienste
public void fuehreAus()
{
// zeichne Scheibe
hatStift.bewegeBis(600,100);
hatStift.zeichneKreis(10);
hatStift.zeichneKreis(20);
hatStift.zeichneKreis(30);
hatStift.zeichneKreis(40);
hatStift.zeichneKreis(50);
// bewege zu Pfeil
hatStift.bewegeBis(100,100);
//drehe zu Dartscheibe Mitte
hatStift.dreheBis(38.6598);
// zeichne Pfeil
hatStift.runter();
hatStift.bewegeUm(100);
hatStift.hoch();
hatStift.bewegeUm(5);
hatStift.runter();
hatStift.zeichneKreis(5);
do
{
this.radierePfeil();
hatStift.dreheBis(270);
hatStift.bewegeUm(0.05);
hatStift.dreheBis(38.6598);
this.zeichnePfeil();
}
while(!hatMaus.istGedrueckt());
do
{
this.radierePfeil();
hatStift.bewegeUm(0.1);
this.zeichnePfeil();
}
while (hatStift.hPosition() < 600);
hatStift.hoch();
hatStift.bewegeBis(600,100);
hatStift.zeichneKreis(10);
hatStift.zeichneKreis(20);
hatStift.zeichneKreis(30);
hatStift.zeichneKreis(40);
hatStift.zeichneKreis(50);
}
private void radierePfeil()
{
hatStift.radiere();
hatStift.zeichneKreis(5);
hatStift.hoch();
hatStift.bewegeUm(-5);
hatStift.runter();
hatStift.bewegeUm(-100);
}
private void zeichnePfeil()
{
hatStift.normal();
hatStift.bewegeUm(100);
hatStift.hoch();
hatStift.bewegeUm(5);
hatStift.runter();
hatStift.zeichneKreis(5);
}
}
hoffe, dass ihr mit helfen könnt
Ira