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

#1

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
}

0 Likes

#2
This should help:

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

0 Likes

#3

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

0 Likes

#4

Thank you! I will try it now!

0 Likes

#5

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

0 Likes

#6

example: when the character moves it plays a walking animation

0 Likes