In case if you're curious, here's the entire code:
PHP Code:
#region File Description
//-----------------------------------------------------------------------------
// GameplayScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using System.Threading;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
#endregion
namespace GameStateManagement
{
/// <summary>
/// This screen implements the actual game logic. It is just a
/// placeholder to get the idea across: you'll probably want to
/// put some more interesting gameplay in here!
/// </summary>
class GameplayScreen : GameScreen
{
#region Fields
ContentManager content;
SpriteFont gameFont;
Vector2 playerPosition = new Vector2(100, 100);
Vector2 enemyPosition = new Vector2(100, 100);
Random random = new Random();
#region Variables
Model shipModel;
Vector3 cameraPosition = new Vector3(0.0f, 5000.0f, 0.0f);
Vector3 shipPosition = Vector3.Zero;
#endregion
#endregion
#region Initialization
/// <summary>
/// Constructor.
/// </summary>
public GameplayScreen()
{
TransitionOnTime = TimeSpan.FromSeconds(1.5);
TransitionOffTime = TimeSpan.FromSeconds(0.5);
}
/// <summary>
/// Load graphics content for the game.
/// </summary>
public override void LoadGraphicsContent(bool loadAllContent)
{
if (loadAllContent)
{
if (content == null)
content = new ContentManager(ScreenManager.Game.Services);
gameFont = content.Load<SpriteFont>("Content/gamefont");
shipModel = content.Load<Model>("Models/p1_wedge");
// A real game would probably have more content than this sample, so
// it would take longer to load. We simulate that by delaying for a
// while, giving you a chance to admire the beautiful loading screen.
Thread.Sleep(1000);
}
}
/// <summary>
/// Unload graphics content used by the game.
/// </summary>
public override void UnloadGraphicsContent(bool unloadAllContent)
{
if (unloadAllContent)
content.Unload();
}
#endregion
#region Update and Draw
/// <summary>
/// Updates the state of the game. This method checks the GameScreen.IsActive
/// property, so the game will stop updating when the pause menu is active,
/// or if you tab away to a different application.
/// </summary>
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
{
base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
if (IsActive)
{
// Apply some random jitter to make the enemy move around.
const float randomization = 10;
enemyPosition.X += (float)(random.NextDouble() - 0.5) * randomization;
enemyPosition.Y += (float)(random.NextDouble() - 0.5) * randomization;
// Apply a stabilizing force to stop the enemy moving off the screen.
Vector2 targetPosition = new Vector2(200, 200);
enemyPosition = Vector2.Lerp(enemyPosition, targetPosition, 0.05f);
// TODO: this game isn't very fun! You could probably improve
// it by inserting something more interesting in this space :-)
}
}
/// <summary>
/// Lets the game respond to player input. Unlike the Update method,
/// this will only be called when the gameplay screen is active.
/// </summary>
public override void HandleInput(InputState input)
{
if (input == null)
throw new ArgumentNullException("input");
if (input.PauseGame)
{
// If they pressed pause, bring up the pause menu screen.
ScreenManager.AddScreen(new PauseMenuScreen());
}
else
{
// Otherwise move the player position.
const float movementSpeed = 2;
if (input.CurrentKeyboardState.IsKeyDown(Keys.Left))
playerPosition.X -= movementSpeed;
if (input.CurrentKeyboardState.IsKeyDown(Keys.Right))
playerPosition.X += movementSpeed;
if (input.CurrentKeyboardState.IsKeyDown(Keys.Up))
playerPosition.Y -= movementSpeed;
if (input.CurrentKeyboardState.IsKeyDown(Keys.Down))
playerPosition.Y += movementSpeed;
Vector2 thumbstick = input.CurrentGamePadState.ThumbSticks.Left;
playerPosition.X += thumbstick.X * movementSpeed;
playerPosition.Y -= thumbstick.Y * movementSpeed;
}
}
/// <summary>
/// Draws the gameplay screen.
/// </summary>
public override void Draw(GameTime gameTime)
{
// This game has a blue background. Why? Because!
ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CornflowerBlue, 0, 0);
Matrix[] transforms = new Matrix[shipModel.Bones.Count];
shipModel.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in shipModel.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(shipPosition);
effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), (800.0f / 600.0f), 10.0f, 10000.0f);
}
mesh.Draw();
}
// If the game is transitioning on or off, fade it out to black.
if (TransitionPosition > 0)
ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha);
}
#endregion
}
}
I really need help on this

for some reason it doesn't show anything!!! sigh... I think there's something wrong with the aspect ratio...?