mortsini Posted November 21, 2016 Share Posted November 21, 2016 I have the Box2d plugin, but game.physics.box2d doesn't have autocomplete when I type "game.physics.box2d" in Visual Studio. In phaser.d.ts I see: arcade: Phaser.Physics.Arcade; config: any; game: Phaser.Game; ninja: Phaser.Physics.Ninja; p2: Phaser.Physics.P2; box2d: any; I think it Might be that it thinks game.physics.box2d is any instead of box2d class. How do I get autocomplete? Link to comment Share on other sites More sharing options...
Tom Atom Posted November 22, 2016 Share Posted November 22, 2016 yes, it is because box2d is any. Cast it like this: let physics = <Phaser.Physics.Box2D>this.game.physics.box2d; Do the same with bodies (code below is from class extending Phaser.Sprite): let body = <Phaser.Physics.Box2D.Body>this.body; Make sure you have TS defs (both files): https://github.com/SBCGames/Phaser-Box2D-Typescript-defs Adel 1 Link to comment Share on other sites More sharing options...
mortsini Posted November 23, 2016 Author Share Posted November 23, 2016 Thank you for the fix. Link to comment Share on other sites More sharing options...
Recommended Posts