blinkok

noob here: where do i install phaser for typescript/visual studio 2013

Recommended Posts

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 sense

thanks in advance

 

Share this post


Link to post
Share on other sites

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.

bo1_zpszw0dzjuc.png

 

is this because the sample is js and not typescript? if so are there any complete game examples in typescript?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 line

game.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?
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.