[SOLVED] Can I get help for a movement system?

I have tried to code, but have failed, I can’t figure out how to make my own movement system, if I could get help it would be awesome.

Hi @Gavin_Durbin! It would be nice if you let us know what code you are using and what problems you have with it.

trying to get a controller for movement, I can’t figure out how to use a command to check for key presses

// check for key press inside update function
if (this.app.keyboard.isPressed(pc.KEY_W)) {
    // move forward

when I do that it says keyboard is undefined tho…

Where are you using that code?

hold on a min…

nvm, it works now.

1 Like

Lol, I’m very sorry that I’m coming back to this, but It won’t work

in the game when i try to parse it it says “keyboard is undefined”

Yeah, because your code runs outside of your script context. Try putting it inside the script update method. Check this:


And the first person movement tutorial, you can see that code lives inside the script update method:


FirstPersonMovement.prototype.update = function(dt) {


I dont understand either, just tryin to make a game

What don’t you understand @Ethan_Watts?

Just setting it up, I’m new to coding, also want to understand how to code it in, the movement system, just getting to it, and using it