Skip to content

Commit

Permalink
Prevent overdraw of turtles, better iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
inexorabletash committed Sep 20, 2023
1 parent cce1740 commit b8d7f71
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions turtle.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,12 @@

_draw(this.turtle_ctx, this);

for (var i in this._turtles) {
if (this._turtles[i] === undefined) {
for (var i = 0; i < this._turtles.length; ++i) {
if (this._turtles[i] === undefined || i == this.currentturtle) {
continue;
}
_draw(this.turtle_ctx, this._turtles[i]);
}


}},

_moveto: {value: function(x, y, setpos) {
Expand Down

0 comments on commit b8d7f71

Please sign in to comment.