I'm trying to make Game Controls help

Hello i am making a game out of the wick editor and i am wondering how to use the keys WASD to make an image move in different directions (W = UP) (A = LEFT) (S = DOWN) and (D = RIGHT)

Hi @EmeraldStar123,

You can add keyboard controls using the keyDown and keyPressed functions.

Adding the code below to an object will let you control it using the w and d keys! You can put anything you’d like in here, and add new if statements with other keys to move in different directions.

function keyDown(key) {
  if (key === 'w') {
    this.y -= 5; // move character up
  } 

  if (key === 'd') {
    this.x += 5; // move character right
  }
}

Does this help?

thank you this is really helpful! you guys are a good staff and community!

1 Like

just wondering, is there somewhere i can learn to make the controls, i can’t figure out how to make the object and i feel like i’m there’s something missing here cause i just copied and pasted it on my object but it didn’t move. maybe making the frame loop it self, stoping the frame or the object has something to do with it,