I’m new to Phaser, and I’m making my first game with it. I’m trying to create a main menu screen, and I want to make it so when a player clicks the right button, the game starts. But when I start my code, it says SetInteractive is not defined. Please can someone tell me how to fix this? Here is the code from the main menu scene.
constructor(){
super(‘MainMenu’);
}
preload(){
this.load.image(‘MainMenu’, ‘assets/menuscreen.png’);
this.load.image(‘Play’, ‘assets/Play Button.png’);
}
create(){
this.add.image(400, 300, ‘MainMenu’);
this.playbutton == this.add.image(400, 360, ‘Play’);
this.playbutton.setInteractive();
}
update(){
this.input.on('gameobjectdown',StartPlay);
onObjectClicked(pointer,this.playbutton)
{
StartPlay
}
function StartPlay(){this.scene.start('levelOne') }
}
}