Hazukiy Posted June 22, 2015 Share Posted June 22, 2015 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 More sharing options...
0penS0urce Posted June 22, 2015 Share Posted June 22, 2015 I personally use Brackets, mostly since you can easily view your code on a web server using live preview, and it's just easy to use. I used to use Sublime Text, but you should give Brackets a shot. Link to comment Share on other sites More sharing options...
AzraelTycka Posted June 22, 2015 Share Posted June 22, 2015 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 More sharing options...
wayfinder Posted June 23, 2015 Share Posted June 23, 2015 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 More sharing options...
MikauSchekzen Posted June 23, 2015 Share Posted June 23, 2015 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 More sharing options...
Hazukiy Posted June 23, 2015 Author Share Posted June 23, 2015 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 More sharing options...
Recommended Posts