Permalink
Browse files

Finished chapter 1.

  • Loading branch information...
1 parent 01a9a73 commit a9b69fb66448946964efdfbe662800d5191793aa @DavidBasarab committed Apr 29, 2012
@@ -41,6 +41,11 @@ public bool IsSpaceDown
get { return IsKeyDown(Keys.Space); }
}
+ public bool IsSpaceNotDown
+ {
+ get { return !IsSpaceDown; }
+ }
+
public override void Capture()
{
LastState = CurrentState;
@@ -72,7 +72,12 @@ private void CreateModel(Model model, Vector3 position, Vector3 rotation, Vector
Models.Add(genericModel);
}
- private void UpdateCamera(GameTime gameTime) {}
+ private void UpdateCamera(GameTime gameTime)
+ {
+ Camera.Move(Models[0].Position, Models[0].Rotation);
+
+ Camera.Update();
+ }
private void UpdateModel(GameTime gameTime)
{
@@ -86,13 +91,13 @@ private void UpdateModel(GameTime gameTime)
Models[0].Rotation += rotationChange * 0.025f;
- if (KeyboardState.IsSpaceDown)
- {
- return;
- }
+ if (KeyboardState.IsSpaceNotDown) return;
// Determine what direction to move in
- Matrix rotation = Matrix.CreateFromYawPitchRoll(Models[0].Rotation.Y, Models)
+ var rotation = Matrix.CreateFromYawPitchRoll(Models[0].Rotation.Y, Models[0].Rotation.X, Models[0].Rotation.Z);
+
+ // Move in the direction dictated by our rotation matrix
+ Models[0].Position += Vector3.Transform(Vector3.Forward, rotation) * gameTime.GetTotalMilliseconds() * 4;
}
}
}
@@ -36,6 +36,13 @@
<Processor>ModelProcessor</Processor>
</Compile>
</ItemGroup>
+ <ItemGroup>
+ <Compile Include="Ground.x">
+ <Name>Ground</Name>
+ <Importer>XImporter</Importer>
+ <Processor>ModelProcessor</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.
Other similar extension points exist, see Microsoft.Common.targets.

0 comments on commit a9b69fb

Please sign in to comment.