Jump to content

Kill a group of sprite, if one one sprite of the group collides with the bullet?


Anshu
 Share

Recommended Posts

Hi Guys, 

 

I am new to phaser, just have started working with phaser 3 days ago. previously i have worked in Flixel.

 

I am working on a Game prototype where i am creating sprites(test1,test2,test3,test4) and adding them to group "answer_ball_group"

 

Now i want that when the bullet hit any one of the test ball of the of "answer_ball_group". it should kill all the test ball in the group.

 

 My collide functio:--

game.physics.arcade.collide(bullets, answer_ball_group, collisionHandler, null, this);

 

function collisionHandler (bullet, answer_ball_group) {
 
answer_ball_group.kill();
 
}
 
if i am putting the code like this
 
function collisionHandler (bullet, ball) {
 
ball.kill();
 
}
 
 
The collisionhandler is killing the ball that collided, but i want to kill all the balls..
 
 
Please help. Thanks in Avance.
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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