diff --git a/src/Worm.java b/src/Worm.java index a975a1b..8866c84 100644 --- a/src/Worm.java +++ b/src/Worm.java @@ -94,7 +94,13 @@ public class Worm { return this.orientation; } + + /** + * @param orientation + * + */ public void setOrientation(double orientation) { + this.orientation = orientation; } @@ -150,7 +156,7 @@ public class Worm { /** * - * @param NumberSteps + * @param NumberSteps ... * * @post ... * |new.CoordX = CoordX + NumberSteps * distanceX @@ -165,9 +171,9 @@ public class Worm { public void move(int NumberSteps) { if (NumberSteps < 0) throw new IllegalArgumentException(); - double distanceX = getRadius() * Math.cos(getOrientation()); - double distanceY = getRadius() * Math.sin(getOrientation()); - setCoordX(getCoordX() + NumberSteps * distanceX); - setCoordY(getCoordY() + NumberSteps * distanceY); + double distanceX = this.radius * Math.cos(this.orientation); + double distanceY = this.radius * Math.sin(this.orientation); + setCoordX(this.coordX + NumberSteps * distanceX); + setCoordY(this.coordY + NumberSteps * distanceY); } }