Jump to content

Black page, nothing showing.


fiverivers
 Share

Recommended Posts

Here is my code:

 

 

<!doctype html> 

<html lang="en"> 
<head> 
<meta charset="UTF-8" />
<title>Phaser - Making your first game, part 1</title>
<script type="text/javascript" src="js/phaser.min.js"></script>
    <style type="text/css">
        body {
            margin: 0;
        }
    </style>
</head>
<body>
</body>
</html>

 

 

var game = new Phaser.Game(500, 600, Phaser.AUTO, 'game_div');

 
var main_state = {
    function: preload() {
       game.load.image('bman', 'bman.png');
    }
 
    function: create() {
        this.bman_sprite = game.add.sprite(250, 300, 'bman');
    }
 
    function: update() {
 
    }
}
 
game.state.add('main', main_state);
game.state.start('main');

 

 

I'm just presented with a blank screen. I am hosting with XAMPP.

Link to comment
Share on other sites

you need to add the src for the game.js in the index.

<script src="Game.js"></script>

so it would be:

<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /><title>Phaser - Making your first game, part 1</title><script src="phaser.min.js"></script><script src="game.js"></script>    <style type="text/css">        body {            margin: 0;        }    </style></head><body></body></html>

Assuming your game file is called game.js anyway.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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