Jump to content

Problem with game showing


Gritwork
 Share

Recommended Posts

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

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.

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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