Take and replenish health and ammo
This commit is contained in:
Binary file not shown.
@@ -56,6 +56,8 @@ namespace EvilSatellites.Objects
|
|||||||
var player = (Player)obj;
|
var player = (Player)obj;
|
||||||
if (player.Vacuuming)
|
if (player.Vacuuming)
|
||||||
{
|
{
|
||||||
|
player.CurrentWeapon.RemainingAmmo += rnd.Next(player.CurrentWeapon.MaxAmmo);
|
||||||
|
Destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.TakeDamage(25);
|
player.TakeDamage(25);
|
||||||
|
|||||||
@@ -103,6 +103,10 @@ namespace EvilSatellites.Objects
|
|||||||
sfxTurn.Update(gameTime);
|
sfxTurn.Update(gameTime);
|
||||||
sfxElevator.Update(gameTime);
|
sfxElevator.Update(gameTime);
|
||||||
sfxVacuum.Update(gameTime);
|
sfxVacuum.Update(gameTime);
|
||||||
|
if (Health < 100)
|
||||||
|
{
|
||||||
|
IncreaseHealth(0.01f);
|
||||||
|
}
|
||||||
if (Movement.Length() != 0)
|
if (Movement.Length() != 0)
|
||||||
{
|
{
|
||||||
if (Movement.X > 0)
|
if (Movement.X > 0)
|
||||||
@@ -201,6 +205,16 @@ namespace EvilSatellites.Objects
|
|||||||
Screen.Manager.Sound.PlayOneshot(dmgSound);
|
Screen.Manager.Sound.PlayOneshot(dmgSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void IncreaseHealth(float amount)
|
||||||
|
{
|
||||||
|
Health += amount;
|
||||||
|
if (Health > 25 && IsDamaged)
|
||||||
|
{
|
||||||
|
IsDamaged = false;
|
||||||
|
sfxDamage.Pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void PlayTap()
|
public void PlayTap()
|
||||||
{
|
{
|
||||||
sfxTaps.Play();
|
sfxTaps.Play();
|
||||||
|
|||||||
@@ -179,7 +179,16 @@ namespace EvilSatellites.Screens
|
|||||||
Tolk.Output("Satellites");
|
Tolk.Output("Satellites");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Input.IsJustPressed(Keys.H))
|
||||||
|
{
|
||||||
|
_player.PlayTap();
|
||||||
|
Tolk.Output(_player.Health.ToString() + " health", true);
|
||||||
|
}
|
||||||
|
if (Input.IsJustPressed(Keys.X))
|
||||||
|
{
|
||||||
|
_player.PlayTap();
|
||||||
|
Tolk.Output(_player.CurrentWeapon.RemainingAmmo.ToString() + " rounds", true);
|
||||||
|
}
|
||||||
if (Input.IsJustPressed(Keys.O))
|
if (Input.IsJustPressed(Keys.O))
|
||||||
{
|
{
|
||||||
DavyKager.Tolk.Output(Objects.Count.ToString());
|
DavyKager.Tolk.Output(Objects.Count.ToString());
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace EvilSatellites.Weapons
|
|||||||
public ISoundEffect sfxSpindown;
|
public ISoundEffect sfxSpindown;
|
||||||
public ISoundEffect sfxSpinup;
|
public ISoundEffect sfxSpinup;
|
||||||
public ISoundEffect sfxSpinning;
|
public ISoundEffect sfxSpinning;
|
||||||
|
public ISoundEffect sfxEmpty;
|
||||||
public GameScreen Screen;
|
public GameScreen Screen;
|
||||||
public LaserMG(IGameObject wielder, GameScreen screen)
|
public LaserMG(IGameObject wielder, GameScreen screen)
|
||||||
{
|
{
|
||||||
@@ -37,6 +38,8 @@ namespace EvilSatellites.Weapons
|
|||||||
sfxSpinning = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/spinning.wav", false);
|
sfxSpinning = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/spinning.wav", false);
|
||||||
sfxSpinning.Loop = true;
|
sfxSpinning.Loop = true;
|
||||||
sfxShoot = new AudioAsset(Screen.Manager.Sound, @"sfx/weapons/LaserMG/fire", 1, 4);
|
sfxShoot = new AudioAsset(Screen.Manager.Sound, @"sfx/weapons/LaserMG/fire", 1, 4);
|
||||||
|
sfxEmpty = Screen.Manager.Sound.Load(@"sfx/weapons/LaserMG/empty.wav", false);
|
||||||
|
sfxEmpty.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||||
sfxReload.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
sfxReload.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||||
sfxShoot.AddEffect(Screen.Manager.EnvironmentEffect);
|
sfxShoot.AddEffect(Screen.Manager.EnvironmentEffect);
|
||||||
sfxSpindown.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
sfxSpindown.ConnectToEffect(Screen.Manager.EnvironmentEffect);
|
||||||
@@ -84,10 +87,19 @@ namespace EvilSatellites.Weapons
|
|||||||
{
|
{
|
||||||
if (TimerEnd - TimerStart > FireRate)
|
if (TimerEnd - TimerStart > FireRate)
|
||||||
{
|
{
|
||||||
sfxShoot.Play();
|
if (RemainingAmmo > 0)
|
||||||
TimerStart = TimerEnd;
|
{
|
||||||
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation, _wielder);
|
sfxShoot.Play();
|
||||||
Screen.AddObject(proj);
|
RemainingAmmo--;
|
||||||
|
TimerStart = TimerEnd;
|
||||||
|
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation, _wielder);
|
||||||
|
Screen.AddObject(proj);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
sfxEmpty.Reset();
|
||||||
|
sfxEmpty.Play();
|
||||||
|
TimerStart = TimerEnd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (State == WeaponState.Stopping)
|
if (State == WeaponState.Stopping)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8f8abd1efdf4645a55976cea45a1537b59bf312d27729442e2b1c52106777de4
|
||||||
|
size 103016
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8f8abd1efdf4645a55976cea45a1537b59bf312d27729442e2b1c52106777de4
|
||||||
|
size 103016
|
||||||
Reference in New Issue
Block a user