khleug35 Posted October 9, 2017 Share Posted October 9, 2017 Could I code for a function in timer.events directly?? here is my code Normally ,The following code is work for me!!!!!!! game.time.events.add(Phaser.Timer.SECOND * 4, player_kill, this); function player_kill() { player.kill(); } but Is it possible to code for a function in timer.events directly??? THX Maybe like this , but the following code is not work, did I made a mistake?? Thank you so much game.time.events.add(Phaser.Timer.SECOND * 4, player.kill(), this); //not work Link to comment Share on other sites More sharing options...
samme Posted October 9, 2017 Share Posted October 9, 2017 game.time.events.add(Phaser.Timer.SECOND * 4, player.kill, player); Link to comment Share on other sites More sharing options...
khleug35 Posted October 9, 2017 Author Share Posted October 9, 2017 1 hour ago, samme said: game.time.events.add(Phaser.Timer.SECOND * 4, player.kill, player); THX, samme this code is work for me !!! thx but I am sorry about that, I have an other problem now..... I want to change state on timer........... the following code is not work, did I made a mistake?? Thank you so much this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start('gameover'), this);//not work this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start, this, 'gameover');//not work this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start, 'gameover');//not work this.time.events.add(3000, this.state.start, this, ['gameover']);//not work Link to comment Share on other sites More sharing options...
samme Posted October 9, 2017 Share Posted October 9, 2017 this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start, this.game.state, 'gameover'); Link to comment Share on other sites More sharing options...
khleug35 Posted October 9, 2017 Author Share Posted October 9, 2017 45 minutes ago, samme said: this.time.events.add(Phaser.Timer.SECOND * 4, this.game.state.start, this.game.state, 'gameover'); Thank you very much!!!!samme, thank you for your help!!!!!!!!! i am sorry about that i am so stupid......... ,but thank you for your help!!!! Link to comment Share on other sites More sharing options...
Recommended Posts