Skip to content

Commit

Permalink
Turret now shoots at player, duck drops bombs on player.
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceJZ committed Jan 8, 2018
1 parent 5a9700a commit b7c77ec
Show file tree
Hide file tree
Showing 29 changed files with 953 additions and 173 deletions.
10 changes: 7 additions & 3 deletions CFNGamejam2/CFNGamejam2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
<UpdateAssemblyVersion>True</UpdateAssemblyVersion>
<UpdateAssemblyFileVersion>True</UpdateAssemblyFileVersion>
<UpdateAssemblyInfoVersion>True</UpdateAssemblyInfoVersion>
<AssemblyVersionSettings>IncrementOnDemand.Increment.DayStamp.TimeStamp</AssemblyVersionSettings>
<AssemblyFileVersionSettings>YearStamp.DayOfYearStamp.MonthStamp.TimeStamp</AssemblyFileVersionSettings>
<AssemblyVersionSettings>IncrementOnDemand.Increment.DayStamp.IncrementOnDemandWithReset</AssemblyVersionSettings>
<AssemblyFileVersionSettings>MMddStamp.DayOfYearStamp.MonthStamp.TimeStamp</AssemblyFileVersionSettings>
<AssemblyInfoVersionSettings>YearStamp.DateStamp.DeltaDayStamp.Increment</AssemblyInfoVersionSettings>
<PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType>
<AssemblyVersion>1.254.6.0540</AssemblyVersion>
<AssemblyVersion>1.425.8.0101</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -58,6 +58,7 @@
<Compile Include="Engine\BoundingPart.cs" />
<Compile Include="Engine\BoundingPartList.cs" />
<Compile Include="Engine\Camera.cs" />
<Compile Include="Engine\Factory.cs" />
<Compile Include="Engine\IBeginRun.cs" />
<Compile Include="Engine\ICamera2D.cs" />
<Compile Include="Engine\IDrawComponent.cs" />
Expand All @@ -75,11 +76,14 @@
<Compile Include="Engine\SpritePositionedObject.cs" />
<Compile Include="Engine\Timer.cs" />
<Compile Include="Engine\Words.cs" />
<Compile Include="Entities\Bomb.cs" />
<Compile Include="Entities\Duck.cs" />
<Compile Include="Entities\EnemyControl.cs" />
<Compile Include="Entities\Explode.cs" />
<Compile Include="Entities\ExplodeParticle.cs" />
<Compile Include="Entities\Ground.cs" />
<Compile Include="Entities\Missile.cs" />
<Compile Include="Entities\MissileBattery.cs" />
<Compile Include="Entities\Player.cs" />
<Compile Include="Entities\TankShot.cs" />
<Compile Include="Game1.cs" />
Expand Down
76 changes: 76 additions & 0 deletions CFNGamejam2/Content/Content.mgcb
Original file line number Diff line number Diff line change
Expand Up @@ -963,3 +963,79 @@
/processorParam:TextureFormat=Compressed
/build:Models/DuckRWing.obj

#begin Models/MissileBatteryBase.obj
/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/MissileBatteryBase.obj

#begin Models/MissileBatteryTurret.obj
/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/MissileBatteryTurret.obj

#begin Models/Missile.obj
/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/Missile.obj

#begin Models/Bomb.obj
/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/Bomb.obj

16 changes: 16 additions & 0 deletions CFNGamejam2/Content/Models/Bomb.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 06.01.2018 10:31:52

newmtl palette
Ns 30.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.0000 0.0000 0.0000
Kd 1.0000 1.0000 1.0000
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\Bomb.png
map_Kd E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\Bomb.png
Binary file added CFNGamejam2/Content/Models/Bomb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions CFNGamejam2/Content/Models/Missile.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 06.01.2018 09:42:06

newmtl palette
Ns 30.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.0000 0.0000 0.0000
Kd 1.0000 1.0000 1.0000
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\Missile.png
map_Kd E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\Missile.png
Binary file added CFNGamejam2/Content/Models/Missile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions CFNGamejam2/Content/Models/MissileBattery-0.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# MagicaVoxel @ Ephtracy

newmtl palette
illum 1
Ka 0.000 0.000 0.000
Kd 1.000 1.000 1.000
Ks 0.000 0.000 0.000
map_Kd MissileBattery-0.png
Binary file added CFNGamejam2/Content/Models/MissileBattery-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions CFNGamejam2/Content/Models/MissileBattery-1.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# MagicaVoxel @ Ephtracy

newmtl palette
illum 1
Ka 0.000 0.000 0.000
Kd 1.000 1.000 1.000
Ks 0.000 0.000 0.000
map_Kd MissileBattery-1.png
Binary file added CFNGamejam2/Content/Models/MissileBattery-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions CFNGamejam2/Content/Models/MissileBattery-2.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# MagicaVoxel @ Ephtracy

newmtl palette
illum 1
Ka 0.000 0.000 0.000
Kd 1.000 1.000 1.000
Ks 0.000 0.000 0.000
map_Kd MissileBattery-2.png
Binary file added CFNGamejam2/Content/Models/MissileBattery-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions CFNGamejam2/Content/Models/MissileBatteryBase.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 07.01.2018 13:25:52

newmtl palette
Ns 30.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.0000 0.0000 0.0000
Kd 1.0000 1.0000 1.0000
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\MissileBattery-0.png
map_Kd E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\MissileBattery-0.png
16 changes: 16 additions & 0 deletions CFNGamejam2/Content/Models/MissileBatteryTurret.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 07.01.2018 13:27:49

newmtl palette
Ns 30.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.0000 0.0000 0.0000
Kd 1.0000 1.0000 1.0000
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\MissileBattery-1.png
map_Kd E:\Documents\Visual Studio 2017\Projects\VS2017C#\MonoGame\CFNGamejam2\CFNGamejam2\Content\Models\MissileBattery-1.png
105 changes: 67 additions & 38 deletions CFNGamejam2/Engine/AModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@ public class AModel : PositionedObject, IDrawComponent, ILoadContent
public Vector3 ModelScaleVelocity = Vector3.Zero;
public Vector3 ModelScaleAcceleration = Vector3.Zero;
bool m_AnimatedScale = true;
bool m_Visable = true;

public XnaModel XNAModel { get; private set; }
public Matrix TheWoldMatrix { get => BaseWorld; }
public BoundingSphere Sphere { get => XNAModel.Meshes[0].BoundingSphere; }
public float SphereRadius { get => XNAModel.Meshes[0].BoundingSphere.Radius; }
public bool AnimatedScale { get => m_AnimatedScale; set => m_AnimatedScale = value; }
public bool Visable { get => m_Visable; set => m_Visable = value; }
public bool Visable { get => Enabled; set => Enabled = value; }

public AModel (Game game) : base(game)
{

}

public AModel(Game game, XnaModel model) : base(game)
Expand Down Expand Up @@ -63,55 +61,55 @@ public override void Initialize()

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

public override void Update(GameTime gameTime)
{
base.Update(gameTime);

if (Active)
/* A rule of thumb is ISROT - Identity, Scale, Rotate, Orbit, Translate.
This is the order to multiple your matrices in.
So for the moon and earth example, to place the moon:
Identity - this is just Matrix.Identity (an all 1's matrix).
Scale - Scale the moon to it's proper size.
Rotate - rotate the moon around it's own center
Orbit - this is a two step Translate then Rotate process,
first Translate (move) the moon to it's position relative to the
earth (i.e. if the earth was at 0, 0, 0). The rotate the moon around
this point to position it in orbit.
Translate - move the moon to the final location, which will be the same
as the location of earth in this case since it's already setup to be in orbit.*/

//Calculate the base transformation by combining
//translation, rotation, and scaling
//BaseWorld = Matrix.CreateScale(ModelScale)
// * Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z)
// * Matrix.CreateTranslation(Position);

//if (Child)
//{
// BaseWorld *= Matrix.CreateFromYawPitchRoll(ParentPO.Rotation.Y + ParentPO.ParentRotation.Y,
// ParentPO.Rotation.X + ParentPO.ParentRotation.X,
// ParentPO.Rotation.Z + ParentPO.ParentRotation.Z)
// * Matrix.CreateTranslation(ParentPO.Position + ParentPO.ParentPosition);
//}

MatrixUpdate();

if (m_AnimatedScale)
{
/* A rule of thumb is ISROT - Identity, Scale, Rotate, Orbit, Translate.
This is the order to multiple your matrices in.
So for the moon and earth example, to place the moon:
Identity - this is just Matrix.Identity (an all 1's matrix).
Scale - Scale the moon to it's proper size.
Rotate - rotate the moon around it's own center
Orbit - this is a two step Translate then Rotate process,
first Translate (move) the moon to it's position relative to the
earth (i.e. if the earth was at 0, 0, 0). The rotate the moon around
this point to position it in orbit.
Translate - move the moon to the final location, which will be the same
as the location of earth in this case since it's already setup to be in orbit.*/
// Calculate the base transformation by combining
// translation, rotation, and scaling
MatrixUpdate();
//BaseWorld = Matrix.CreateScale(ModelScale)
// * Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z)
// * Matrix.CreateTranslation(Position);

//if (Child)
//{
// BaseWorld *= Matrix.CreateFromYawPitchRoll(ParentPO.Rotation.Y + ParentPO.ParentRotation.Y,
// ParentPO.Rotation.X + ParentPO.ParentRotation.X,
// ParentPO.Rotation.Z + ParentPO.ParentRotation.Z)
// * Matrix.CreateTranslation(ParentPO.Position + ParentPO.ParentPosition);
//}

if (m_AnimatedScale)
{
float eGT = (float)gameTime.ElapsedGameTime.TotalSeconds;
float eGT = (float)gameTime.ElapsedGameTime.TotalSeconds;

ModelScaleVelocity += ModelScaleAcceleration * eGT;
ModelScale += ModelScaleVelocity * eGT;
}
ModelScaleVelocity += ModelScaleAcceleration * eGT;
ModelScale += ModelScaleVelocity * eGT;
}
}

public void Draw()
{
if (Active && Visable)
if (Visable & Active)
{
if (XNAModel == null)
return;
Expand Down Expand Up @@ -157,6 +155,37 @@ public void MatrixUpdate()
}
}
/// <summary>
/// If position, rotation and velocity are used.
/// </summary>
/// <param name="position">Position to spawn at.</param>
/// <param name="rotation">Rotation to spawn at.</param>
/// <param name="velocity">Initial Velocity to spawn with.</param>
public virtual void Spawn(Vector3 position, Vector3 rotation, Vector3 velocity)
{
Velocity = velocity;
Spawn(position, rotation);
}
/// <summary>
/// If only position and rotation are used.
/// </summary>
/// <param name="position">Position to spawn at.</param>
/// <param name="rotation">Rotation to spawn at.</param>
public virtual void Spawn(Vector3 position, Vector3 rotation)
{
Rotation = rotation;
Spawn(position);
}
/// <summary>
/// If only position is used.
/// </summary>
/// <param name="position">Position to spawn at.</param>
public virtual void Spawn(Vector3 position)
{
Active = true;
Position = position;
MatrixUpdate();
}
/// <summary>
/// Sphere collusion detection. Target sphere will be compared to this class's.
/// Will return true of they intersect on the X and Y plane.
/// The Z plane is ignored.
Expand Down
Loading

0 comments on commit b7c77ec

Please sign in to comment.