Merge branch 'master' of gitlab.principis.be:OGP/worms
This commit is contained in:
@@ -192,6 +192,9 @@ public class Worm {
|
|||||||
* |0 <= new.orientation < 2pi
|
* |0 <= new.orientation < 2pi
|
||||||
*/
|
*/
|
||||||
public void turn(double angleToAdd) {
|
public void turn(double angleToAdd) {
|
||||||
assert 0 <= angleToAdd && angleToAdd < 2 * Math.PI;
|
assert 0 <= angleToAdd && angleToAdd < (2 * Math.PI);
|
||||||
|
if (0 <= (this.orientation + angleToAdd) && (this.orientation + angleToAdd) < (2 * Math.PI))
|
||||||
|
setOrientation(this.orientation + angleToAdd);
|
||||||
|
setOrientation((this.orientation + angleToAdd)%(2 * Math.PI));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user