Jump to content

Uncaught ReferenceError: game is not defined


Bobcp
 Share

Recommended Posts

Hello, i'm a newbie on js.

 

I try to create a game on Phaser and use requirejs. I write this code

'use strict';requirejs.config({  baseUrl: 'game',  paths: {    Phaser: 'js/phaser.min',    BootState: 'states/boot',    MenuState: 'states/menu',    PreloadState: 'states/preload',  }});var BootState = require(['Phaser']);var MenuState = require(['MenuState']);var PreloadState = require(['PreloadState']);     new Phaser.Game(1334, 750, Phaser.AUTO, 'flappy-bird-reborn');// Game Statesgame.state.add('boot', BootState);game.state.add('menu', MenuState);game.state.add('play', PlayState);game.state.add('preload', PreloadState);game.state.start('boot');

And have this error,  Uncaught ReferenceError: game is not defined.

 

How to fix that?

Thank you

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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