show error with non positive degrees. fix bug in tatami

snap7
Michael 2022-02-21 23:02:09 +01:00
rodzic 367dd16075
commit 4f8f231961
1 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -484,8 +484,10 @@ SpriteMorph.prototype.arcRight = function (radius, degrees) {
if (degrees % 10 !== 0) {
this.turn((degrees % 10)/2);
this.forward(((radius * 0.174532) / 10) / (degrees % 10))
this.turn((degrees % 10)/2 * this.sign)
this.turn((degrees % 10)/2 )
}
} else {
throw new Error('degrees must be positive');
}
};
@ -498,10 +500,12 @@ SpriteMorph.prototype.arcLeft = function (radius, degrees) {
this.turn(-5)
}
if (degrees % 10 !== 0) {
this.turn(-(degrees % 10)/2);
this.turn(-((degrees % 10)/2));
this.forward(((radius * 0.174532) / 10) / (degrees % 10))
this.turn(-(degrees % 10)/2)
this.turn(-((degrees % 10)/2))
}
} else {
throw new Error('degrees must be positive');
}
};
@ -711,7 +715,7 @@ SpriteMorph.prototype.tatamiForwardEnd = function (steps, width=10) {
var alpha = degrees(Math.asin(width/c));
this.turn(90);
this.doMoveForward((c/2)*this.sign);
this.doMoveForward((width/2)*this.sign);
this.turn(-90);
}