legan Posted July 18, 2015 Share Posted July 18, 2015 Hi, I've been using Phaser with Notepad++ until now but I decided to try Visual Studio with Typescript (everyone praised the IntelliSense, so I thought it would be good to test it myself). I'm a completely noob so maybe I screwed up in something pretty obvious, but the IntelliSense is not working. The strange thing is that it worked at first... but it doesn't work now. I tried with the references to the phaser files but the problem persists. Is there something I'm missing? Link to comment Share on other sites More sharing options...
_o0o_ Posted July 19, 2015 Share Posted July 19, 2015 I would guess it doesn't know what type this.enemy is as you haven't defined it.enemy: Phaser.Sprite;Also you seem to be just renaming your .js files to .ts. Which means you are doing things that are not required by ts. In ts you just create a class, optionally in a module, that has properties and methods and are not concerned with the js prototype syntax mess. legan 1 Link to comment Share on other sites More sharing options...
Tom Atom Posted July 19, 2015 Share Posted July 19, 2015 Yes, _oOo_ is right - VS will not help you, if you do not tell it what kind of object your enemy is. You can copy your JS code into TS files, but then you are not using TS. If you have C# or Java experientce, then writing in TS is more like this. You can create your game class like this:module MyGame { export class Game extends Phaser.Game { public static game: Phaser.Game; // ------------------------------------------------------------------------- constructor() { Game.game = this; // init game super(800, 800, Phaser.AUTO, "content", null /* , transparent, antialias, physicsConfig */); // states this.state.add("Boot", Boot); this.state.add("Preloader", Preloader); this.state.add("Menu", Menu); this.state.add("Play", Play); // start this.state.start("Boot"); } }} Or you can take a look at my tutorial for simple game in Typescript: http://sbcgamesdev.blogspot.cz/2015/05/phaser-tutorial-dronshooter-simple-game.html You will find basic project structure there already in first part. clark and legan 2 Link to comment Share on other sites More sharing options...
legan Posted July 19, 2015 Author Share Posted July 19, 2015 Oh, I see... That makes sense. I was just renaming the files I wrote previously in JS. I'm going to follow some tutorials (like the one Tom Atom posted) and read more about Typescript to understand better how it works. Link to comment Share on other sites More sharing options...
Recommended Posts