diff --git a/Shadow and Planet/Content/Content.mgcb b/Shadow and Planet/Content/Content.mgcb index 9518bab..633cace 100644 --- a/Shadow and Planet/Content/Content.mgcb +++ b/Shadow and Planet/Content/Content.mgcb @@ -811,25 +811,6 @@ /processorParam:TextureFormat=Compressed /build:Models/SandP-Pirate.obj -#begin Models/cube - pirate.3DS -/importer:OpenAssetImporter -/processor:ModelProcessor -/processorParam:ColorKeyColor=0,0,0,0 -/processorParam:ColorKeyEnabled=True -/processorParam:DefaultEffect=BasicEffect -/processorParam:GenerateMipmaps=True -/processorParam:GenerateTangentFrames=False -/processorParam:PremultiplyTextureAlpha=True -/processorParam:PremultiplyVertexColors=True -/processorParam:ResizeTexturesToPowerOfTwo=False -/processorParam:RotationX=0 -/processorParam:RotationY=0 -/processorParam:RotationZ=0 -/processorParam:Scale=1 -/processorParam:SwapWindingOrder=False -/processorParam:TextureFormat=Compressed -/build:Models/cube - pirate.3DS - #begin Models/SandP-Missile.obj /importer:OpenAssetImporter /processor:ModelProcessor @@ -925,25 +906,6 @@ /processorParam:TextureFormat=Compressed /build:Models/SandP-Base.obj -#begin Models/cube - green.3DS -/importer:OpenAssetImporter -/processor:ModelProcessor -/processorParam:ColorKeyColor=0,0,0,0 -/processorParam:ColorKeyEnabled=True -/processorParam:DefaultEffect=BasicEffect -/processorParam:GenerateMipmaps=True -/processorParam:GenerateTangentFrames=False -/processorParam:PremultiplyTextureAlpha=True -/processorParam:PremultiplyVertexColors=True -/processorParam:ResizeTexturesToPowerOfTwo=False -/processorParam:RotationX=0 -/processorParam:RotationY=0 -/processorParam:RotationZ=0 -/processorParam:Scale=1 -/processorParam:SwapWindingOrder=False -/processorParam:TextureFormat=Compressed -/build:Models/cube - green.3DS - #begin Sounds/Thrust.wav /importer:WavImporter /processor:SoundEffectProcessor @@ -1022,3 +984,21 @@ /processorParam:Quality=Best /build:Sounds/PirateBump.wav +#begin Sounds/PlayerShotHit.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:Sounds/PlayerShotHit.wav + +#begin Sounds/MissileHit.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:Sounds/MissileHit.wav + +#begin Sounds/ShotHit.wav +/importer:WavImporter +/processor:SoundEffectProcessor +/processorParam:Quality=Best +/build:Sounds/ShotHit.wav + diff --git a/Shadow and Planet/Content/Models/cube - green.3DS b/Shadow and Planet/Content/Models/cube - green.3DS deleted file mode 100644 index 7ff326c..0000000 Binary files a/Shadow and Planet/Content/Models/cube - green.3DS and /dev/null differ diff --git a/Shadow and Planet/Content/Models/cube - pirate.3DS b/Shadow and Planet/Content/Models/cube - pirate.3DS deleted file mode 100644 index 7ff326c..0000000 Binary files a/Shadow and Planet/Content/Models/cube - pirate.3DS and /dev/null differ diff --git a/Shadow and Planet/Content/Sounds/MissileHit.wav b/Shadow and Planet/Content/Sounds/MissileHit.wav new file mode 100644 index 0000000..dc0a23e Binary files /dev/null and b/Shadow and Planet/Content/Sounds/MissileHit.wav differ diff --git a/Shadow and Planet/Content/Sounds/PlayerShotHit.wav b/Shadow and Planet/Content/Sounds/PlayerShotHit.wav new file mode 100644 index 0000000..dbce3a1 Binary files /dev/null and b/Shadow and Planet/Content/Sounds/PlayerShotHit.wav differ diff --git a/Shadow and Planet/Content/Sounds/ShotHit.wav b/Shadow and Planet/Content/Sounds/ShotHit.wav new file mode 100644 index 0000000..2730bd5 Binary files /dev/null and b/Shadow and Planet/Content/Sounds/ShotHit.wav differ diff --git a/Shadow and Planet/Engine/AModel.cs b/Shadow and Planet/Engine/AModel.cs index c34f6d7..e14d766 100644 --- a/Shadow and Planet/Engine/AModel.cs +++ b/Shadow and Planet/Engine/AModel.cs @@ -15,7 +15,7 @@ public class AModel : PositionedObject, IDrawComponent, ILoadContent { public XnaModel XNAModel { get; private set; } public bool Visable { get => m_Visable; set => m_Visable = value; } - public Vector3 DefuseColor = Vector3.Zero; + public Vector3 DefuseColor = new Vector3(1,1,1); Texture2D XNATexture; private Matrix[] ModelTransforms; private Matrix BaseWorld; diff --git a/Shadow and Planet/Engine/Words.cs b/Shadow and Planet/Engine/Words.cs index 445c45d..dd38604 100644 --- a/Shadow and Planet/Engine/Words.cs +++ b/Shadow and Planet/Engine/Words.cs @@ -16,8 +16,8 @@ class Words : GameComponent, IUpdateableComponent, ILoadContent, IBeginable { XnaModel[] WordModels = new XnaModel[27]; List WordEs = new List(); - string WordString; float Scale; + int TextSize; public Vector3 Position = Vector3.Zero; public Words (Game game) : base(game) @@ -52,7 +52,6 @@ public void BeginRun() public void ProcessWords(string words, Vector3 locationStart, float scale) { Position = locationStart; - WordString = words; Scale = scale; UpdateWords(words); @@ -60,10 +59,10 @@ public void ProcessWords(string words, Vector3 locationStart, float scale) public void UpdateWords(string words) { - int textSize = WordString.Length; + TextSize = words.Length; DeleteWords(); - foreach (char letter in WordString) + foreach (char letter in words) { if ((int)letter > 64 && (int)letter < 91 || (int)letter == 95) { @@ -90,7 +89,7 @@ public void UpdatePosition() foreach (Mod letter in WordEs) { letter.Position = Position - new Vector3(space, 0, 0); - space -= Scale * 11; + space -= Scale * 11.5f; } } diff --git a/Shadow and Planet/Entities/Base.cs b/Shadow and Planet/Entities/Base.cs index df2d8ac..ab2f286 100644 --- a/Shadow and Planet/Entities/Base.cs +++ b/Shadow and Planet/Entities/Base.cs @@ -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; diff --git a/Shadow and Planet/Entities/Explode.cs b/Shadow and Planet/Entities/Explode.cs new file mode 100644 index 0000000..b2a4c86 --- /dev/null +++ b/Shadow and Planet/Entities/Explode.cs @@ -0,0 +1,92 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Audio; +using XnaModel = Microsoft.Xna.Framework.Graphics.Model; +using System.Collections.Generic; +using System; +using Engine; + +namespace Shadow_and_Planet.Entities +{ + using Mod = Engine.AModel; + + public class Explode : GameComponent, IBeginable, IUpdateableComponent, ILoadContent + { + List Particles; + bool _Active; + + public bool Active { get => _Active; set => _Active = value; } + + public Explode(Game game) : base(game) + { + Particles = new List(); + + game.Components.Add(this); + LoadContent(); + BeginRun(); + } + + public override void Initialize() + { + + base.Initialize(); + } + + public void LoadContent() + { + + } + + public void BeginRun() + { + + } + + public override void Update(GameTime gameTime) + { + if (_Active) + { + bool done = true; + + foreach(ExplodeParticle particle in Particles) + { + if (particle.Active) + { + done = false; + break; + } + } + + if (done) + _Active = false; + + base.Update(gameTime); + } + } + + public void Spawn(Vector3 position, float radius) + { + _Active = true; + int count = (int)Services.RandomMinMax(10, 10 + radius * 2); + + if (count > Particles.Count) + { + int more = count - Particles.Count; + + for (int i = 0; i < more; i++) + { + Particles.Add(new ExplodeParticle(Game)); + } + } + + foreach (ExplodeParticle particle in Particles) + { + position += new Vector3(Services.RandomMinMax(-radius, radius), + Services.RandomMinMax(-radius, radius), 0); + + particle.Spawn(position); + } + } + } +} diff --git a/Shadow and Planet/Entities/ExplodeParticle.cs b/Shadow and Planet/Entities/ExplodeParticle.cs new file mode 100644 index 0000000..97a9c51 --- /dev/null +++ b/Shadow and Planet/Entities/ExplodeParticle.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Microsoft.Xna.Framework.Audio; +using XnaModel = Microsoft.Xna.Framework.Graphics.Model; +using System.Collections.Generic; +using System; +using Engine; + +namespace Shadow_and_Planet.Entities +{ + using Mod = AModel; + + public class ExplodeParticle : Mod + { + Timer LifeTimer; + + public ExplodeParticle(Game game) : base(game) + { + LifeTimer = new Timer(game); + + LoadContent(); + BeginRun(); + } + + public override void Initialize() + { + base.Initialize(); + } + + public override void LoadContent() + { + LoadModel("Cube"); + } + + public override void BeginRun() + { + + base.BeginRun(); + } + + public override void Update(GameTime gameTime) + { + if (LifeTimer.Expired) + Active = false; + + base.Update(gameTime); + } + + public void Spawn(Vector3 position) + { + Velocity = SetRandomVelocity(50); + Position = position; + Active = true; + Scale = Services.RandomMinMax(1, 2); + LifeTimer.Reset(Services.RandomMinMax(0.1f, 1)); + } + } +} diff --git a/Shadow and Planet/Entities/Missile.cs b/Shadow and Planet/Entities/Missile.cs index e225746..2468ab4 100644 --- a/Shadow and Planet/Entities/Missile.cs +++ b/Shadow and Planet/Entities/Missile.cs @@ -15,10 +15,14 @@ public class Missile : Mod { PositionedObject TargetRef; Timer LifeTimer; + SoundEffect HitSound; + Explode Explosion; public Missile(Game game) : base(game) { LifeTimer = new Timer(game); + Explosion = new Explode(game); + LoadContent(); } @@ -31,6 +35,8 @@ public override void Initialize() public override void LoadContent() { LoadModel("SandP-Missile"); + HitSound = LoadSoundEffect("MissileHit"); + BeginRun(); } @@ -71,6 +77,8 @@ void CheckCollusions() { if (CirclesIntersect(TargetRef)) { + HitSound.Play(); + Explosion.Spawn(Position, Radius * 0.25f); TargetRef.Hit = true; Active = false; } diff --git a/Shadow and Planet/Entities/Pirate.cs b/Shadow and Planet/Entities/Pirate.cs index ca98c45..fe105e6 100644 --- a/Shadow and Planet/Entities/Pirate.cs +++ b/Shadow and Planet/Entities/Pirate.cs @@ -26,6 +26,7 @@ public class Pirate : Mod SoundEffect ExplodSound; SoundEffect HitSound; SoundEffect BumpSound; + SoundEffect MissileSound; Vector3 NewHeading = Vector3.Zero; @@ -57,10 +58,11 @@ public override void Initialize() public override void LoadContent() { LoadModel("SandP-Pirate"); - HealthModel = Load("cube - green"); + HealthModel = Load("cube"); ExplodSound = LoadSoundEffect("PirateExplode"); HitSound = LoadSoundEffect("PirateHit"); BumpSound = LoadSoundEffect("PirateBump"); + MissileSound = LoadSoundEffect("PirateMissile"); BeginRun(); } @@ -88,6 +90,7 @@ public override void Update(GameTime gameTime) RotationVelocity.X = 0; RotationVelocity.Y = 0; BumpTimer.Enabled = false; + FireTimer.Reset(); } if (ChaseTimer.Expired) @@ -215,6 +218,7 @@ void CheckForPlayer() void FireMissile() { + MissileSound.Play(); bool spawnNew = true; int freeOne = Missiles.Count; diff --git a/Shadow and Planet/Entities/PirateControl.cs b/Shadow and Planet/Entities/PirateControl.cs index 11860c6..c39bd53 100644 --- a/Shadow and Planet/Entities/PirateControl.cs +++ b/Shadow and Planet/Entities/PirateControl.cs @@ -19,6 +19,7 @@ public class PirateControl : GameComponent, IBeginable, IUpdateableComponent, IL List PirateRadar; List LavaLamps; List Chests; + List Explosions; XnaModel PirateRadarModel; @@ -31,6 +32,8 @@ public PirateControl(Game game, Player player) : base(game) PirateRadar = new List(); LavaLamps = new List(); Chests = new List(); + Explosions = new List(); + game.Components.Add(this); } @@ -48,13 +51,13 @@ public void BeginRun() public void LoadContent() { - PirateRadarModel = PlayerRef.Load("cube - pirate"); + PirateRadarModel = PlayerRef.Load("cube"); LavaLampSound = PlayerRef.LoadSoundEffect("LavaLampDrop"); } public override void Update(GameTime gameTime) { - CheckOtherPirateCollusion(); + CheckPirateCollusion(); int PiratesActive = 0; @@ -64,7 +67,7 @@ public override void Update(GameTime gameTime) PiratesActive++; } - if (PlayerRef.Chests > PiratesActive) + if (PlayerRef.Chests + 1 > PiratesActive) SpawnPirate(); base.Update(gameTime); @@ -89,7 +92,7 @@ public bool CheckChestPickup(PositionedObject target) public void NewGame() { - SpawnPirate(); + } public void GameOver() @@ -113,17 +116,42 @@ void DeactivatePirateRadar(int number) PirateRadar[number].Active = false; } - void CheckOtherPirateCollusion() + void SpawnExploision(Vector3 position, float radius) + { + bool spawnNew = true; + int freeExplosion = Explosions.Count; + + for (int i = 0; i < Explosions.Count; i++) + { + if (!Explosions[i].Active) + { + spawnNew = false; + freeExplosion = i; + break; + } + } + + if (spawnNew) + { + Explosions.Add(new Explode(Game)); + } + + Explosions[freeExplosion].Spawn(position, radius); + } + + void CheckPirateCollusion() { for (int i = 0; i < Pirates.Count; i++) { if (Pirates[i].Hit && Pirates[i].Active) { + SpawnExploision(Pirates[i].Position, Pirates[i].Radius * 0.25f); DeactivatePirateRadar(i); Pirates[i].Active = false; Pirates[i].Hit = false; - SpawnChest(Pirates[i].Position); + if (Services.RandomMinMax(1, 6) > 4) + SpawnChest(Pirates[i].Position); if (Services.RandomMinMax(1, 100) > 90) SpawnLavaLamp(Pirates[i].Position); diff --git a/Shadow and Planet/Entities/Player.cs b/Shadow and Planet/Entities/Player.cs index 66776f5..18ae897 100644 --- a/Shadow and Planet/Entities/Player.cs +++ b/Shadow and Planet/Entities/Player.cs @@ -22,6 +22,7 @@ public class Player : Mod SoundEffect OreSound; SoundEffect DockSound; SoundEffect UnDockSound; + SoundEffect ShotHitSound; Base BaseRef; Numbers OreCollected; @@ -34,6 +35,7 @@ public class Player : Mod Words ChestCollectedText; List HealthBar; XnaModel HealthModel; + Explode Explosion; KeyboardState KeyState; KeyboardState KeyStateOld; @@ -68,6 +70,7 @@ public Player(Game game, Base theBase) : base(game) DockTimer = new Timer(game); ThrustTimer = new Timer(game); HealthBar = new List(); + Explosion = new Explode(game); } public override void Initialize() @@ -76,7 +79,8 @@ public override void Initialize() Radius = 20; Scale = 1; - BaseRadar.Scale = 1.5f; + BaseRadar.Scale = 5f; + BaseRadar.DefuseColor = new Vector3(0.5f, 0.45f, 0.55f); base.Initialize(); } @@ -92,7 +96,7 @@ public override void LoadContent() } BaseRadar.LoadModel("cube"); - HealthModel = Load("cube - green"); + HealthModel = Load("cube"); ThrustSound = LoadSoundEffect("Thrust"); ThrustTimer.Amount = (float)ThrustSound.Duration.TotalSeconds; @@ -104,7 +108,7 @@ public override void LoadContent() OreSound = LoadSoundEffect("PickupChunk"); DockSound = LoadSoundEffect("Dock"); UnDockSound = LoadSoundEffect("UnDock"); - + ShotHitSound = LoadSoundEffect("PlayerShotHit"); } public override void BeginRun() @@ -173,10 +177,6 @@ public override void Update(GameTime gameTime) CheckEdge(); GetInput(); CheckDocking(); - Vector3 offset = SetVelocity(AngleFromVectors(Position, BaseRef.Position), 45); - offset.Z = 250; - BaseRadar.Position = Position + offset; - } base.Update(gameTime); @@ -195,6 +195,13 @@ public override void Update(GameTime gameTime) ChestCollected.Position.Y = Position.Y + 400; ChestCollected.UpdatePosition(); + if (!Docked) + { + Vector3 offset = SetVelocity(AngleFromVectors(Position, BaseRef.Position), 40); + offset.Z = 250; + BaseRadar.Position = Position + offset; + } + BaseRef.Update(gameTime); } } @@ -202,6 +209,7 @@ public override void Update(GameTime gameTime) public void Dead() { DeadSound.Play(); + Explosion.Spawn(Position, Radius * 0.25f); Active = false; Flame.Active = false; BaseRadar.Active = false; @@ -227,7 +235,7 @@ public void NewGame() ChestCollected.UpdateNumber(Chests); } - public void Bumped(Vector3 position, Vector3 velocity) + public void Bumped(Vector3 position, Vector3 velocity) //TODO: Make this part of PositionedObject class. { Acceleration = Vector3.Zero; Velocity = (Velocity * 0.1f) * -1; @@ -238,17 +246,18 @@ public void Bumped(Vector3 position, Vector3 velocity) /// /// Return true if a shot hit object. /// - /// Object to be tested against. + /// Object to be tested against. /// true if hit - public bool CheckShotCollusions(PositionedObject po) //TODO: Use this in other games. + public bool CheckShotCollusions(PositionedObject target) //TODO: Use this in other games. { foreach (Shot shot in Shots) { if (shot.Active) { - if (shot.CirclesIntersect(po)) + if (shot.CirclesIntersect(target)) { - shot.Active = false; + //ShotHitSound.Play(); + shot.Hit(); return true; } } diff --git a/Shadow and Planet/Entities/Shot.cs b/Shadow and Planet/Entities/Shot.cs index c99e5e1..6191959 100644 --- a/Shadow and Planet/Entities/Shot.cs +++ b/Shadow and Planet/Entities/Shot.cs @@ -14,10 +14,13 @@ namespace Shadow_and_Planet.Entities public class Shot : Mod { Timer LifeTimer; + Explode Explosion; + SoundEffect HitSound; public Shot(Game game) : base(game) { LifeTimer = new Timer(game); + Explosion = new Explode(game); } public override void Initialize() @@ -36,6 +39,7 @@ public override void LoadContent() base.LoadContent(); LoadModel("cube"); + HitSound = LoadSoundEffect("ShotHit"); } public override void Update(GameTime gameTime) @@ -57,6 +61,13 @@ public void Spawn(Vector3 postion, Vector3 direction, float timer) LifeTimer.Reset(timer); } + public void Hit() + { + Active = false; + Explosion.Spawn(Position, Radius * 0.25f); + HitSound.Play(); + } + void CheckEdge() { if (Position.X > 6000) diff --git a/Shadow and Planet/Properties/AssemblyInfo.cs b/Shadow and Planet/Properties/AssemblyInfo.cs index 638b204..3e54925 100644 --- a/Shadow and Planet/Properties/AssemblyInfo.cs +++ b/Shadow and Planet/Properties/AssemblyInfo.cs @@ -8,10 +8,10 @@ [assembly: AssemblyTitle("Shadow and Planet")] [assembly: AssemblyProduct("Shadow and Planet")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] +[assembly: AssemblyDescription("Ludum Dare 40 Game Jam")] +[assembly: AssemblyCompany("Panther Games")] +[assembly: AssemblyCopyright("NA")] +[assembly: AssemblyTrademark("NA")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible diff --git a/Shadow and Planet/Shadow and Planet.csproj b/Shadow and Planet/Shadow and Planet.csproj index df9fc3d..3eb9d1b 100644 --- a/Shadow and Planet/Shadow and Planet.csproj +++ b/Shadow and Planet/Shadow and Planet.csproj @@ -13,7 +13,7 @@ Shadow and Planet 512 DesktopGL - v4.7 + v4.5.2 @@ -74,6 +74,8 @@ + + diff --git a/Shadow and Planet/Vox/LavaLamp.vox b/Shadow and Planet/Vox/LavaLamp.vox new file mode 100644 index 0000000..ff592a2 Binary files /dev/null and b/Shadow and Planet/Vox/LavaLamp.vox differ diff --git a/Shadow and Planet/Vox/SandP-Asteroid.vox b/Shadow and Planet/Vox/SandP-Asteroid.vox new file mode 100644 index 0000000..575434d Binary files /dev/null and b/Shadow and Planet/Vox/SandP-Asteroid.vox differ diff --git a/Shadow and Planet/Vox/SandP-Base.vox b/Shadow and Planet/Vox/SandP-Base.vox new file mode 100644 index 0000000..6865d25 Binary files /dev/null and b/Shadow and Planet/Vox/SandP-Base.vox differ diff --git a/Shadow and Planet/Vox/SandP-Chest.vox b/Shadow and Planet/Vox/SandP-Chest.vox new file mode 100644 index 0000000..1f1c360 Binary files /dev/null and b/Shadow and Planet/Vox/SandP-Chest.vox differ diff --git a/Shadow and Planet/Vox/SandP-Chunk.vox b/Shadow and Planet/Vox/SandP-Chunk.vox new file mode 100644 index 0000000..29f3ab1 Binary files /dev/null and b/Shadow and Planet/Vox/SandP-Chunk.vox differ diff --git a/Shadow and Planet/Vox/SandP-Missile.vox b/Shadow and Planet/Vox/SandP-Missile.vox new file mode 100644 index 0000000..ecbddac Binary files /dev/null and b/Shadow and Planet/Vox/SandP-Missile.vox differ diff --git a/Shadow and Planet/Vox/SandP-Pirate.vox b/Shadow and Planet/Vox/SandP-Pirate.vox new file mode 100644 index 0000000..7cbf0ce Binary files /dev/null and b/Shadow and Planet/Vox/SandP-Pirate.vox differ diff --git a/Shadow and Planet/Vox/SandP-Player.vox b/Shadow and Planet/Vox/SandP-Player.vox new file mode 100644 index 0000000..41237bb Binary files /dev/null and b/Shadow and Planet/Vox/SandP-Player.vox differ diff --git a/Shadow and Planet/Vox/SandP-PlayerFlame.vox b/Shadow and Planet/Vox/SandP-PlayerFlame.vox new file mode 100644 index 0000000..57abef3 Binary files /dev/null and b/Shadow and Planet/Vox/SandP-PlayerFlame.vox differ diff --git a/Shadow and Planet/app.config b/Shadow and Planet/app.config index 245587d..ff99501 100644 --- a/Shadow and Planet/app.config +++ b/Shadow and Planet/app.config @@ -1,3 +1,3 @@ - +