Skip to content

Commit

Permalink
Added Sounds. Fixed door open bug. Rocks block shots. Tweaked missile…
Browse files Browse the repository at this point in the history
… range.
  • Loading branch information
LanceJZ committed Jan 13, 2018
1 parent 2677ac7 commit 436164c
Show file tree
Hide file tree
Showing 36 changed files with 417 additions and 56 deletions.
2 changes: 1 addition & 1 deletion CFNGamejam2/CFNGamejam2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<AssemblyFileVersionSettings>MMddStamp.DayOfYearStamp.MonthStamp.TimeStamp</AssemblyFileVersionSettings>
<AssemblyInfoVersionSettings>YearStamp.DateStamp.DeltaDayStamp.Increment</AssemblyInfoVersionSettings>
<PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType>
<AssemblyVersion>1.662.13.0101</AssemblyVersion>
<AssemblyVersion>1.721.13.0101</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
Expand Down
60 changes: 60 additions & 0 deletions CFNGamejam2/Content/Content.mgcb
Original file line number Diff line number Diff line change
Expand Up @@ -1134,3 +1134,63 @@
/processorParam:TextureFormat=Compressed
/build:Models/Water.obj

#begin Sounds/BombExplode.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/BombExplode.wav

#begin Sounds/DropBomb.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/DropBomb.wav

#begin Sounds/Duck.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/Duck.wav

#begin Sounds/GateExplode.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/GateExplode.wav

#begin Sounds/MissileFire.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/MissileFire.wav

#begin Sounds/MissileHit.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/MissileHit.wav

#begin Sounds/TankIdle.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/TankIdle.wav

#begin Sounds/TankMove.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/TankMove.wav

#begin Sounds/TankShot.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/TankShot.wav

#begin Sounds/TankShotHit.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Sounds/TankShotHit.wav

Binary file added CFNGamejam2/Content/Sounds/BombExplode-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/BombExplode.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/DropBomb-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/DropBomb.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/Duck-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/Duck.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/GateExplode-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/GateExplode.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/MissileFire-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/MissileFire.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/MissileHit-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/MissileHit.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankIdle-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankIdle.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankMove-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankMove.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankShot-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankShot.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankShotHit-old1.wav
Binary file not shown.
Binary file added CFNGamejam2/Content/Sounds/TankShotHit.wav
Binary file not shown.
24 changes: 21 additions & 3 deletions CFNGamejam2/Engine/AModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class AModel : PositionedObject, IDrawComponent, ILoadContent
public Vector3 ModelScale = new Vector3(1);
public Vector3 ModelScaleVelocity = Vector3.Zero;
public Vector3 ModelScaleAcceleration = Vector3.Zero;
bool m_AnimatedScale = true;
bool m_AnimatedScale;

public XnaModel XNAModel { get; private set; }
public Matrix TheWoldMatrix { get => BaseWorld; }
Expand Down Expand Up @@ -215,8 +215,26 @@ public bool SphereIntersect(AModel target)
float radius = ((Sphere.Radius * Scale) * 0.8f) +
((target.Sphere.Radius * target.Scale) * 0.8f);

if (Vector3.Distance(Position, target.Position) < radius)
return true;
if (Child && !target.Child)
{
if (Vector3.Distance(WorldPosition, target.Position) < radius)
return true;
}
else if (target.Child && !Child)
{
if (Vector3.Distance(Position, target.WorldPosition) < radius)
return true;
}
else if (Child && target.Child)
{
if (Vector3.Distance(WorldPosition, target.WorldPosition) < radius)
return true;
}
else
{
if (Vector3.Distance(Position, target.Position) < radius)
return true;
}

return false;
}
Expand Down
5 changes: 4 additions & 1 deletion CFNGamejam2/Engine/Explode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ public class Explode : GameComponent, IBeginable, IUpdateableComponent, ILoadCon
{
List<ExplodeParticle> Particles;
XnaModel Cube;
Vector3 TheColor;

public bool Active { get => Enabled; }
public Vector3 DefuseColor { set => TheColor = value; }

public Explode(Game game) : base(game)
{
Expand All @@ -25,7 +27,7 @@ public Explode(Game game) : base(game)

public override void Initialize()
{

TheColor = new Vector3(1);
base.Initialize();
LoadContent();
BeginRun();
Expand Down Expand Up @@ -73,6 +75,7 @@ public void Spawn(Vector3 position, float radius, int minCount)
{
Particles.Add(new ExplodeParticle(Game));
Particles.Last().SetModel(Cube);
Particles.Last().DefuseColor = TheColor;
}
}

Expand Down
13 changes: 10 additions & 3 deletions CFNGamejam2/Entities/Bomb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class Bomb : AModel
Explode Explosion;
Timer LifeTimer;

SoundEffect ExplodeSound;

public Bomb(Game game, GameLogic gameLogic) : base(game)
{
RefGameLogic = gameLogic;
Expand All @@ -32,6 +34,7 @@ public override void Initialize()
public override void LoadContent()
{
LoadModel("Bomb");
ExplodeSound = LoadSoundEffect("BombExplode");
}

public override void BeginRun()
Expand Down Expand Up @@ -78,14 +81,18 @@ public void HitTarget()
Velocity.Y = 0;
Acceleration.Y = 0;
Explosion.Spawn(Position, Radius * 0.5f, 100);
ExplodeSound.Play();
}

void CheckCollusion()
{
if (SphereIntersect(RefGameLogic.RefPlayer))
if (RefGameLogic.RefPlayer.Active)
{
HitTarget();
RefGameLogic.RefPlayer.HitDamage(1);
if (SphereIntersect(RefGameLogic.RefPlayer))
{
HitTarget();
RefGameLogic.RefPlayer.HitDamage(1);
}
}
}
}
Expand Down
39 changes: 35 additions & 4 deletions CFNGamejam2/Entities/Duck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public class Duck : AModel
Timer GlideTimer;
Timer DropBombTimer;
Timer ChangeHeadingTimer;
Timer QuackTimer;

SoundEffect QuackSound;
SoundEffect DropBombSound;

Mode CurrentMode;

Expand All @@ -46,6 +50,7 @@ public Duck(Game game, GameLogic gameLogic) : base(game)
GlideTimer = new Timer(game, 5);
DropBombTimer = new Timer(game, 2);
ChangeHeadingTimer = new Timer(game);
QuackTimer = new Timer(game);
}

public override void Initialize()
Expand All @@ -59,6 +64,9 @@ public override void LoadContent()
LoadModel("DuckBody");
Wings[0].LoadModel("DuckLWing");
Wings[1].LoadModel("DuckRWing");

QuackSound = LoadSoundEffect("Duck");
DropBombSound = LoadSoundEffect("DropBomb");
}

public override void BeginRun()
Expand Down Expand Up @@ -101,6 +109,16 @@ public override void Update(GameTime gameTime)
if (GlideTimer.Elapsed && Position.Y < 60)
{
ChangeToFlap();
return;
}

if (RefGameLogic.CurrentMode == GameState.InPlay)
{
if (QuackTimer.Elapsed)
{
QuackTimer.Reset(Services.RandomMinMax(6.5f, 15.1f));
QuackSound.Play(0.25f, 1, 1);
}
}

break;
Expand Down Expand Up @@ -128,15 +146,27 @@ public override void Update(GameTime gameTime)
base.Update(gameTime);
}

public override void Spawn(Vector3 position)
{
base.Spawn(position);

QuackTimer.Reset(Services.RandomMinMax(3.5f, 15.1f));
}

void CheckHit()
{
foreach(TankShot shot in RefGameLogic.RefPlayer.ShotsRef)
{
if (SphereIntersect(shot))
if (shot.Active)
{
Active = false;
Explosion.Spawn(Position, 3, 20);
shot.Active = false;
if (SphereIntersect(shot))
{
Active = false;
Explosion.DefuseColor = new Vector3(0.713f, 0.149f, 0.286f);
Explosion.Spawn(Position, 5, 30);
shot.HitTarget();
RefGameLogic.AddToScore(100);
}
}
}
}
Expand Down Expand Up @@ -223,6 +253,7 @@ void DropBomb()
}

Bombs[thisOne].Spawn(Position, Rotation, Velocity / 4);
DropBombSound.Play(0.5f, 1, 1);
}

void FlapWings()
Expand Down
8 changes: 6 additions & 2 deletions CFNGamejam2/Entities/EnemyControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class EnemyControl : GameComponent, IBeginable, IUpdateableComponent, ILo
XnaModel WallPiece;
Gateway TheGateway;

public List<MissileBattery> BatterysRef { get => TheBatterys; }

public EnemyControl(Game game, GameLogic gameLogic) : base(game)
{
RefGameLogic = gameLogic;
Expand Down Expand Up @@ -93,9 +95,11 @@ public void NewGame()

for (int i = 0; i < 4; i++)
{
SpawnBattery(new Vector3(-200, 20, -700 + (i * 500)));
SpawnBattery(new Vector3(200, 20, -700 + (i * 500)));
SpawnBattery(new Vector3(-150, 20, -700 + (i * 500)));
SpawnBattery(new Vector3(150, 20, -700 + (i * 500)));
}

TheGateway.Spawn(TheGateway.Position);
}

void SpawnWall(Vector3 position)
Expand Down
Loading

0 comments on commit 436164c

Please sign in to comment.