Skip to content

Commit

Permalink
Prevent moving juuust outside of the map.
Browse files Browse the repository at this point in the history
  • Loading branch information
gravypod committed Sep 25, 2017
1 parent 362a934 commit d04931b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions game/snake.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ game.update = function (delta) {
// Movement
if (game.direction !== null) {
var is_off_screen = function (dot) {
return dot.x < 0 || dot.x > (ROWS) ||
dot.y < 0 || dot.y > (COLS);
return dot.x < 0 || dot.x > (ROWS - 1) ||
dot.y < 0 || dot.y > (COLS - 1);
};
var next = make_location_to(game.direction, last_dot);

Expand Down

0 comments on commit d04931b

Please sign in to comment.