Skip to content

Commit

Permalink
Attempt at bug fixing simultaneous key press kills snake
Browse files Browse the repository at this point in the history
  • Loading branch information
gamalielhere committed Feb 5, 2016
1 parent 3763cd1 commit c35e389
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ $(document).ready(function() {
}
}

var cWsW = Math.floor(canvasWidth/snakeWidth);
var cHsW = Math.floor(canvasHeight/snakeWidth);
var cWsW = Math.ceil(canvasWidth/snakeWidth);
var cHsW = Math.ceil(canvasHeight/snakeWidth);
function render(){
canvasContext.fillStyle = canvasFill;
canvasContext.fillRect(0,0,canvasWidth,canvasHeight);
Expand Down Expand Up @@ -211,7 +211,7 @@ $(document).ready(function() {
return false;
}

$(document).on('keyup',function(event) {
$(document).keyup(function(event) {
var arrow = event.which; // return which key was pressed
if(arrow === 37 && direction !== "right"){
direction = "left";
Expand Down

0 comments on commit c35e389

Please sign in to comment.