Some formatting
This commit is contained in:
parent
9bd1c688b0
commit
47f5dcaddc
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
interface Drawable {
|
||||
interface Drawable
|
||||
{
|
||||
public abstract void draw(Turtle t, double elapsedTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
class Main {
|
||||
public static void main(String[] args) {
|
||||
class Main
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Manager();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user