[SOLVED] How to move using button UI? || Creating Mobile Controls

I need to move using on screen buttons for mobile, so say you press the U button, you move up. I am only working on the L, R, and U buttons right now. The error is when you press L or R, the camera will just go to blue and then pressing U will cause an error (didn’t do anything before). Help?

Here’s the code:

PlayerControler.attributes.add("U", { type: 'entity' });
PlayerControler.attributes.add("L", { type: 'entity' });
PlayerControler.attributes.add("R", { type: 'entity' });

// initialize code called once per entity
PlayerControler.prototype.initialize = function() {
    this.U.element.on('touchstart', this.U, this);   
    this.L.element.on('touchstart', function(event,dt) {
        this.entity.rigidbody.applyForce((-this.walkSpeed/2) * dt, 0, 0);
    }, this);
    this.R.element.on('touchstart', function(event,dt) { 
        this.entity.rigidbody.applyForce((this.walkSpeed/2) * dt, 0, 0);
    }, this);
    this.U.element.on('touchend', function(event) {
        if (this.jump === true) {
            this.jump = false;
            this.entity.rigidbody.applyImpulse(0, this.jumpForce, 0);
    } , this);    
    this.L.element.on('touchend', this.Le, this);
    this.R.element.on('touchend', this.Re, this);

Here’s the project link:

Actually, I figured it out…