Вот:
<html>
<head>
<style>
.gameLayer {position: absolute; top: 0px; left: 0px;}
</style>
<script>
knight = new Image(30,30);
knight.src = '1.png'
var knightObj = {x: 30, y:60};
function init(){
drawKnight();
}
function drawKnight(){
var ctx = document.getElementById('playerLayer').getContext("2d");
ctx.drawImage(knight, knightObj.x, knightObj.y);
}
document.onkeydown = function(e) {
var ctx = document.getElementById('playerLayer').getContext("2d");
ctx.clearRect(knightObj.x,knightObj.y,25,30);
e = e || window.event;
if (e.keyCode == 38 && e.keyCode == 39) {
knightObj.x-=2;
knightObj.y-=2;
}
drawKnight();
}
</script>
</head>
<body onload="init()">
<canvas id="playerLayer" class="gameLayer" height="160" width="300"></canvas>
</body>
</html>
Если оставить одну клавишу - работает, две - нет.