Jump to content

What does the "callbackContext" mean in "physics.arcade.overlap(..., callbackContext);"?


yltang
 Share

Recommended Posts

I am a newbie for Phaser and am following the Phaser documentation "collect stars". 

 

There is one statement:

 

game.physics.arcade.overlap(obj1, obj2, overlapCallback, processCallback, callbackContext);

 

I wonder what "callbackContext" means and how to provide a proper value for it? The tutorial uses "this" (again, what does this mean?), however, giving it "null" is also OK. Can anybody shed some light on it? Thanks

 

Link to comment
Share on other sites

If your game is using a single state running out of the global scope, then 'null' will work fine. As soon as you move on to using more complex set-ups (i.e. properly split game states) it'll no longer work.

 

There are lots of cases where 'this' doesn't work as the context. You just won't encounter them in the examples because we boil it down to the most simplest form it can be.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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