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

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -