I need help with controls for a game / interactive project. Please reply as soon as possible

i need help with moving controls for this game i am making here is the code the D key moves the asset to the right of the screen

function keyDown(d) {
this.x + 1
}

This should help:

if (keyIsDown(“A”)){
this.x -= step_speed;
}
if (keyIsDown(“D”)){
this.x += step_speed;
}

change step_speed with the number you want it to move. to move it up and down change this.x to this.y and the letter inside the “” to a capital letter of your choice.
Hope it goes well

Thank you! I will try it now!

is there a way to make it play some frames then loop until its stopped?

example: when the character moves it plays a walking animation