From 4d1c5ad2e3283f32c2d68be4a4e8b8a55850e30b Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Tue, 27 Feb 2018 12:31:33 +0100 Subject: [PATCH] move function --- src/Worm.java | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/Worm.java b/src/Worm.java index fdf540b..d3a0836 100644 --- a/src/Worm.java +++ b/src/Worm.java @@ -155,12 +155,7 @@ public class Worm { } /** -<<<<<<< HEAD - * @param NumberSteps -======= - * * @param NumberSteps ... ->>>>>>> e58c4a26566e73a84d38d7f871aa21b85f295ea8 * * @post the new x-coordinate schould be the old one plus the number of steps multiplied * with the distance of a step in the x-orientation @@ -176,11 +171,11 @@ public class Worm { public void move(int numberSteps) { if (numberSteps < 0) throw new IllegalArgumentException(); -<<<<<<< HEAD - 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); } /** @@ -197,12 +192,5 @@ public class Worm { */ public void turn(double angleToAdd) { assert 0 <= angleToAdd && angleToAdd < 2 * Math.PI; - -======= - 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); ->>>>>>> e58c4a26566e73a84d38d7f871aa21b85f295ea8 } }