[SOLVED] app.keyboard is not defined

@yaustar
Do you know why it is saying that my key presses aren’t defined?

It probably has to be this.app.keyboard.isPressed. Please try to remember this next time, because you already had this problem a couple of times before.

1 Like

Ok, i guess i forget the app

so would it be the same as If.(app.keyboard.ispressed aldkfadf;k)

Not sure what you exactly mean, but this will not work anyway. :face_with_monocle:

the aldkafda is just the key name, its random

    if (app.keyboard.isPressed(pc.KEY_A) || app.keyboard.isPressed(pc.KEY_LEFT)) {
        x -= right.x;
        z -= right.z;
    }

this better?
would i be apple to use if.(app
or do i have to use this.app.keyboard

You can do that if you use var app = this.app; first. Otherwise app is undefined, because it need to be this.app.

1 Like

do u put this into function? or Update? or intitialize?

I strongly suggest to use this.app for users with the same question, to prevent issues in the script.

so switch all of If (app.keyboard.isPressed)
to This.app.keyboard.ispressed ?

Yes, or define app before the first use in every function.