javascript - arcade physics collision callback for group vs self -
im checking group collision within using code
// creating group , adding sprites policecarsgroup = game.add.group(); addpolicecars(4 , policecarsgroup); and in update function
game.physics.arcade.collide(policecarsgroup); it work fine there no callback function how set tried
game.physics.arcade.collide(policecarsgroup,function(){ alert(""); }); but not working question how set collision callback function .
you need pass second parameter collide method check collision against, hence it's third parameter callback. see the documentation. try this:
game.physics.arcade.collide(policecarsgroup, policecarsgroup, function() { alert("collision!"); }); haven't tried it, should work.
Comments
Post a Comment