![]() Torque2dMit to Phaser ConverterTIPS ON USING THE TORQUE2D MIT TO PHASER CONVERTERThe following tips will help guide you with getting started with the Torque2dMitToPhaserConverter. 1. DOWNLOAD VISUAL STUDIO Visit https://visualstudio.microsoft.com to install Visual Studio on your machine if you haven't already. Note that I recommend Visual Studio Community 2019 for anyone using a Windows environment, and Visual Studio Code for any other environment (ie MacOS, Linux). Note that while you are installing Visual Studio, you will want to make sure the ".NET desktop development" option (aka module/workload) is selected. If you are new to .NET Framework / C# development, you may need to go through some tutorials and learn some things. You may want to try this URL as a starting point for learning how to work with .NET Applications in C#: 2. DOWNLOAD (OR GIT CLONE) PHASER You will need Phaser in order for your output project from Torque2dMitToPhaserConverter to work. Find out more about Phaser here: 3. NAVIGATE TO THE CORRECT FOLDER FOR THE TORQUE 2D MIT PROJECT SOURCE (IE THE 'modules' FOLDER) It is important that when you run the Torque2dMitToPhaserConverter that you pick the correct source folder for the Torque2D MIT project. You want to specifically pick the 'modules' folder. In other words, pick the modules folder, the one that will contain the 'AppCore' folder, and likely one (or maybe multiple) other folder(s) that contains the actual video game you are developing (ie in my case, the 'PuzzleGalaxies' folder). 4. INCLUDE THE phaser.js FILE INTO THE ROOT FOLDER OF YOUR OUTPUT DIRECTORY After you have successfully converted a project, you should see in your 'output' folder a few folders (ie 'assets', 'scripts', 'util', etc) along with some files (ie 'index.html', etc). In this folder, you need to copy into it the 'phaser.js' file from the Phaser repo (should be located in the 'dist' folder). Without this file, the Phaser project will not function correctly. 5. PLACE THE ITEMS IN preload.js FILE INTO THEIR RESPECTIVE SCENE preload() METHOD(S) The Torque2dMitToPhaserConverter cannot determine where to place the preload items by itself. You will need to copy/paste the items generated in preload.js into their respective Scene 'preload' method(s). As you would imagine, the items that should go into the preload method of a scene are the ones that are associated with the assets that the respective scene requires. 6. THE ORDER OF THE SCENES IN THE index.html FILE MATTERS From what I have seen so far, it seems the order of the scenes listed in the Phaser.Game 'config' matter. You may want to try re-ordering the scenes (ie in the order in which they execute) to try to get your Phaser output project to work. If this still doesn't work, then consider removing all scenes except one and seeing if this works and then add the others back in. 7. THE PleaseWait FORM CAN BE DISABLED IF YOU WISH Sometimes the 'Please Wait' form that displays while the Torque2dMitToPhaserConverter is converting a project is undesirable. If you want to disable it, set the 'enablePleaseWaitDialog' boolean to false in the FormTorque2dToPhaserConverter class file. 8. SET THE enabled PROPERTY OF SCENE TO 'true' IN ORDER TO ENABLE/TURN ON A SCENE Since Scenes that are output by the Torque2dMitToPhaserConverter derive themselves from the SceneBaseClass, you will want to turn on/off scenes by setting the 'enabled' property to true (ie when you actually want a scene to be displayed). You will need to modify your output project (manually) in order to implement this. 9. THE Torque2dMitToPhaserConverter PROJECT IS IN AN 'ALPHA' STAGE OF DEVELOPMENT. DO NOT EXPECT IT TO FULLY CONVERT YOUR PROJECT. Finally, you cannot expect your project to be fully converted and work first try after converting it and setting it up on your local web server. The Torque2dMitToPhaserConverter is not really a complete project and it will take some more time and development before it is able to convert 'first try'. 10. FOLLOW THE PHASER GUIDE ABOUT SETTING UP A (LOCAL) WEB SERVER. THIS IS SOMETHING YOU NEED TO DO! Setting up a web server to run your Phaser project is required! It is tempting to simply open your web project up by double-clicking the index.html file (ie opening it from the file system) and thus opening it in Firefox/Chrome/Edge/etc to see how it runs, but it won't run properly. Phaser requires that you run your project on a webserver (ie http://localhost) in order to run properly. I used the recommended 'WAMP Server' that Phaser recommends, and it worked nicely for me (but feel free to try other web server options if you wish). 11. INCLUDE THE webfont.js FILE INTO THE ROOT FOLDER OF YOUR OUTPUT DIRECTORY
You also need to include the webfont.js file into your repo. Either download the webfont.js file from the following URL:
Hopefully the tips above will answer some of the questions you may have when running the Torque2dMitToPhaserConverter. However, if you still need more help feel free to email me at jeffmoretti@evermoregamestudios.com. Website background provided courtesy of pngtree.com <= BACK TO HOMEPAGE |