diff --git a/challenges/CC_03_Snake_game_p5.js/snake.js b/challenges/CC_03_Snake_game_p5.js/snake.js index d6f28a27fd..d84e8c2acc 100644 --- a/challenges/CC_03_Snake_game_p5.js/snake.js +++ b/challenges/CC_03_Snake_game_p5.js/snake.js @@ -22,8 +22,12 @@ function Snake() { } this.dir = function(x, y) { - this.xspeed = x; - this.yspeed = y; + if(this.xspeed != -1*x) { + this.xspeed = x; + } + if(this.yspeed != -1*y) { + this.yspeed = y; + } } this.death = function() {