Jump to content

How to pass arguments to a callback function?


yltang
 Share

Recommended Posts

How do I pass arguments to a callback function? For example:

var main = {  ...  create: function () {    this.cursor = game.input.keyboard.createCursorKeys();  },  update: function() {    game.physics.arcade.collide(this.player, this.platforms, null, this.ignoreCollision);  },  ignoreCollision: function(player, platform) {    if (this.cursors.down.isDown) {      return false;    }    return true;  },}

'this.cursors' is undefined. I guess I have to pass 'this' to 'ignoreCollision'. How do I do that?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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