Skip to content

Commit

Permalink
Merge branch 'master' of github.com:zzorn/Spike3D
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed May 21, 2010
2 parents 73c4a02 + a091b1b commit 3b17011
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 15 deletions.
9 changes: 3 additions & 6 deletions SpaceRun/SpaceRun/Asteroid.cs
Expand Up @@ -16,20 +16,17 @@ namespace SpaceRun
{
public class Asteroid : Entity
{


public override void LogicUpdate(GameTime time, float t)
{
foreach (Entity player in EntityManager.get().playerShips)
{
if (Vector3.Distance(position, player.position) < radius_m)
if (Vector3.Distance(position, player.position + player.velocity * t) < radius_m)
{
Ship playerShip = ((Ship)player);

playerShip.takeDamage(playerShip.velocity.Length() / 1000);
playerShip.velocity = -player.velocity * 0.1f;
playerShip.takeDamage(playerShip.velocity.Length() * 10);
playerShip.velocity = -player.velocity * 0.5f;
playerShip.acceleration = Vector3.Zero;

}
}
}
Expand Down
10 changes: 5 additions & 5 deletions SpaceRun/SpaceRun/Content/Content.contentproj
Expand Up @@ -55,11 +55,6 @@
<Importer>FbxImporter</Importer>
<Processor>ModelProcessor</Processor>
</Compile>
<Compile Include="media\models\alpha_ship\textures\ship_color.png">
<Name>ship_color</Name>
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
</Compile>
<Compile Include="media\models\alpha_ship\textures\ship_luminous.png">
<Name>ship_luminous</Name>
<Importer>TextureImporter</Importer>
Expand Down Expand Up @@ -177,6 +172,11 @@
<Importer>FontDescriptionImporter</Importer>
<Processor>FontDescriptionProcessor</Processor>
</Compile>
<Compile Include="media\models\alpha_ship\textures\ship_color.png">
<Name>ship_color</Name>
<Importer>TextureImporter</Importer>
<Processor>TextureProcessor</Processor>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions SpaceRun/SpaceRun/Game1.cs
Expand Up @@ -92,7 +92,7 @@ protected override void Update(GameTime gameTime)
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Magenta);
GraphicsDevice.Clear(new Color(0, 0.05f, 0.1f));

GraphicsDevice.RenderState.DepthBufferEnable = true;
GraphicsDevice.RenderState.DepthBufferWriteEnable = true;
Expand All @@ -102,7 +102,10 @@ protected override void Draw(GameTime gameTime)
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);

//HACK: player debug
((PlayerShip)EntityManager.get().playerShips[0]).DrawDebug(spriteBatch, debugFont);
if (EntityManager.get().playerShips.Count > 0)
{
((PlayerShip)EntityManager.get().playerShips[0]).DrawDebug(spriteBatch, debugFont);
}

spriteBatch.End();

Expand Down
4 changes: 3 additions & 1 deletion SpaceRun/SpaceRun/PlayerShip.cs
Expand Up @@ -59,7 +59,9 @@ public void DrawDebug(SpriteBatch spriteBatch, SpriteFont font)
font,
"PlayerShip position[" + Math.Round(position.X) + "," + Math.Round(position.Y) + "," + Math.Round(position.Z) + "]\n" +
"PlayerShip headAngs[" + Math.Round(MathHelper.ToDegrees(playerShipEulerAngles.X)) + "," + Math.Round(MathHelper.ToDegrees(playerShipEulerAngles.Y)) + "," + Math.Round(MathHelper.ToDegrees(playerShipEulerAngles.Z)) + "]\n" +
"PlayerShip velocity[" + Math.Round(velocity.X) + "," + Math.Round(velocity.Y) + "," + Math.Round(velocity.Z) + "]",
"PlayerShip velocity[" + Math.Round(velocity.X) + "," + Math.Round(velocity.Y) + "," + Math.Round(velocity.Z) + "]\n" +
"PlayerShip shield[" + Math.Round(shield) + "]\n" +
"PlayerShip hull[" + Math.Round(hull) + "]\n",
new Vector2(10.0f, 10.0f),
Color.Yellow);
}
Expand Down
4 changes: 3 additions & 1 deletion SpaceRun/SpaceRun/Ship.cs
Expand Up @@ -23,6 +23,7 @@ public Ship()
maxHull = 100;
maxThrust = 10;
maxTorqueThrust = 10;
shieldRechargeRate = 5.0f;

energy = maxEnergy;
shield = maxShield;
Expand All @@ -36,6 +37,7 @@ public Ship()
public float maxEnergy { get; protected set; }
public float maxHull { get; protected set; }
public float maxShield { get; protected set; }
public float shieldRechargeRate { get; protected set; }

protected float maxThrust { get; set; }
protected float maxTorqueThrust { get; set; }
Expand All @@ -45,7 +47,7 @@ public Ship()

public override void LogicUpdate(GameTime time, float t)
{
shield += t / 10.0f;
shield += shieldRechargeRate * t;
if (shield > maxShield)
{
shield = maxShield;
Expand Down

0 comments on commit 3b17011

Please sign in to comment.