[SOLVED] Entity won't move on a key press

https://playcanvas.com/editor/code/685133?tabs=30740340 is my script editor it will no work ive tried it many times no errors recorded on the page ive also refreshed it and it still doesnt show any errors

also sry for revivng

In your script you have:

Movement.prototype.update = function(dt) {
    var W = this.app.keyboard.isPressed(pc.KEY_W);
    if (W) {
        this.entity.translatelocal(0,0,0.1);
    }
};

There is no such function as translatelocal. It is translateLocal. See API ref:

https://developer.playcanvas.com/en/api/pc.Entity.html#translateLocal

my script code https://playcanvas.com/editor/code/685133?tabs=30740340 i cant seem to move my sprite no matter what i do ive tried many other ways but none work please help asap

You need to save your file. When the file is yellow, it means that it isn’t saved:
image

(Ctrl - S to save the file you are currently editing)

ty im new to this editor

now it says app not defined

1 Like