Skip to content

Commit

Permalink
Fix radians command.
Browse files Browse the repository at this point in the history
Commit 5502ec2 to fix issue #68 broke the `radians` command.
Simply stopped using `Math.sin()` and `Math.cos()` and instead used the p5.js `sin()` and `cos()` global functions which take into account the p5.js `angleMode()`.
  • Loading branch information
TheTastefulToastie committed Nov 22, 2018
1 parent 5502ec2 commit 9dc916f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions turtle.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class Turtle {

forward(amt) {
// Move the turtle
this.x += Math.cos(this.dir * Math.PI / 180) * amt;
this.y += Math.sin(this.dir * Math.PI / 180) * amt;
this.x += cos(this.dir) * amt;
this.y += sin(this.dir) * amt;

// If the pen is down we should draw a line from the previous position to the new position
if (this.pen) {
Expand Down

0 comments on commit 9dc916f

Please sign in to comment.