Jump to content

Phaser App in Visual Studio community


Karthika G
 Share

Recommended Posts

Hello,

I have been working on a Phaser game and I would like to publish it in ios and android.It works good in browser.

Can I use "Visual studio community" to publish the app using Cordova. Is it possible to build an apk through Visual Studio.

Any help is appreciated.

Link to comment
Share on other sites

Yes. You can use visual studio community 2015 with TACO (tools for apache cordova).

Just download and install that version of VS and make sure you have TACO selected. The installation is pretty straighforward.

Then just create a new cordova project and build it.

after the build is succesful you get your apk to upload to play store.

If you use crosswalk make sure you upload both arm and x86 apks. You can have the 2 published.

My own game, in my signature, is built this way.

For IOS you need to configure a connection to an OSX with Xcode installed. I havent tried this because I dont have a mac to compile and Apple devices to test.

Link to comment
Share on other sites

Hi, I did it too. Also for iOS. Unfortunately, I had problems because of different Cordova versions on PC and Mac. But VS builds whole XCode project for you. I took it, copied it into Mac, opened in XCode and built it there.

Just one remark. I had lot of fighting with symlinks in framework libraries (AdMob, Heyzap, ...). It looks that windows and OS X were killing it in many cases and then I got linker errors. Solution was to check if these links are present and if not then recreate it. For reference look here: https://stackoverflow.com/questions/15101778/ios-custom-framework-framework-file and here http://stackoverflow.com/questions/34449097/symlinks-corruption-in-ios-custom-framework. (Also downloading and unpacking framework directly into Mac helped, but always check if links are there). Also check this: https://taco.visualstudio.com/en-us/docs/tips-and-workarounds-ios-ios-plugin-symlink-fix-readme/

 

Link to comment
Share on other sites

Thanks Bruno and Tom. I have not tried for iOS still. Hope your reference links will help me.

I am using Visual Studio with TACO for building my Phaser App. I can run my Phaser code now.

Also, I want to add Box2D Physics in my Phaser App. I am getting errors in setting the Physics system.

For example;

Uncaught TypeError: Cannot read property 'setBoundsToWorld' of null

Similarly, I get errors in all lines related to Physics.

I am searching for solutions. Help me in this case.

 

 

Link to comment
Share on other sites

Thanks for your continued support. I am using Phaser custom build (http://phaser.io/tutorials/creating-custom-phaser-builds). Hope Box2d is a separate plugin and the list of optional modules of Phaser does not contain Box2d. Hence I added Box2d plugin also in my project.

Box2d and all phaser functions works well when I code in a text editor and run in localhost.

But I get errors in VS. I tried console.log in each and every line and found this difference. Phaser.Physics.box2d is null in VS. 

See attached screenshot. Please tell me where I am going wrong.

error_vs.jpg

Link to comment
Share on other sites

Hi,

 first, box2D does not need custom build of Phaser. It works well with deafult build.

 To make it run, be sure you have all these scripts in index.html:

    <script src="js/phaser.min.js"></script>
    <script src="js/box2d-plugin-full.js"></script>
    <script src="js/your_game.js"></script>

 Make sure, you have defs (phaser_box2d.d.ts) where VS can find it (are you using lib folder?)

 In game, make sure you first initialize physics system:

            this.game.physics.startSystem(Phaser.Physics.BOX2D);
            var physics = <Phaser.Physics.Box2D>this.game.physics.box2d;

            if (physics !== null) {
                console.log("box2D initialized");
            }

 

Link to comment
Share on other sites

Thanks for the apt help. :)

I have been developing a Javascript game so far, without any type def files, I tried add the d.ts files in the same project. It didn't work out. Hence I am currently developing the same as a new typescript, html game with all the necessary type defs added. It solved my major issue in adding box2d physics. I am aiming to convert it as Apache Cordova App. Hope it will work out. Will post again in case of any issues.

I am very new to Phaser and gaming. This community helped me a lot. Thanks.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...