Jump to content

Phaser weapon bullet kill


nothing
 Share

Recommended Posts

update(){
game.physics.arcade.overlap(weapon.bullets, platforms, ballHitBrick);
}

function ballHitBrick() {
	weapon.killAll();
}

Hello, 

I have problem with this function. This function is activated when the bullet hits the wall, but it's kill all the bullet in the air and I Want to kill only this one bullet what hits the wall.

Link to comment
Share on other sites

You can add parameters to your callBack function to do things with the overlapping objects(they are passed as arguments in the same order):

update(){
game.physics.arcade.overlap(weapon.bullets, platforms, ballHitBrick);
}

function ballHitBrick(bullet,platform) {
	bullet.kill();
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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