I'm writing an RPG game in javascript, and I want my main character to move when youi press the arrow keys or the wasd keys. I have code to generate him, but how should I define his postion so he moves when the aforementioned keys are pressed?
function mainchar(){
var mainchar = new Image();
mainchar.src = /*I'll add this soon*/;
mainchar.style.top = /*What should I put here?*/;
mainchar.style.left = /*What should I put here?*/;
mainchar.style.position = "absolute";
document.body.appendChild( mainchar );
}