Jump to content

Really Basic Setup question


TboneXXIV
 Share

Recommended Posts

So, I just started trying to learn Phaser today and ran into an issue that's got me stopped for about an hour now.  I looked around for a while and i am not finding the answer, though it would seem like this is something I'm overlooking probably rather than something that isn't out there...

Following along the Phaser 3 tutorial found at http://phaser.io/tutorials/getting-started-phaser3/index I installed Wamp and Atom and got that going but actually installing Phaser I sort of ran into a disconnect.  I know nothing about github and while I was able to download a copy of Phaser zipped an unzip it, I can't find the right directory to domicile it into for it to work.  I've tried copying it into the www directory of my Wamp folder but that's not working and I don;t want to just flail along randomly putting copies of it somewhere until something works.  

Where is the right place to place the contents when I unzip phaser3.3.0.zip?

Thanks in advance for the help.

 

Link to comment
Share on other sites

  • 3 weeks later...

I'm having a similar issue with the same part of the tutorial, so I thought I'd comment here. 

I'm completely new to this as well, just trying to get set up so that I can start doing some practice tutorials. I've also installed the zip file, and copied phaser.js into the  WAMP www directory.

 

The code I've used in my index.html file is exactly as given here.

When I load the file in Chrome, I get the following error messages and a blank, white page: (See Screenshow below)

`phaser.min.js Failed to load resource: phaser.min.js
net::ERR_FILE_NOT_FOUNDindex.html:10

Uncaught ReferenceError: Phaser is not defined    at index.html:10`

 

I've tried renaming the file to "phaser.min.js" after these error messages, but still no luck.  

image.thumb.png.abd55653143e101bd50c0b291750b502.png

I have no idea what could be going wrong here. Any advice would be greatly appreciated!

Link to comment
Share on other sites

@syntaxidermy

You're loading Phaser from an external source, although I still have little idea why it doesn't work for you, the following is fine for me:

5ae1b50767fad_ScreenShot2018-04-26at12_14_34.thumb.png.d7378d112fb6886ca72c7aee41d7d1f9.png

I'm not using WAMP though, but a different server. It shouldn't make any odds though, but, in any case, you're not loading from the remote source for some reason, doesn't look related to your HTML though.

You do get that EXACT error from file protocol though which won't access the internet.

Are you absolutely sure you're hitting the WAMP server to grab the HTML file?

Using `script src='./phaser.min.js'` should work from file though, not the `./` to make it a relative link.

 

Link to comment
Share on other sites

  • 1 month later...

Ah, I see, without the specific protocol on the remote request it defaults to the protocol you were using, which was presumably 'file://', which, even if you had specified the protocol for the CDN wouldn't have worked anyway. Yeah, localhost has an http protocol so it would then route out to the internet.

Good work solving it.

Link to comment
Share on other sites

@TboneXXIV 

If you wanna load it locally, just place it in the same folder as your index.html for a start and you can call it simply with the following line in your HTML file:

<script type="text/javascript" src="phaser.min.js"></script>

If it was in a subdirectory of where your index.html file is located, in the folder "scripts" lets say, you would call it like this from your HTML file:

<script type="text/javascript" src="scripts/phaser.min.js"></script>

Usually you call files relative to where your index.html is located, so if your file is in a subdirectory called scripts one folder above where your index.html is located, you would call it like this:

<script type="text/javascript" src="../scripts/phaser.min.js"></script>

../ makes it go one folder up in the folder tree, starting from where your index.html is.

So it doesn't really matter where you locate it, as long as set the relative path to it correctly. If that troubles you, your safest would be just locating it in the same folder as your index.html and call it like in the first example. Or you do it like syntaxidermy and call your file from an absolute path in form of an URL that points to the file hosted on a server, like this:

<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>

Hope that is of help, you can learn more about it here https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/Dealing_with_files

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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