fkkcloud Posted March 6, 2016 Share Posted March 6, 2016 Hi, what is the reference variable pointing to the owner of the callback function? such as this.game.physics.arcade.overlap(SpriteA, SpriteB, callback, null, this); in the callback function, how do we point to SpriteA or SpriteB? Link to comment Share on other sites More sharing options...
mattstyles Posted March 6, 2016 Share Posted March 6, 2016 I just wrote out a nice answer about how you can use closure to pass parameters through functions and then decided to read the Phaser docs, should have started with the docs http://phaser.io/docs/2.4.4/Phaser.Physics.Arcade.html#overlap `spriteA` and `spriteB` should be passed to the callback so something like this.game.physics.arcade.overlap( SpriteA, SpriteB, function( a, b ) { console.log( a, b ) }) should work out just fine. fkkcloud 1 Link to comment Share on other sites More sharing options...
Recommended Posts