kevinshen56714 / SkyOffice

Immersive virtual office built with Phaser, React, Redux, PeerJS, and Colyseus.

Home Page:https://sky-office.co/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change arrow control to wasd

JimmyNi opened this issue · comments

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?