Code Problem need help

Hey guys, im doing a tutorial and i get an error… probably something easy to solve, but seeing im new in the phaser 3 i cant find the problem.

“use strict”;

var Jogo = Jogo || {};

var config = {

width: 800,
height: 600,
renderer: Phaser.Auto

};

Jogo.game = new Phaser.Game (config);
Jogo.game.state.add (“Inicial”, Jogo.inicial);
Jogo.game.state.start (“Inicial”);

Dont know if work here.

The error message i get: “Uncaught TypeError: Cannot read property ‘add’ of undefined
at Game.js:14”

game.state.add is a Phaser 2 API, and isn’t compatible with Phaser 3. Take a look at the phaser 3 tutorial (https://phaser.io/tutorials/getting-started-phaser3) to get started with its API.

1 Like

hmmm, understand, thanks man.

the tutorial im following is old…

so i go need compare the code everytime.