Gritwork Posted February 23, 2015 Share Posted February 23, 2015 So I've just started learning Phaser and I have all of my files set up in an asset and js folder. I'm using Mongoose Web Server for testing and at first I had everything working. The black background was up and I had an image displaying on the screen. Now when I try it, the page is just blank white. I don't know what I could have done wrong for this to occur. My code looks as follows:<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Simian Scamper</title> <script type="text/javascript" src="js/phaser.min.js"></script> <style type="text/css"> body { margin: 0; } </style></head><body><script type="text/javascript"> var game = new Phaser.Game(1280, 960, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload() { game.load.image('ceiling', 'assets/ceiling.png'); game.load.image('floor', 'assets/floor.png'); } function create() game.add.sprite(0, 0, 'ceiling'); } function update() { }</script></body></html>The very most basic a program can be. What could be the possible issue? Link to comment Share on other sites More sharing options...
ZeroGravity Posted February 23, 2015 Share Posted February 23, 2015 If you see my previous answer, forget that, I was wrong - your problem is here function create() game.add.sprite(0, 0, 'ceiling'); }You missing { - so thats why you program behaves badly. Add that and you probably can move forward. function create() { <--- THIS HERE game.add.sprite(0, 0, 'ceiling'); } Gritwork 1 Link to comment Share on other sites More sharing options...
stupot Posted February 23, 2015 Share Posted February 23, 2015 ZeroGravity is right, your code will throw a runtime exception. Next time something wierd happens, open up the browser development tools (F12 mostly on win OS's) and check the console for warnings to help pinpoint the problem. Also, maybe use a proper javascript editor that will parse your code and notify you of this sort of problem before you even try it in the browser. Gritwork 1 Link to comment Share on other sites More sharing options...
Gritwork Posted February 23, 2015 Author Share Posted February 23, 2015 I don't even know how that happened or how I overlooked it in the end. I have it all working once again. Thank you guys. What would be a good javascript editor to use? I'm using Notepad++ right now because I'm just learning it and I don't have a lot of money to invest upfront into it. Link to comment Share on other sites More sharing options...
MikeT Posted February 23, 2015 Share Posted February 23, 2015 I don't even know how that happened or how I overlooked it in the end. I have it all working once again. Thank you guys. What would be a good javascript editor to use? I'm using Notepad++ right now because I'm just learning it and I don't have a lot of money to invest upfront into it. I use Brackets (Free at http://brackets.io/). It even sets up a server for you for real-time testing. Gritwork 1 Link to comment Share on other sites More sharing options...
Gritwork Posted February 23, 2015 Author Share Posted February 23, 2015 I use Brackets (Free at http://brackets.io/). It even sets up a server for you for real-time testing.Thanks for the heads up. I'll be sure to check it out. Link to comment Share on other sites More sharing options...
Recommended Posts