kevinshen56714 / SkyOffice

Immersive virtual office built with Phaser, React, Redux, PeerJS, and Colyseus.
https://sky-office.co/
MIT License
969 stars 300 forks source link

Change arrow control to wasd #43

Closed JimmyNi closed 2 years ago

JimmyNi commented 2 years ago

I would like to keep the arrow control and add WASD control but failed. I change the code in Game.ts file in line 42 this.cursors = this.input.keyboard.createCursorKeys() to

this.cursors = this.input.keyboard.addKeys(
      {up:Phaser.Input.Keyboard.KeyCodes.W,
      down:Phaser.Input.Keyboard.KeyCodes.S,
      left:Phaser.Input.Keyboard.KeyCodes.A,
      right:Phaser.Input.Keyboard.KeyCodes.D,
      space:Phaser.Input.Keyboard.KeyCodes.SPACE,
      shift:Phaser.Input.Keyboard.KeyCodes.SHIFT
    });

Then I got error Type {} is missing the following properties from type 'CursorKeys': up, down, left, right, and 2 more.ts(2740) I have no idea why I got this error, can someone pls help out?