Navigation

Part 6 - Hello World!

Published on 14th February 2018

With your editor set-up, web server installed and Phaser 2 downloaded it's time to create something and check everything is working.

You need to discover where your 'web root' is on your machine. This is the folder in which the server looks for files. If you are using WAMP on Windows you can locate it by clicking the WAMP icon in your system-tray and select "www directory" from the pop-up menu. Other servers will have other methods of determining the location, but from this point on we'll refer to it as the 'webroot'.

Download this zip file. It contains a folder called 'hellophaser' inside which you'll find a JavaScript file, an index.html and a PNG. Copy the 'hellophaser' folder to your webroot.

Testing, testing ...

Open your web browser and browse to the hellophaser folder on local server. This may be as simple as typing in localhost/hellophaser or 127.0.0.1/hellophaser into your browser. Or you may need to specify a port number as well, it depends entirely on which server set-up method you used.

If everything goes right it will display a black game area with a phaser logo in the middle.

If it doesn't for whatever reason you need to bring up the debug console and see what errors are output. In most browsers you can do this by pressing F12. This works in Chrome, Firefox and Internet Explorer 11. Check to see what the error is, hopefully it's a simple one like a file being missing, in which case check your folder names and refresh the page.

If it's something more complex feel free to post about it on the forum and we'll try our best to help.