Omustardo

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. Thanks Tom, I opened up phaser.d.ts and edited the line: leftButton: boolean;to leftButton: Phaser.DeviceButton;and now it works as expected. The KeyCode vs Keyboard issue is pretty minor since they both work, but I'll make sure to change it when phaser.d.ts is updated. I'm glad it wasn't something silly that I made a mistake with though. Thank you for the help and quick response.
  2. Hi everyone. I'm playing around with TypeScript and Phaser for the first time. I started off with plain Javascript/Phaser in Sublime and got a little game going where I could move a sprite around the screen and click to shoot. It worked relatively easily which was nice. Then I decided to switch to TypeScript and Visual Studio because intellisense and the class/inheritance syntax looked like it would make things easier. I still have hope, but I've run into some problems. The first issue that came up was setting up WASD controls with AddKey. I tried to use the recommended var movementLeftKey: Phaser.Key = game.input.keyboard.addKey(Phaser.KeyCode.A);but I got the message: Property 'KeyCode' does not exist on 'typeof Phaser' I got around it by using var movementLeftKey: Phaser.Key = game.input.keyboard.addKey(Phaser.Keyboard.A)This made me think that I was using the wrong version of phaser files since 2.4.4 ought to allow KeyCode. Unless I'm doing something wrong(certainly possible), I believe I'm all up to date. I have p2.d.ts, phaser.d.ts, phaser.js, phaser.min.js, and pixi.comments.d.ts from https://github.com/photonstorm/phaser/tree/master/typescript all in my project as recommended in the typescript tutorial: http://phaser.io/tutorials/how-to-use-phaser-with-typescript I wanted to use phaser.comments.d.ts instead of phaser.d.ts, but it looks like it hasn't been updated - the version appears to be 2.4.3 rather than 2.4.4 Another issue is with detecting mouse clicks. Before typescript/visual studio, I used game.input.activePointer.leftButton.isDown to check if the player was clicking. Visual Studio won't even compile that because it says game.input.activePointer.leftButton is a boolean. All of the Phaser documentation says it's a DeviceButton, and I've even printed out the value with console.log and it says it's an [object Object], so definitely not a boolean. Any ideas why Visual Studio thinks otherwise? I am using the most recent version of typescript that came installed with Visual Studio 2015 Community. Here's my project on Github. I haven't ever used github before so if something appears messed up with how I uploaded it, that's why and please let me know. The code dealing with mouse and keyboard input is here. Thanks in advance for any advice.