Hi all I’m starting with phaser, and as a first project I wanted to create a small idler game, the only tutorial I found is this one Phaser Tutorial I found this is the code that Im stuck at as I believe this code was created on an older version f phaser, this is the code:
I keep getting this error: Uncaught TypeError: this.state is undefined and Im not really sure what to look at, could anyone please help me? the error is on this line: monster = state.monsters.create(1000, state.game.world.centerY, data.image);
Full code below:
`var monster;
monsterData.forEach(function(data) {
// create a sprite for them off screen
monster = state.monsters.create(1000, state.game.world.centerY, data.image);
// center anchor
monster.anchor.setTo(0.5);
// reference to the database
monster.details = data;
//enable input so we can click it!
monster.inputEnabled = true;
monster.events.onInputDown.add(state.onClickMonster, state);
});`