Doubt in "Making your first Phaser 3 game"

Hello. I am trying to add a space kay to the example that is in the web of Phaser: https://phaser.io/tutorials/making-your-first-phaser-3-game/part7

I added it and the console log works fine, but nothing happens when calling to the function

  var keyObj = this.input.keyboard.addKey('W');  // Get key object
  var isDown = keyObj.isDown;

 if (isDown)
    {
        console.log("Fire!");
   player.setVelocityX(-160);
        player.anims.play('left', true);
        
    }

Hi,
if you are following the tutorial, I guess you still have a “setVelocity(0)” as a last case for the player?
Probably you need an “else” joining all the other key conditions…

2 Likes

Yes! thanks! you are right! :smiley: :+1: