GOH Omnipuff

ok im new and just starting out im in highschool

neways im working on the tutorial and i do exactly what it tells me but i get 13 error messages froem the lines of coding i copied from the tutorial whats wrong

//3d model to draw

Model myModel;

protected override void LoadGraphicsContent(bool loadAllContent)

{

if (loadAllContent)

{

myModel = content.Load<Model>("Content\\Models\\p1_wedge");

}

}

}

/// <param name="unloadAllContent">Which type of content to unload.</param>

protected override void UnloadGraphicsContent(bool unloadAllContent)

{

if (unloadAllContent == true)

{

content.Unload();

}

}

/// <param name="gameTime">Provides a snapshot of timing values.</param>

protected override void Update(GameTime gameTime)

{

// Allows the default game to exit on Xbox 360 and Windows

if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)

this.Exit();

// TODO: Add your update logic here

base.Update(gameTime);

}

Position of the model in world space, and rotation

Vector3 modelPosition = Vector3.Zero;

float modelRotation = 0.0f;

//Position of the Camera in world space, for our view matrix

Vector3 cameraPosition = new Vector3(0.0f, 50.0f, 5000.0f);

//Aspect ratio to use for the projection matrix

float aspectRatio = 640.0f / 480.0f;

protected override void Draw(GameTime gameTime)

{

graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

//Copy any parent transforms

Matrix[] transforms = new Matrix [myModel.Bones.Count];

myModel.CopyAbsoluteBoneTransformsTo(transforms);

//Draw the model, a model can have multiple meshes, so loop

foreach (ModelMesh mesh in myModel.Meshes)

{

//This is where the mesh orientation is set, as well as our camera and projection

foreach (BasicEffect effect in mesh.Effects)

{

effect.EnableDefaultLighting();

effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(modelRotation)

* Matrix.CreateTranslation(modelPosition);

effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);

effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),

aspectRatio, 1.0f, 10000.0f);

}

//Draw the mesh, will use the effects set above.

mesh.Draw();

}

}



Re: XNA Game Studio Express wierd error messages

dczraptor

You might want to read up on some basic C# programming tutorials before you try game programming. It will be very, very painful if you do understand the syntax and logic behind a structured object oriented program. Right off the bat, I can see mis-matched braces and lines which should be commented.

Try googling for some C# tutorials. Trust me, they'll help a lot in the long run:

http://www.google.com/search hl=en&q=c%23+tutorial






Re: XNA Game Studio Express wierd error messages

Jim Perry

Are we supposed to guess what the errors are that you're getting




Re: XNA Game Studio Express wierd error messages

GOH Omnipuff

ok ill do some c# tutorials



Re: XNA Game Studio Express wierd error messages

Pocketmnky

I'll agree that you're going to need to learn C# before you can learn to use XNA. Just like you need to learn to walk before you can learn to crawl, right

"neway"... start by commenting out (type // in front of) the line "Position of the model in world space, and rotation". Also up at the top, the 3rd closing bracket } just above "/// <param name="unloadAllContent">Which type of content to unload.</param>" should be deleted.