Pages

Showing posts with label xna. Show all posts
Showing posts with label xna. Show all posts

Saturday, November 27, 2010

how load model in your xbox game

now for developing your xbox game(or even in xna windows games) you need load model in your game.For this purpose you should first design your model in blender or 3ds max or maya or tools like that and export it to .x file .This format commonly used on developing DirectX and xna games.Next in your xbox games add model to to your content .Every model and other thing in content have name you can changed it on properties sidebar.

addmodelxbox

for coding you should doing this steps

1.create model

 Model newModel = Content.Load<Model> (assetName);    foreach (ModelMesh mesh in newModel.Meshes)
        foreach (ModelMeshPart meshPart in mesh.MeshParts)
            meshPart.Effect = effect.Clone(device)

2.next draw model in draw function with code

  Matrix worldMatrix = Matrix.CreateScale(0.0005f, 0.0005f, 0.0005f) * Matrix.CreateRotationY(MathHelper.Pi) * Matrix.CreateTranslation(new Vector3(19, 12, -5));
     Matrix[] newModelTransforms = new Matrix[newModel .Bones.Count];
     newModel.CopyAbsoluteBoneTransformsTo(newModelTransforms);
     foreach (ModelMesh mesh in newModel .Meshes)
     {
         foreach (Effect currentEffect in mesh.Effects)
         {
             currentEffect.CurrentTechnique = currentEffect.Techniques["Colored"];
             currentEffect.Parameters["xWorld"].SetValue(newModelTransforms[mesh.ParentBone.Index] * worldMatrix);
             currentEffect.Parameters["xView"].SetValue(viewMatrix);
             currentEffect.Parameters["xProjection"].SetValue(projectionMatrix);
         }
         mesh.Draw();
     }

you should add this code before base.Draw(gameTime);

you can use this code in one functions for using more in games or even in more games or add codes during games .

But it is better use this code on functions for better reading or using.

Monday, November 22, 2010

first step to xna and XBOX programming

before xna and visual studio setup you should know that your graphic card must be compatible with xna that means you should have graphic card with diret3d that support xna framework Hidef profile. Also for using xna 4 you need have  visual studio 2010 .

visualstudioxbox

 

Now created project.you can use just visual c#.net language for create project .Next you’ll see environment like above.In left sidebar you have files  of project and in middle part you’ll see code of game.if you run project  a blue window will be appeared.you can changed it easily.Just  go Draw function and change this code  GraphicsDevice.Clear(Color.CornflowerBlue); to this one  GraphicsDevice.Clear(Color.Red); and you’ill see a red windows.For now it is enough Winking smile,in following posts you’ll see more

Tuesday, November 16, 2010

do you want develop xbox game?

if you want it, first you shoud download or install visual studio express or other versions.notice that only express edition is free and for others you should paying.then download xna from here.Xna is useful tool for for developing xbox and windows phone games.
call-of-duty-4-7
next create account from here for submit  application in store but you can run your application in your computer or device without create account.in following posts I’ll discuss more about codes you need for develop good games

linkwithin

Related Posts Plugin for WordPress, Blogger...