diff --git a/Bird.java b/Bird.java index ae3a306..3ca3ca3 100644 --- a/Bird.java +++ b/Bird.java @@ -4,6 +4,7 @@ public class Bird private static final int JUMP_SPEED = 7; private final Rectangle _rect; private double _speed; + public Bird(Manager man) { _rect = new Rectangle(20, 20, 20, 20, "cyan", true); diff --git a/Drawable.java b/Drawable.java index b3dc46d..2071801 100644 --- a/Drawable.java +++ b/Drawable.java @@ -1,3 +1,4 @@ -interface Drawable { +interface Drawable +{ public abstract void draw(Turtle t, double elapsedTime); } diff --git a/Main.java b/Main.java index 6b8735b..02f0eb8 100644 --- a/Main.java +++ b/Main.java @@ -1,5 +1,7 @@ -class Main { - public static void main(String[] args) { +class Main +{ + public static void main(String[] args) + { new Manager(); } } diff --git a/Rectangle.java b/Rectangle.java index 7d1a10f..61bf1e7 100644 --- a/Rectangle.java +++ b/Rectangle.java @@ -1,26 +1,31 @@ class Rectangle implements Drawable { - private double _x, _y, _width, _height; + private double _x, _y; + private double _width, _height; private String _color; private boolean _fill; - public Rectangle(double x, double y, double width, double height, String c, boolean fill) { + public Rectangle(double x, double y, double w, double h, String c, boolean fill) + { _x = x; _y = y; - _width = width; - _height = height; + _width = w; + _height = h; _color = c; _fill = fill; } - public void drawRect(Turtle t) { + public void drawRect(Turtle t) + { t.hinterlasseKeineSpur(); t.geheZu((double)_x, (double)_y); t.hinterlasseSpur(); t.setzeFarbe(_color); - if (_fill) { - for (int i = 0; i < _height - 1; ++i) { + if (_fill) + { + for (int i = 0; i < _height - 1; ++i) + { t.geheVor(_width - 1); boolean right = t.gibRichtung() == 0; t.setzeRichtung(t.gibRichtung() + (right ? 90 : -90)); @@ -28,8 +33,11 @@ class Rectangle implements Drawable { t.setzeRichtung(t.gibRichtung() + (right ? 90 : -90)); } t.geheVor(_width - 1); - } else { - for (int i = 0; i < 2; ++i) { + } + else + { + for (int i = 0; i < 2; ++i) + { t.geheVor(_width - 1); t.setzeRichtung(t.gibRichtung() + 90); t.geheVor(_height - 1); @@ -40,7 +48,8 @@ class Rectangle implements Drawable { t.setzeRichtung(0); } - public void draw(Turtle t, double elapsed) { + public void draw(Turtle t, double elapsed) + { drawRect(t); }