Skip to content

Commit

Permalink
Added Music Ready for Jam.
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceJZ committed Dec 5, 2017
1 parent 65eff11 commit add457b
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 32 deletions.
6 changes: 6 additions & 0 deletions Shadow and Planet/Content/Content.mgcb
Original file line number Diff line number Diff line change
Expand Up @@ -1002,3 +1002,9 @@
/processorParam:Quality=Best
/build:Sounds/ShotHit.wav

#begin SongOne.mp3
/importer:Mp3Importer
/processor:SongProcessor
/processorParam:Quality=Best
/build:SongOne.mp3

Binary file added Shadow and Planet/Content/SongOne.mp3
Binary file not shown.
7 changes: 7 additions & 0 deletions Shadow and Planet/Engine/Words.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ public void UpdateWords(string words)
Mod letterE = InitiateLetter(letval);
letterE.Scale = Scale;
}

}

if ((int)letter == 32)
{
WordEs.Add(new Mod(Game));
}
}

Expand Down Expand Up @@ -121,6 +127,7 @@ public void ShowWords(bool show)
foreach (Mod word in WordEs)
{
word.Active = show;
word.Visable = show;
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions Shadow and Planet/Entities/Asteroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ void CheckCollusion()

foreach (Pirate pirate in PiratesRef.Pirates)
{
if (CirclesIntersect(pirate))
if (pirate.Active)
{
pirate.Bumped(Position, Velocity);
if (CirclesIntersect(pirate))
{
pirate.Bumped(Position, Velocity);
}

pirate.CheckMissileHit(this);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Shadow and Planet/Entities/Background.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Shadow_and_Planet.Entities

public class Background : GameComponent, IBeginable, IUpdateableComponent, ILoadContent
{
Engine.AModel[] Stars = new Engine.AModel[400];
Engine.AModel[] Stars = new Engine.AModel[600];
Engine.AModel[] StarsBack = new Engine.AModel[40];

Vector3[] StarsOrg;
Expand Down
2 changes: 1 addition & 1 deletion Shadow and Planet/Entities/Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void LoadContent()

public override void BeginRun()
{
OreText.ProcessWords("BASE_ORE", Vector3.Zero, 2);
OreText.ProcessWords("BASE ORE", Vector3.Zero, 2);
OreText.Position.Z = 150;
OreAmount.ProcessNumber(OreOnBase, Vector3.Zero, 2);
OreAmount.Position.Z = 150;
Expand Down
23 changes: 12 additions & 11 deletions Shadow and Planet/Entities/Missile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Missile : Mod
PositionedObject TargetRef;
Timer LifeTimer;
SoundEffect HitSound;
SoundEffect MissileSound;
Explode Explosion;

public Missile(Game game) : base(game)
Expand All @@ -36,6 +37,7 @@ public override void LoadContent()
{
LoadModel("SandP-Missile");
HitSound = LoadSoundEffect("MissileHit");
MissileSound = LoadSoundEffect("PirateMissile");

BeginRun();
}
Expand All @@ -50,38 +52,37 @@ public override void Update(GameTime gameTime)
{
if (Active)
{
RotationVelocity.Z = AimAtTarget(TargetRef.Position, Rotation.Z, MathHelper.PiOver4 *0.25f);
if (TargetRef != null)
{
RotationVelocity.Z = AimAtTarget(TargetRef.Position, Rotation.Z, MathHelper.PiOver4 * 0.25f);
}

Velocity = SetVelocityFromAngle(Rotation.Z, 200);

if (LifeTimer.Expired)
{
Active = false;
}

CheckCollusions();
}

base.Update(gameTime);
}

public void Spawn(Vector3 postion, Vector3 rotation, PositionedObject target, float timer)
{
MissileSound.Play();
Active = true;
Position = postion;
Rotation.Z = rotation.Z;
TargetRef = target;
LifeTimer.Reset(timer);
}

void CheckCollusions()
public void HitTarget()
{
if (CirclesIntersect(TargetRef))
{
HitSound.Play();
Explosion.Spawn(Position, Radius * 0.25f);
TargetRef.Hit = true;
Active = false;
}
HitSound.Play();
Explosion.Spawn(Position, Radius * 0.25f);
Active = false;
}

void CheckEdge()
Expand Down
39 changes: 29 additions & 10 deletions Shadow and Planet/Entities/Pirate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ public class Pirate : Mod

XnaModel HealthModel;

SoundEffect ExplodSound;
SoundEffect ExplodeSound;
SoundEffect HitSound;
SoundEffect BumpSound;
SoundEffect MissileSound;

Vector3 NewHeading = Vector3.Zero;

Expand Down Expand Up @@ -59,10 +58,9 @@ public override void LoadContent()
{
LoadModel("SandP-Pirate");
HealthModel = Load("cube");
ExplodSound = LoadSoundEffect("PirateExplode");
ExplodeSound = LoadSoundEffect("PirateExplode");
HitSound = LoadSoundEffect("PirateHit");
BumpSound = LoadSoundEffect("PirateBump");
MissileSound = LoadSoundEffect("PirateMissile");

BeginRun();
}
Expand Down Expand Up @@ -156,15 +154,29 @@ public void GameOver()
}
}

public void CheckMissileHit(PositionedObject target)
public bool CheckMissileHit(PositionedObject target)
{
foreach (Missile missile in Missiles)
{
if (missile.CirclesIntersect(target))
if (missile.Active)
{
missile.Active = false;
if (missile.CirclesIntersect(target))
{
missile.HitTarget();
return true;
}
}
}

return false;
}

public void CheckPlayerMissilHit()
{
if (PlayerRef.CheckMissileCollusions(this))
{
Hit = true;
}
}

void GenerateHealthBar()
Expand Down Expand Up @@ -209,6 +221,7 @@ void CheckForPlayer()
if (DetectPlayer.CirclesIntersect(PlayerRef))
{
Stop = true;
PlayerRef.MissileTarget = this;
}
else
{
Expand All @@ -218,7 +231,6 @@ void CheckForPlayer()

void FireMissile()
{
MissileSound.Play();
bool spawnNew = true;
int freeOne = Missiles.Count;

Expand Down Expand Up @@ -278,17 +290,24 @@ void CheckCollusions()
if (HitPoints < 1)
{
Hit = true;
ExplodSound.Play();
ExplodeSound.Play();
}
}

if (PlayerRef.CheckMissileCollusions(this))
{
HitSound.Play();
Hit = true;
ExplodeSound.Play();
}

foreach(Missile missile in Missiles)
{
if (missile.Active)
{
if (PlayerRef.CheckShotCollusions(missile))
{
missile.Active = false;
missile.HitTarget();
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions Shadow and Planet/Entities/PirateControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ void CheckPirateCollusion()
Pirates[i].Active = false;
Pirates[i].Hit = false;

if (Services.RandomMinMax(1, 6) > 4)
if (Services.RandomMinMax(1, 7) > 4)
SpawnChest(Pirates[i].Position);

if (Services.RandomMinMax(1, 100) > 90)
if (Services.RandomMinMax(1, 100) > 95)
SpawnLavaLamp(Pirates[i].Position);
}

Expand All @@ -175,6 +175,11 @@ void CheckPirateCollusion()
GameOver();
}
}

if (Pirates[i].CheckMissileHit(PlayerRef))
{
PlayerRef.Hit = true;
}
}

foreach (Pirate pirateA in Pirates)
Expand Down
Loading

0 comments on commit add457b

Please sign in to comment.