blinkok Posted August 6, 2015 Share Posted August 6, 2015 I have installed VS 2013 and downloaded and unzipped phaser.I am currently trying to go throught the phaser typescript examples.how do i make VS 2013 point to the phaser directory so the examples can reference the phaser framework?hope this makes sensethanks in advance Link to comment Share on other sites More sharing options...
rich Posted August 6, 2015 Share Posted August 6, 2015 Here this should help! http://www.doolwind.com/blog/phaser-with-visual-studio-2015-and-typescript/ Link to comment Share on other sites More sharing options...
blinkok Posted August 7, 2015 Author Share Posted August 7, 2015 ok. i need to create a project for each example. no worries.i downloaded the breakout example and copied the code into studio, copied the assets into my base directory and built the project. it built no worries but it seems to be having issues with some sprites (it uses a .json sprite atlas). i run it and get this (just the starfield first but this after i refresh). FIREFOX browser btw. is this because the sample is js and not typescript? if so are there any complete game examples in typescript? Link to comment Share on other sites More sharing options...
yahiko Posted August 7, 2015 Share Posted August 7, 2015 You should ensure you run your Web application with a Web Server (IIS, Apache, etc) throught localhost. Link to comment Share on other sites More sharing options...
qdrj Posted August 7, 2015 Share Posted August 7, 2015 Also make sure that paths to your assets are resolving correct from JS file (which outputed by ts compiler). Link to comment Share on other sites More sharing options...
blinkok Posted August 7, 2015 Author Share Posted August 7, 2015 i do believe both of these things are correct. i am running WAMPSERVER and as you can see it finds the starfield.jpg file which is in the same place as the other assets. do you think it has to do with the fact that the other sprites are in a .json sprite atlas?i am using the code from this example http://phaser.io/examples/v2/games/breakout Link to comment Share on other sites More sharing options...
yahiko Posted August 7, 2015 Share Posted August 7, 2015 If you would mind to post your code, it would help other people to help you. Link to comment Share on other sites More sharing options...
qdrj Posted August 7, 2015 Share Posted August 7, 2015 Are there any errors in console? FF can't parse json files with any encoding except UTF-8. E.g. when you exporting atlas from Flash IDE it use UTF16LE encoding and game won't load in FF. blinkok 1 Link to comment Share on other sites More sharing options...
rich Posted August 7, 2015 Share Posted August 7, 2015 Check the console (or Firebug in FF) and see what errors you've got there. If it was unable to load the image (or json) it will have a Loader error in the console. If it loaded fine but couldn't parse the json (as FF can be fussy about the encoding) then you'd have a FrameData related error in there. Try with something simpler maybe? For example in the 'create' folder you'll find a game called 'rat attack'. Does that work? It's one single JS file, no assets, so is a good place to start testing. Link to comment Share on other sites More sharing options...
blinkok Posted August 7, 2015 Author Share Posted August 7, 2015 ok it's the parsing of the json file. i get this error;JSON.parse: unexpected character at line 1 column 1 of the JSON data" Link to comment Share on other sites More sharing options...
blinkok Posted August 7, 2015 Author Share Posted August 7, 2015 ok trying the "rat attack" game.i paste the code and run it. the game works but i am left with quite a few compile errors;Error 1 Property 'create' does not exist on type 'Game'. C:\Users\tony\documents\visual studio 2013\Projects\move an image\move an image\app.ts 16 10 move an imageError 2 Property 'create' does not exist on type 'Game'. C:\Users\tony\documents\visual studio 2013\Projects\move an image\move an image\app.ts 32 10 move an imageError 3 Property 'create' does not exist on type 'Game'. C:\Users\tony\documents\visual studio 2013\Projects\move an image\move an image\app.ts 53 10 move an imageError 4 Cannot find name 'rats'. C:\Users\tony\documents\visual studio 2013\Projects\move an image\move an image\app.ts 61 5 move an imageError 5 Supplied parameters do not match any signature of call target. C:\Users\tony\documents\visual studio 2013\Projects\move an image\move an image\app.ts 61 12 move an imageError 6 Cannot find name 'rats'. C:\Users\tony\documents\visual studio 2013\Projects\move an image\move an image\app.ts 66 19 move an imageError 7 Cannot find name 'player'. C:\Users\tony\documents\visual studio 2013\Projects\move an image\move an image\app.ts 71 5 move an image*** Many more errors **why is it so? Link to comment Share on other sites More sharing options...
Tom Atom Posted August 8, 2015 Share Posted August 8, 2015 Hi, not sure this is your problem. But if using VS (+IIS), you have to adjust web.config file like this, so it knows json. Adjust it and try to run your game with default VS settings (running in IE with IIS). If it works then move step by step to other server/browser of your choice. If I remember well IE is only browser that supports debugging with VS+TS.<configuration> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web> <system.webServer> <staticContent> <mimeMap fileExtension=".json" mimeType="application/json" /> </staticContent> </system.webServer></configuration>Regarding errors with rat attack: I do not know what game it is. If it is JS source and you are putting it into typescript files, then yes: it will run and it will give a lot of errors in IDE. This is because in source will be lot of things, that are not OK in typescript, while are OK in javascript. Link to comment Share on other sites More sharing options...
Fairydhwen Posted August 9, 2015 Share Posted August 9, 2015 Its more simple to use Visual Studio Code (Preview and Free). You can check my video on how to set up it with Phaser and TypeScript (but its in french) : Link to comment Share on other sites More sharing options...
blinkok Posted August 11, 2015 Author Share Posted August 11, 2015 thanks for the video but unfortunately i don't understand french ( i will investigate it further though) sorry to be such a pest. i am trying this with the simplest code here;http://phaser.io/examples/v2/create/generate-sprite i get the following error (but the app still works);Error 1 Property 'create' does not exist on type 'Game'. for the following linegame.create.texture('phaserDude', dudeData, 4, 4, 0);my questions are;where is this definition (create)?how do i know if i should ignore this error? Link to comment Share on other sites More sharing options...
Recommended Posts