Jump to content

Possible way to figure out problem?


Hazukiy
 Share

Recommended Posts

Hi, so I'm creating a small game in Sublime Text using Phaser and I've found that it's extremely hard to determine problems with my code. Sometimes I upload my .html document to my web host and the screen just goes black, which indicates that the game hasn't loaded, right? My question is, is there a more efficient way of finding out what is causing the game to not load or potential problems? I've just come back to doing this and I can't remember the last thing I did to it so backtracking what I did wouldn't be a solution :'(

 

Link to comment
Share on other sites

Hello,

 

check your browser console to see if there are any messages regarding the current problem, try using dev tools, you can also try JShint to narrow it down and for overall check up.

 

Unfortunately, with javascript the only reliable way to check where the issue is happening is to use console.log() and go through your code step by step.

 

Though I would recommend testing on local machine before testing on outside server, time spent uploading and re-caching on local computer is way shorter and you eliminate one possible error-making way.

Link to comment
Share on other sites

Chrome DevTools (hit F12) are your friend. You can set break points, you can tell it to halt on errors (before the error happens!), you can step through code execution line by line (or even skip lines), you can (while execution is halted) mouse over variables in the code and inspect all their values, and much much more. It's an invaluable helper!

Link to comment
Share on other sites

Just to add, I'm using Sublime as well, and there's a plugin in Package Control called SublimeLinter, which is an interface to JSHint. Download both and you will be notified of potential javascript errors live in Sublime.

 

But it's not perfect. It won't simulate it(would be annoying in its own right), so like the others said, F12(or Ctrl+Shift+J) in Chrome(don't know about other browsers) will definately help you track down bugs as well.

Link to comment
Share on other sites

Hello,

 

check your browser console to see if there are any messages regarding the current problem, try using dev tools, you can also try JShint to narrow it down and for overall check up.

 

Unfortunately, with javascript the only reliable way to check where the issue is happening is to use console.log() and go through your code step by step.

 

Though I would recommend testing on local machine before testing on outside server, time spent uploading and re-caching on local computer is way shorter and you eliminate one possible error-making way.

 

I COMPLETELY forgot about that, thanks a bunch ;D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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