diff --git a/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 b/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 index eecd96b..796ccc9 100644 Binary files a/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 and b/.vs/EvilSatellites/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/EvilSatellites/v16/.suo b/.vs/EvilSatellites/v16/.suo index 1201c06..44c37e2 100644 Binary files a/.vs/EvilSatellites/v16/.suo and b/.vs/EvilSatellites/v16/.suo differ diff --git a/EvilSatellites/Objects/Player.cs b/EvilSatellites/Objects/Player.cs index 4339136..a69f5e4 100644 --- a/EvilSatellites/Objects/Player.cs +++ b/EvilSatellites/Objects/Player.cs @@ -16,7 +16,12 @@ namespace EvilSatellites.Objects private Vector3 Deceleration = new Vector3(0.0025f, 0.0025f, 0.0025f); private ISoundEffect sfxEngine; private ISoundEffect sfxWhine; + private SoundPatch sfxElevator; + private SoundPatch sfxVacuum; + private SoundPatch sfxTurn; public IWeapon CurrentWeapon; + private int Turning; + private int Elevating; public Player(IScreen screen): base(screen) { ShouldDestroy = false; @@ -28,6 +33,7 @@ namespace EvilSatellites.Objects Rotation = Matrix.Identity; Orientation = Rotation.Forward; CurrentWeapon = new LaserMG(this, (GameScreen)Screen); + Turning = 0; Activate(); } @@ -35,6 +41,9 @@ namespace EvilSatellites.Objects { sfxEngine = Screen.Manager.Sound.Load(@"sfx/engine/int/engineThrust.wav", false); sfxWhine = Screen.Manager.Sound.Load(@"sfx/engine/int/engineWhine.wav", false); + sfxTurn = new SoundPatch(Screen.Manager.Sound, @"sfx/ship/turn", 200); + sfxVacuum = new SoundPatch(Screen.Manager.Sound, @"sfx/ship/vacuum", 500); + sfxElevator = new SoundPatch(Screen.Manager.Sound, @"sfx/ship/elevator", 250); sfxEngine.Loop = true; sfxWhine.Loop = true; sfxEngine.ConnectToEffect(Screen.Manager.EnvironmentEffect); @@ -54,9 +63,28 @@ namespace EvilSatellites.Objects { CurrentWeapon.Update(gameTime); Move(Movement); + if (Turning == -1) + { + RotateY(0.035f); + } + if (Turning == 1) + { + RotateY(-0.035f); + } + if (Elevating == -1) + { + RotateX(-0.035f); + } + if (Elevating == 1) + { + RotateX(0.035f); + } sfxEngine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 4; sfxWhine.Pitch = 0.5 + (Movement.Length() / MaxSpeed.Length()) * 1; sfxWhine.Volume = MathF.Pow(Movement.Length() / MaxSpeed.Length(), 2f); + sfxTurn.Update(gameTime); + sfxElevator.Update(gameTime); + sfxVacuum.Update(gameTime); if (Movement.Length() != 0) { if (Movement.X > 0) @@ -92,5 +120,29 @@ namespace EvilSatellites.Objects Movement += direction; } } + + public void StartTurning(int dir, GameTime time) + { + Turning = dir; + sfxTurn.Start(time); + } + + public void StopTurning() + { + Turning = 0; + sfxTurn.Stop(); + } + + public void StartElevating(int dir, GameTime time) + { + Elevating = dir; + sfxElevator.Start(time); + } + + public void StopElevating() + { + Elevating = 0; + sfxElevator.Stop(); + } } } diff --git a/EvilSatellites/Screens/GameScreen.cs b/EvilSatellites/Screens/GameScreen.cs index f5f9103..23e3311 100644 --- a/EvilSatellites/Screens/GameScreen.cs +++ b/EvilSatellites/Screens/GameScreen.cs @@ -106,21 +106,29 @@ namespace EvilSatellites.Screens { move.X = _player.Acceleration.X; } - if (Input.IsPressed(Keys.Left)) + if (Input.IsJustPressed(Keys.Left)) { - _player.RotateY(0.05f); + _player.StartTurning(-1, gameTime); } - if (Input.IsPressed(Keys.Right)) + if (Input.IsJustPressed(Keys.Right)) { - _player.RotateY(-0.05f); + _player.StartTurning(1, gameTime); } - if (Input.IsPressed(Keys.Up)) + if (Input.IsJustReleased(Keys.Left) || Input.IsJustReleased(Keys.Right)) { - _player.RotateX(0.05f); + _player.StopTurning(); } - if (Input.IsPressed(Keys.Down)) + if (Input.IsJustPressed(Keys.Up)) { - _player.RotateX(-0.05f); + _player.StartElevating(-1, gameTime); + } + if (Input.IsJustPressed(Keys.Down)) + { + _player.StartElevating(1, gameTime); + } + if (Input.IsJustReleased(Keys.Up) || Input.IsJustReleased(Keys.Down)) + { + _player.StopElevating(); } _player.Accelerate(move); if (Input.IsJustPressed(Keys.Space))