Jump to content

Needing Help with Phaser


Simeon
 Share

Recommended Posts

Hey Guys,

      I am a prospective game developer learning to make HTML5 games with Phaser. To do this, I am following a tutorial

 right now. 

      Right now, my code isn't seem to be working properly. I have set up my Main.js file to just show an empty blue screen, like this:

3_empty.png

But for some reason, I get a black screen instead. I have set the background color to the hexadecimal code for blue.

 

So if possible, please help me solve this problem, and be sure to give me some advice on Phaser.

 

Thank You 

- Simeon

 

Main.js code:

 

// We create our only state, called 'mainState'var mainState = {    // We define the 3 default Phaser functions    preload: function() {        // This function will be executed at the beginning           // That's where we load the game's assets    },    create: function() {         // Change the background color of the game         game.stage.backgroundColor = '#3498db';                // Tell Phaser what type of Physics we will be using         game.physics.startSystem(Phaser.Physics.ARCADE);    },    update: function() {        // This function is called 60 times per second         // It contains the game's logic    },    // And here we will later add some of our own functions};// Create a 500px by 340 px game in the "gamediv" element on index.htmlvar game = new Phaser.Game(500, 340, Phaser.AUTO, 'gamediv');// Add the mainstate to Phaser and make it the main game.state.add('main', mainState);game.start.state('main');

first game.zip

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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