Grid around the snake head fixed
This commit is contained in:
		@@ -295,9 +295,11 @@ async function startGame(gameID) {
 | 
			
		||||
                        const headPos = snake[snake.length-1];
 | 
			
		||||
                        
 | 
			
		||||
                        if(headPos[0] == y && headPos[1] == x) {
 | 
			
		||||
                            ctx.clearRect(x*cell_width, y*cell_height, cell_width, cell_height);
 | 
			
		||||
                            ctx.drawImage(imgGrass, x*cell_width, y*cell_height, cell_width, cell_height);
 | 
			
		||||
                            ctx.clearRect(x*cell_width+1, y*cell_height+1, cell_width-2, cell_height-2);
 | 
			
		||||
                            // Restore the background
 | 
			
		||||
                            ctx.drawImage(imgGrass, x*cell_width+1, y*cell_height+1, cell_width-2, cell_height-2);
 | 
			
		||||
 | 
			
		||||
                            // Head Orientation
 | 
			
		||||
                            if(key == "ArrowDown")
 | 
			
		||||
                                ctx.drawImage(imgSnakeHeadDown, x*cell_width, y*cell_height, cell_width, cell_height);
 | 
			
		||||
                            if(key == "ArrowUp" || !key)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user