kstamatov85 Posted September 5, 2015 Share Posted September 5, 2015 Hi guys, I'm trying to pass a agrument to a callback function from a time event. Unfortunately I cant figure it out how.var bullet = this._bulletGroup.getFirstDead();this.time.events.add(1100, this.splashBullet, this);How to pass the 'bullet ' object to splashBullet function? it is not part of 'this' scope. Link to comment Share on other sites More sharing options...
DonFrag Posted September 5, 2015 Share Posted September 5, 2015 you could try to use an anonymous function and inside of it you could call this.splashbullet with params Link to comment Share on other sites More sharing options...
kstamatov85 Posted September 5, 2015 Author Share Posted September 5, 2015 I found the answer, unfortunately it was straight forward.var bullet = this._bulletGroup.getFirstDead();this.time.events.add(1100, this.splashBullet, this, bullet);splashBullet: function( {console.log( // bullet object}Shame on me but anyway, hope this will help someone Phaser911 1 Link to comment Share on other sites More sharing options...
Recommended Posts