Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

So in the console I'm not seeing "Phaser is not defined", I'm seeing this (on page load):

TypeError: game.state is undefined[Learn More] main.js:63:1
    <anonymous> file:///home/alex/Downloads/RocketSpam/main.js:63:1
Okay. You have defined "game" in the line above, but it doesn't have a property called "state". I can check that by typing "game" into the console and hitting enter. I can then expand the arrow to see the full "game" object including all its properties.


So for example, "game.anims" exists. "game.config" exists. etc. But no "game.state". Why?

In the docs for Phaser 2.6.2 it does appear that "game.state" should exist. However, in the console it also shows this message when the page loads:

     Phaser v3.14.0 (WebGL | Web Audio)  https://phaser.io

I can see we're using Phaser 3.14. Looking at the 3.14 docs for "Game", I cannot find any mention of "game.state". I'm guessing that Phaser 3 works differently.

My guess is that you're following a tutorial or guide that assumes you're working with Phaser 2, but you actually have Phaser 3 installed. I've never used Phaser before so I can't tell you specifically what you need to do to make it work, but maybe you can find a Phaser 3 tutorial instead.