public void HandleBulletZombieCollision(Player p, EnemyHandler e)
{
foreach (Bullet b in p.bullets)
if (b.Visible)
{
bulletRectangle = new Rectangle((int)b.X, (int)b.Y, 2, 1);
foreach (ZombieDispenser zd in e.zombies)
foreach (Zombie z in zd.zombies)
if (z.Visible)
{
zombieRectangle = new Rectangle((int)(z.X + 18 * z.Scale), (int)(z.Y + 19 * z.Scale), (int)(28 * z.Scale), (int)(45 * z.Scale));
zombieHeadRectangle = new Rectangle((int)(z.X + 18 * z.Scale), (int)(z.Y + 4 * z.Scale), (int)(22 * z.Scale), (int)(15 * z.Scale));
if (bulletRectangle.Intersects(zombieRectangle))
{
z.Hitpoints -= bulletDmg;
b.SprayBlood = true;
b.Visible = false;
}
else if(bulletRectangle.Intersects(zombieHeadRectangle))
{
z.Hitpoints = 0;
p.Score += 5;
b.SprayBlood = true;
b.Visible = false;
}
}
}
}