Andrew Fleming Posted April 29, 2013 Share Posted April 29, 2013 Hello,I'm attempting to follow the tutorial found here: http://jessefreeman.com/game-dev/building-a-html5-game-with-phaser/ but I'm stuck from the start! I need some guidance please. I have MS VS Express 2012 for Web installed and running, and the Typescript plugin installed. I start up a new project and the boiler-plate demo code works fine (printing the time to the web browser). I can compile and run it using the |> Google Chrome button no problem. I have the Phaser framework downloaded from the github page, the phaser-master with the subfolders of build, Docs, Phaser, Tests, etc. How do I include this in my project? I've never used the new Visual Studio programs, so its possible that is a problem? Thanks in advance for any help! Andrew Link to comment Share on other sites More sharing options...
rich Posted April 29, 2013 Share Posted April 29, 2013 If you can compile the default TypeScript project (the one that is created automatically when you create a new project in Visual Studio) then I would do this: 1) Copy the Phaser folder inside of your project folder. If the repo is checked-out in a folder called phaser, then it would be phaser/Phaser - i.e. the folder that lives at the same level as Docs, Tests, etc. Copy that one to your project folder. 2) Edit app.ts and replace everything with this: /// <reference path="Phaser/Game.ts" />(function () { var myGame = new Phaser.Game(this, 'game', 800, 600);})(); 3) There's on last thing to do. In Visual Studio do "Save All" and then close it down. 4) In Windows Explorer navigate to your projects folder. I'll assume your project is called "game". Inside the folder you will see a csproj file. It has a green C# icon NOT the purple VS icon. Drag this file into EditPad/Notepad/similar. Look for the TypeScript block and edit as like so: <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptIncludeComments>true</TypeScriptIncludeComments> <TypeScriptSourceMap>false</TypeScriptSourceMap> <TypeScriptOutFile>yourgame.js</TypeScriptOutFile> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptIncludeComments>false</TypeScriptIncludeComments> <TypeScriptSourceMap>false</TypeScriptSourceMap> <TypeScriptOutFile>yourgame.js</TypeScriptOutFile> </PropertyGroup> What this is doing is telling TypeScript to compile the whole game into a single JS file called yourgame.js. Also it's telling TypeScript to use ES5 which is really important. Save this file then open Visual Studio again. 5) Edit the default.htm file that it created for you - at the top where it includes app.js change this to yourgame.js 6) Now compile and run. Hopefully (providing all the paths are correct) it will compile and you'll get the standard Phaser boot-screen appear. If you reach this point you're now ready to be able to put whatever code you want into the app.ts file and start experimenting. I would recommend looking at all of the source in the Tests folder first and copying bits of that across. Sorry this sounds long-winded, it's because it is - if TypeScript didn't need the ES5 flag it'd be a lot easier, but alas! Alternatively you could just use JavaScript But as we don't have any docs right now it makes more sense to do the above, then you get code completion / parameter help from VS. digidanger and Andrew Fleming 2 Link to comment Share on other sites More sharing options...
Andrew Fleming Posted April 29, 2013 Author Share Posted April 29, 2013 This is exactly the reply I was hoping for. Thank you very much! I did indeed figure out the ES5 flag, but before it just wasn't working (the <reference> at the top wasn't cooperating). I'll give it another go later this evening. I'll reply with my findings then! Link to comment Share on other sites More sharing options...
rich Posted April 29, 2013 Share Posted April 29, 2013 The thing to remember about the <reference> line is that it's 100% relative to the folder the current TS file is in. Not the whole project, but the actual TS file you have open. If you've done the above correctly, or rather as I meant to explain it, then your project structure should look something like this: yourgame/ Phaser/ gameobjects/ geom/ system/ AnimationManager.ts Basic.ts etc etc ... default.htm app.ts app.css From this structure the reference in app.ts would be Phaser/Game.ts If you created a new folder called "Bob" then the reference from within that would need to be: ../Phaser/Game.ts Andrew Fleming 1 Link to comment Share on other sites More sharing options...
Andrew Fleming Posted April 29, 2013 Author Share Posted April 29, 2013 Alright! Worked like a charm! I'm honestly not sure what my problem was before - but I'm forgetting all the quirkiness I introduced, and building off the new knowledge you've given me. Been looking into doing some HTML5 development - I'm currently an AS3 developer, porting over legacy C++ educational games to Flash, and have given Flixel a whirl a few times, so I'm somewhat familiar with that ecosystem. Thanks again! Link to comment Share on other sites More sharing options...
rich Posted April 29, 2013 Share Posted April 29, 2013 Excellent Until we get some docs sorted out I would strongly recommend just looking at the source to the Tests and copying whatever you feel you need At least Visual Studio will give you method/property lists and such like as you're coding. That should make it more familiar to AS3/FlashDevelop for you. Link to comment Share on other sites More sharing options...
Bengsis Posted May 2, 2013 Share Posted May 2, 2013 For Visual Studio can Visual Studio for desktop work? or i must use Visual Studio for web? Link to comment Share on other sites More sharing options...
rich Posted May 2, 2013 Share Posted May 2, 2013 I use Visual Studio Professional 2012, which is the desktop one, and it works fine. You don't -have- to use TypeScript/Visual Studio of course. It does make things easier, but WebStorm is equally good, and just using normal JavaScript is too (although that's harder until the docs are finished I agree). Link to comment Share on other sites More sharing options...
benny! Posted May 2, 2013 Share Posted May 2, 2013 I am currently testing Phaser/Typescript with FlashDevelop - so far I have got no problems. Link to comment Share on other sites More sharing options...
Bengsis Posted May 3, 2013 Share Posted May 3, 2013 great. maybe i gonna try flash develop first Link to comment Share on other sites More sharing options...
Bengsis Posted May 3, 2013 Share Posted May 3, 2013 Visual Studio for desktop has plugin or addon for TypeScript? Link to comment Share on other sites More sharing options...
digidanger Posted May 3, 2013 Share Posted May 3, 2013 @ benny!how do you set up phaser in flashdevelop ? i tried and it's not working.. Link to comment Share on other sites More sharing options...
benny! Posted May 3, 2013 Share Posted May 3, 2013 @dididanger: i am currently on the run.will setup a small guide on sunday/monday. Link to comment Share on other sites More sharing options...
digidanger Posted May 3, 2013 Share Posted May 3, 2013 that'll be great ! thanks..! Link to comment Share on other sites More sharing options...
rich Posted May 3, 2013 Share Posted May 3, 2013 Visual Studio for desktop has plugin or addon for TypeScript? Yes. Just install TypeScript like normal from the msi (not the node package) and make sure VS isn't running at the time. You will then be able to create a TypeScript project when you start VS. Link to comment Share on other sites More sharing options...
Bengsis Posted May 3, 2013 Share Posted May 3, 2013 ok thank you rich Link to comment Share on other sites More sharing options...
Bengsis Posted May 3, 2013 Share Posted May 3, 2013 but i think for express must using the web. well gonna try later System requirementsSupported operating systems: Windows 7, Windows 8 Windows 8Windows 7Visual Studio Ultimate 2012Visual Studio Premium 2012Visual Studio Professional 2012Visual Studio Express 2012 for Web Link to comment Share on other sites More sharing options...
rich Posted May 3, 2013 Share Posted May 3, 2013 If you have Visual Studio Professional 2012 it definitely works with TypeScript. Express 2012 for Web also works. Is there a Visual Studio Express NOT for web? If so, try it anyway and see - you never know! It may well work, especially as TypeScript adds itself under the C# block anyway. Link to comment Share on other sites More sharing options...
Bengsis Posted May 3, 2013 Share Posted May 3, 2013 Visual Studio Express 2012 for Web Visual Studio Express 2012 for Windows 8 Visual Studio Express 2012 for Windows Desktop Visual Studio Express 2012 for Windows Phone Visual Studio Team Foundation Server Express 2012This is Visual Studio Express list. Anyway gonna try your advise first Link to comment Share on other sites More sharing options...
Mayu Posted May 9, 2013 Share Posted May 9, 2013 Thank you Thank you.. This is what I have been looking for. Thanks to the tutorial here http://jessefreeman.com/game-dev/building-a-html5-game-with-phaser/ Link to comment Share on other sites More sharing options...
Mayu Posted May 9, 2013 Share Posted May 9, 2013 It works fine in Visual Studio 2012 Express for Web. Link to comment Share on other sites More sharing options...
Jesse Freeman Posted May 9, 2013 Share Posted May 9, 2013 Totally my fault, I need to go back and clean up the intro post with a reference to http://jessefreeman.com/game-dev/phaser-project-template/ which will walk you through how I setup a project in Phaser and VisualStudio plus using NodeJS and Grunt to do the builds. Link to comment Share on other sites More sharing options...
Mayu Posted May 9, 2013 Share Posted May 9, 2013 @Jesse FreemanHey thanks for the awesome tutorial. Any dev with nerve to do googling will find the correct resource. Thanks for introducing me to this nice platform. Looking forward to venture into GameDev All credit goes to you in first place. Link to comment Share on other sites More sharing options...
Jesse Freeman Posted May 9, 2013 Share Posted May 9, 2013 @Jesse FreemanHey thanks for the awesome tutorial. Any dev with nerve to do googling will find the correct resource. Thanks for introducing me to this nice platform. Looking forward to venture into GameDev All credit goes to you in first place. All credit goes to Richard, couldn't have done any of this without him creating Phaser. I'll be writing a lot more about it in the up coming weeks. Looking forward to seeing it get to version 1! Link to comment Share on other sites More sharing options...
Jorasso Posted May 10, 2013 Share Posted May 10, 2013 So we have getting started tutorials for Visual Studio and FlashDevelop. Would be really cool to see something similar for Sublime Text or WebStorm to help Mac and Linux users. Link to comment Share on other sites More sharing options...
Recommended Posts