Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Button's Uncaught Error: Phaser.Signal: listener is a required param of add() and should be a Function.


Jaspery
 Share

Recommended Posts

Hello there, I was trying to switch states for my game with buttons. It was working for a moment and then now it throw me this error after I return

 

Uncaught Error: Phaser.Signal: listener is a required param of add() and should be a Function.

 

I looked into this link but it doesn't seem to fix despite try to call it differently

 

Can anyone help me with this?

RENAME_ME.MainMenu = function (game) {};var text;var counter = 0;RENAME_ME.MainMenu.prototype = {create: function () {this.game.stage.backgroundColor = '#cb191f';text = this.game.add.text(250, 16, '', {fill: '#fff'});var btn_startGame = this.game.add.button(this.game.world.centerX, this.game.world.centerY, 'cwa', this.toStartGame, this);btn_startGame.anchor.set(0.5);var btn_leaderboard = this.game.add.button(this.game.world.centerX, this.game.world.centerY + 100, 'cwa', this.toLeaderboard, this);btn_leaderboard.anchor.set(0.5);},update: function(){},toStartGame: function(){this.game.state.start("Game");},toLeaderboard: function(){this.game.state.start('Score');}};
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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