if(window.event){// IE
keynum = e.keyCode
}else if(e.which) {// Netscape/Firefox/Opera
keynum = e.which
}
switch(keynum){
case left:
selfPlane.move(-Main.keyMove,0);
break;
case up:
selfPlane.move(0,-Main.keyMove);
break;
case right:
selfPlane.move(Main.keyMove,0);
break;
case down:
selfPlane.move(0,Main.keyMove);
break;
default:
break;
}
//console.log(keynum);
}
}
}
entity.js: