Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

overlap function call with parameter - Phaser 3


Christian981
 Share

Recommended Posts

I have this code:

scene.physics.add.overlap(spears.children.entries[numberOfSpearThrowerMachines], platforms, stopSpear, null, this);


function stopSpear(number) {
    spears.children.entries[number].setVelocityX(0);
}

I am trying to send a parameter to the function stopSpear when calling it.

Like this:

scene.physics.add.overlap(spears.children.entries[numberOfSpearThrowerMachines], platforms, stopSpear(numberOfSpearThrowerMachines), null, this);

but this does not work obviously, so how do I do it instead?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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