Take and replenish health and ammo

This commit is contained in:
2021-04-19 23:37:40 +02:00
parent 671ed50a33
commit d69c05db1f
7 changed files with 48 additions and 5 deletions
+2
View File
@@ -56,6 +56,8 @@ namespace EvilSatellites.Objects
var player = (Player)obj;
if (player.Vacuuming)
{
player.CurrentWeapon.RemainingAmmo += rnd.Next(player.CurrentWeapon.MaxAmmo);
Destroy();
return;
}
player.TakeDamage(25);
+14
View File
@@ -103,6 +103,10 @@ namespace EvilSatellites.Objects
sfxTurn.Update(gameTime);
sfxElevator.Update(gameTime);
sfxVacuum.Update(gameTime);
if (Health < 100)
{
IncreaseHealth(0.01f);
}
if (Movement.Length() != 0)
{
if (Movement.X > 0)
@@ -201,6 +205,16 @@ namespace EvilSatellites.Objects
Screen.Manager.Sound.PlayOneshot(dmgSound);
}
public void IncreaseHealth(float amount)
{
Health += amount;
if (Health > 25 && IsDamaged)
{
IsDamaged = false;
sfxDamage.Pause();
}
}
public void PlayTap()
{
sfxTaps.Play();