Skip to content

Commit

Permalink
Changed back to keydown
Browse files Browse the repository at this point in the history
  • Loading branch information
gamalielhere committed Feb 5, 2016
1 parent 3763cd1 commit 28c3d03
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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 All @@ -121,7 +121,7 @@ $(document).ready(function() {
speed = Math.max(15, 70 - (score * 2));
loop_game = setInterval(render, speed);

// Making the snake move.
// Setting the snake's head
var newX = snake[0].x;
var newY = snake[0].y;
var tail;
Expand Down Expand Up @@ -211,7 +211,7 @@ $(document).ready(function() {
return false;
}

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

0 comments on commit 28c3d03

Please sign in to comment.