I need to capture the collision of a sword hitting a group

I am new to phaser, I have added an animation with a 'j' key to swing sword , but I need to catch the collision with the 'tree' group when I hit 'J'

I am trying this with phaser 2 but not sure where should I put the arcade.collide..

Any help is appreciated.

function update() {
    if (jKey.isDown) {

              game.physics.arcade.collide(player, trees,  function(player, tree) {


enter image description here

  • 1
    \$\begingroup\$ This is not an answer but I'm new to this community and can't add comments yet. I wonder, why are you using phaser 2 instead of phaser 3, I've seen the phaser 3 tutorials and what you're trying to achieve seems quite easy. Just a friendly suggestion. \$\endgroup\$ – Jairo Lozano Jan 25 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.