function handleKey(event) {

	var i = gGamerPos.i;
	var j = gGamerPos.j;


	switch (event.key) {
		case 'ArrowLeft':
			if (!chackIfPassgaes(i, j - 1)) moveTo(i, j - 1);
			break;
		case 'ArrowRight':
			if (!chackIfPassgaes(i, j + 1)) moveTo(i, j + 1);
			break;
		case 'ArrowUp':
			if (!chackIfPassgaes(i - 1, j)) moveTo(i - 1, j);
			break;
		case 'ArrowDown':
			if (!chackIfPassgaes(i + 1, j)) moveTo(i + 1, j);
			break;

	}

}
// Move the player by keyboard arrows
Move the player by keyboard arrows
Move the player by keyboard arrows
function handleKey(event) {
	var i = gGamerPos.i;
	var j = gGamerPos.j;
	switch (event.key) {
		case 'ArrowLeft':
			if (!chackIfPassgaes(i, j - 1)) moveTo(i, j - 1);
			break;
		case 'ArrowRight':
			if (!chackIfPassgaes(i, j + 1)) moveTo(i, j + 1);
			break;
		case 'ArrowUp':
			if (!chackIfPassgaes(i - 1, j)) moveTo(i - 1, j);
			break;
		case 'ArrowDown':
			if (!chackIfPassgaes(i + 1, j)) moveTo(i + 1, j);
			break;
	}
}
function handleKey ( event ) { var i = gGamerPos . i ; var j = gGamerPos . j ; switch ( event . key ) { case 'ArrowLeft' : if ( ! chackIfPassgaes ( i , j - 1 ) ) moveTo ( i , j - 1 ) ; break ; case 'ArrowRight' : if ( ! chackIfPassgaes ( i , j + 1 ) ) moveTo ( i , j + 1 ) ; break ; case 'ArrowUp' : if ( ! chackIfPassgaes ( i - 1 , j ) ) moveTo ( i - 1 , j ) ; break ; case 'ArrowDown' : if ( ! chackIfPassgaes ( i + 1 , j ) ) moveTo ( i + 1 , j ) ; break ; } }
Move the player by keyboard arrows
Move the player by keyboard arrows