# Phaser problem with .damage oneshots

I am trying to damage player or enemy when they collide.(enemy will be damaged when collided with bullet and player will be damaged when collided with monster)

this.game.physics.arcade.overlap(this.laser.bullets, this.zombies, this.hitEnemy, null, this);

}

playerdmg(player,zombies){
player.damage(1); //oneshots

}

hitEnemy(bullets,zombies){

zombies.damage(1); // one shots
console.log(zombies.health) // this is -1
console.log("hit");
bullets.kill();

}


Collision detection works.but i cant damage player or zombies. this is how i set health after creating player:

this.player.health=10;

how do i set zombies health correctly ? because i create them with for loop like this:

this.zombies = this.game.add.group();
this.zombies.enableBody=true;
this.zombies.health = 5;
for (var i = 0; i < 30; i++)
{
var zombie = this.zombies.create(this.game.world.randomX, this.game.world.randomY, 'zombie');
let zombieHealthBar = new HealthBar(this.game, zombie, 25, 10, -20, 0, '#FF0000', '#00FF00');

}


zombies is a Group. You should set health on each individual zombie.
By the way, your function signature for hitEnemy is misleading. It is a callback that receives one bullet and one zombie, the pair that have overlapped.