Trouble blocking movement

I have been trying to block the movement and animation of the player when it performs a certain action, unfortunately I have not succeeded.
I have the following code in a script to communicate with the move script

InputTwo.prototype.onKeyDown = function(e) {
    if(e.key===13){
        if(this.chat_active===false){
            this.element.focus();
            this.chat_active=true;
            this.app.fire('chat',true);
        }
    }if(e.key===27) {
        if(this.chat_active===true) {
            this.element.blur();
            this.chat_active=false;
            this.app.fire('chat',false);
        }
    }

Here in the script that controls the animation listens for the event but it does not have the expected effect. I suspect that you structure the code wrong

this.app.on('chat',function(bool=false){
                if(bool===false) {
                    this.isControlling=true;
                } else {
                    this.isControlling=false;
                }
});

From already thank you very much

Hi @Immolated,

Are you getting an error? Have you tried to debug your this.isControlling property?

I can see you are using it here, your statements aren’t easy to ready though :slight_smile: Try debugging the property here and see if it’s changing value:

3 Likes