Skip to content

Commit

Permalink
Version being turned into CFN Game Jam #2.
Browse files Browse the repository at this point in the history
Had to change some of the engine, was a bug that caused all kinds of issues when I made it so it started over for the next level. After this I'm going to rewrite my engine from the ground up.
  • Loading branch information
LanceJZ committed Jan 14, 2018
1 parent 436164c commit de2249e
Show file tree
Hide file tree
Showing 21 changed files with 159 additions and 95 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.721.13.0101</AssemblyVersion>
<AssemblyVersion>1.764.14.0101</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
Expand Down
9 changes: 1 addition & 8 deletions CFNGamejam2/Engine/AModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Engine
{
public class AModel : PositionedObject, IDrawComponent, ILoadContent
public class AModel : PositionedObject, IDrawComponent
{
public Vector3 DefuseColor = new Vector3(1,1,1);
Texture2D XNATexture;
Expand Down Expand Up @@ -46,7 +46,6 @@ public override void Initialize()
{
Enabled = true;
Services.AddDrawableComponent(this);
Services.AddLoadable(this);

Services.GraphicsDM.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
Services.GraphicsDM.GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicWrap;
Expand All @@ -60,7 +59,6 @@ public override void Initialize()

public override void BeginRun()
{
LoadContent();
base.BeginRun();
}

Expand Down Expand Up @@ -286,11 +284,6 @@ public SoundEffect LoadSoundEffect(string soundName)
return Game.Content.Load<SoundEffect>("Sounds/" + soundName);
}

public virtual void LoadContent()
{
//This method intentionally left blank.
}

public void Destroy()
{
//if (ModelTransforms != null)
Expand Down
5 changes: 4 additions & 1 deletion CFNGamejam2/Engine/ExplodeParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ public class ExplodeParticle : AModel
public ExplodeParticle(Game game) : base(game)
{
LifeTimer = new Timer(game);

LoadContent();
}

public override void Initialize()
{
base.Initialize();
}

public override void LoadContent()
public void LoadContent()
{

BeginRun();
}

public override void BeginRun()
Expand Down
4 changes: 2 additions & 2 deletions CFNGamejam2/Engine/Numbers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public Numbers(Game game) : base(game)

public override void Initialize()
{
Services.AddLoadable(this);

base.Initialize();
LoadContent();
BeginRun();
}

public void LoadContent()
Expand Down
42 changes: 20 additions & 22 deletions CFNGamejam2/Engine/PositionedObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ public bool Active

if (m_Parent)
{
foreach (PositionedObject child in ChildrenPOs)
{
if (child.ActiveDependent)
child.Active = value;
}
foreach (PositionedObject child in ChildrenPOs)
{
if (child.ActiveDependent)
child.Active = value;
}
}
}
}
Expand Down Expand Up @@ -126,26 +126,24 @@ public Rectangle BoundingBox
/// <param name="game">The game class</param>
public PositionedObject(Game game) : base(game)
{
ChildrenPOs = new List<PositionedObject>();
game.Components.Add(this);
}
#endregion
#region Public Methods
public override void Initialize()
ChildrenPOs = new List<PositionedObject>();
Game.Components.Add(this);
}
#endregion
#region Public Methods
public override void Initialize()
{
base.Initialize();
BeginRun();
base.Initialize();
}

public virtual void BeginRun()
{

}
/// <summary>
/// Allows the game component to be updated.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Update(GameTime gameTime)
}
/// <summary>
/// Allows the game component to be updated.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Update(GameTime gameTime)
{
if (Moveable)
{
Expand Down Expand Up @@ -194,8 +192,8 @@ public virtual void AddAsChildOf(PositionedObject Parent, bool activeDependent,
Child = true;
ParentPO = Parent;
ParentPO.Parent = true;
ParentPO.ChildrenPOs.Add(this);
}
ParentPO.ChildrenPOs.Add(this);
}

public void Remove()
{
Expand Down
5 changes: 4 additions & 1 deletion CFNGamejam2/Engine/SmokeParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class SmokeParticle : AModel
public SmokeParticle(Game game) : base(game)
{
LifeTimer = new Timer(game);

LoadContent();
}

public override void Initialize()
Expand All @@ -25,9 +27,10 @@ public override void Initialize()

}

public override void LoadContent()
public void LoadContent()
{

BeginRun();
}

public override void BeginRun()
Expand Down
4 changes: 2 additions & 2 deletions CFNGamejam2/Engine/Words.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public Words (Game game) : base(game)
public override void Initialize()
{
base.Initialize();
Services.AddLoadable(this);
Services.AddBeginable(this);
LoadContent();
BeginRun();
}

public void LoadContent()
Expand Down
5 changes: 4 additions & 1 deletion CFNGamejam2/Entities/Bomb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public Bomb(Game game, GameLogic gameLogic) : base(game)
Explosion = new Explode(game);
LifeTimer = new Timer(game, 5);

LoadContent();
}

public override void Initialize()
Expand All @@ -31,10 +32,12 @@ public override void Initialize()
base.Initialize();
}

public override void LoadContent()
public void LoadContent()
{
LoadModel("Bomb");
ExplodeSound = LoadSoundEffect("BombExplode");

BeginRun();
}

public override void BeginRun()
Expand Down
11 changes: 8 additions & 3 deletions CFNGamejam2/Entities/Duck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Duck(Game game, GameLogic gameLogic) : base(game)
RefGameLogic = gameLogic;

for (int i = 0; i < 2; i++)
Wings[i] = new AModel(game);
Wings[i] = new AModel(Game);

Bombs = new List<Bomb>();
Explosion = new Explode(game);
Expand All @@ -51,6 +51,8 @@ public Duck(Game game, GameLogic gameLogic) : base(game)
DropBombTimer = new Timer(game, 2);
ChangeHeadingTimer = new Timer(game);
QuackTimer = new Timer(game);

LoadContent();
}

public override void Initialize()
Expand All @@ -59,14 +61,17 @@ public override void Initialize()
base.Initialize();
}

public override void LoadContent()
public void LoadContent()
{
LoadModel("DuckBody");

Wings[0].LoadModel("DuckLWing");
Wings[1].LoadModel("DuckRWing");

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

BeginRun();
}

public override void BeginRun()
Expand Down Expand Up @@ -248,8 +253,8 @@ void DropBomb()

if (spawnNew)
{
thisOne = Bombs.Count;
Bombs.Add(new Bomb(Game, RefGameLogic));
thisOne = Bombs.Count - 1;
}

Bombs[thisOne].Spawn(Position, Rotation, Velocity / 4);
Expand Down
34 changes: 26 additions & 8 deletions CFNGamejam2/Entities/EnemyControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class EnemyControl : GameComponent, IBeginable, IUpdateableComponent, ILo
List<Wall> TheWall;
XnaModel WallPiece;
Gateway TheGateway;
int Wave;

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

Expand Down Expand Up @@ -76,7 +77,7 @@ public void GameOver()

}

public void NewGame()
public void NewWave()
{
foreach (Duck duck in TheDucks)
{
Expand All @@ -85,21 +86,38 @@ public void NewGame()

int border = RefGameLogic.RefGround.TheBorder;

for (int i = 0; i < 4; i++)
for (int i = 0; i < (1 + Wave); i++)
SpawnDuck(new Vector3(Services.RandomMinMax(-border, border), 200, border + 500));

foreach(MissileBattery battery in TheBatterys)
foreach (MissileBattery battery in TheBatterys)
{
battery.Active = false;
}

for (int i = 0; i < 4; i++)
TheGateway.Spawn(TheGateway.Position);

PlaceBatteries();

Wave++;
}

public void NewGame()
{
Wave = 0;
NewWave();
}

void PlaceBatteries()
{
int rows = Wave + 1;

if (rows > 5) rows = 5;

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

TheGateway.Spawn(TheGateway.Position);
}

void SpawnWall(Vector3 position)
Expand Down
9 changes: 7 additions & 2 deletions CFNGamejam2/Entities/Gateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public Gateway(Game game, GameLogic gameLogic) : base(game)
Doors[i] = new AModel(game);
DoorExplosions[i] = new Explode(game);
}

LoadContent();
}

public override void Initialize()
Expand All @@ -40,7 +42,7 @@ public override void Initialize()

}

public override void LoadContent()
public void LoadContent()
{
LoadModel("GateFrame");
HealthBar.LoadModel("Core/Cube");
Expand All @@ -52,6 +54,8 @@ public override void LoadContent()
}

ExplodeSound = LoadSoundEffect("GateExplode");

BeginRun();
}

public override void BeginRun()
Expand All @@ -72,6 +76,7 @@ public override void BeginRun()
for (int i = 0; i < 2; i++)
{
Doors[i].AddAsChildOf(this, true, false);
DoorExplosions[i].DefuseColor = new Vector3(0.4f, 0.4f, 0.5f);
}

HealthBar.DefuseColor = new Vector3(0, 2, 0);
Expand Down Expand Up @@ -152,7 +157,7 @@ void CheckCollide()

foreach(AModel door in Doors)
{
DoorExplosions[i].Spawn(door.Position, 5, 100);
DoorExplosions[i].Spawn(door.Position, 10, 100);
i++;
}

Expand Down
6 changes: 5 additions & 1 deletion CFNGamejam2/Entities/Missile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public Missile(Game game, GameLogic gameLogic) : base(game)
RefGameLogic = gameLogic;
LifeTimer = new Timer(game);
Explosion = new Explode(game);

LoadContent();
}

public override void Initialize()
Expand All @@ -32,10 +34,12 @@ public override void Initialize()
base.Initialize();
}

public override void LoadContent()
public void LoadContent()
{
LoadModel("Missile");
HitSound = LoadSoundEffect("MissileHit");

BeginRun();
}

public override void BeginRun()
Expand Down
Loading

0 comments on commit de2249e

Please sign in to comment.