IsmaelGames7

How to use the Phaser in Visual Studio 2017

Recommended Posts

Hello guys,


I wanted to know how to use the phaser in visual studio 2017?
I know you have this tutorial: https://phaser.io/tutorials/how-to-use-phaser-with-typescript 
Only that from 2013 until 2017 much has changed, If someone could update the tutorial, it would help a lot. :D
Also if someone can teach you how to add syntaxes to the autocomplete, it would help.
The syntaxes in auto completer are missing a lot, especially for those who are starting!!

Share this post


Link to post
Share on other sites

 

10 hours ago, IsmaelGames7 said:

I wanted to know how to use the phaser in visual studio 2017?
I know you have this tutorial: https://phaser.io/tutorials/how-to-use-phaser-with-typescript 
Only that from 2013 until 2017 much has changed, If someone could update the tutorial, it would help a lot. :D

1

Were you not able to follow the tutorial in VS2017? I'm not at my desktop currently and don't have VS2017 installed, but I was able to follow the same project setup process I'd been using with VS2015 in 2017 without any hassle. The guide on the Phaser site is old, but the basic project setup hasn't really changed radically.

Share this post


Link to post
Share on other sites

Hi, long time ago, I wrote simple tutorial http://sbcgamesdev.blogspot.cz/2015/05/phaser-tutorial-dronshooter-simple-game.html - it is for VS2013 and change of web.config file is not needed anymore, but I use the same in VS2015. I do not believe VS2017 is so different.

Tutorial is good for very small one-file projects. For larger ones, try to read these posts (it is about structuring project and merging output into single file)

 

 I think your main problem is, that VS cannot find defs. For me it worked to put it into "root" directory - as in tutorial - or into lib directory for larger projects. This is my structure - left in VS and right on disk (I do not put assets into VS, beacuase I never needed it). Along with settings in linked posts it merges all compiled files into one output, saves it in js directory and thanks to post build events it uglifies it in Release mode.

Project.png.c94f0106a282e1fb65b807c7389a2824.png

Share this post


Link to post
Share on other sites

Good morning everyone!

I have the same issue with Visual studio communiy 2017, I haven't find a way to let Visual studio see Phaser.

I've copied:

p2.d.ts

phaser.d.ts

phaser.js

pixi.d.ts

I've even added package.json as I've read in a guide.

I've put Phaser folder in the environment variable.

I've launched the typings command for Phaser.

But after all of that there is no way to compile.

 

The officiale guide, based on Visual studio 2013, tell to create a new project "HTML Application with TypeScript" that it doesn't even exists in Visual studio community 2017.

Someone have found a way?

 

Thanks everyone!

Share this post


Link to post
Share on other sites

Hi, still on VS 2015, but friend of mine had the same problem in VS 2017 as you have - missing tamplate. It looks this template is not in VS 2017 anymore...

...but, some guy created it. Try it here and let others know, if it worked: https://marketplace.visualstudio.com/items?itemName=Rich-Newman.TypeScriptHTMLApplicationTemplate

For me, in VS 2015, worked always to put Phaset stuff into "lib" folder.

 

Share this post


Link to post
Share on other sites

Thanks Tom, now I can compile Typescript in Visual Studio community 2017... but there is no way to compile Phaser code :-(

If I put the files in the folder it says there is no Phaser.

If I install Phaser from Bower (in Visual Studio community 2017) it says there is no Phaser.

If I do both it say that I've double declarations.

Share this post


Link to post
Share on other sites

Could you put screenshot of your project hierarchy here?

You can also try to put Phaser reference to the top of your file - something like this:

/// <reference path="../lib/phaser.d.ts" />

For me, I do not have to do it - VS finds all *.d.ts files in lib folder, but it may help to explicitely set reference to it.

Share this post


Link to post
Share on other sites

This is the last try I've done yesterday.

First installed Phaser via Bower directly on Visual Studio project properties.

Then I put Phaser in the project folder (I do both edited the tsconfig.json and put the files on hierarchy... doesn't change anything).

Then I do both solution and now VS tell that it have duplicated identifier, declaration, ecc... but writing some Phaser code on app.ts it said that could not find Phaser.

Tried with Phaser 2.6.2 and Phaser CE 2.9.2 (separatly).

PhaserTest1.jpg

PhaserTest2.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.