
1.My first question is how to make the enemy initialize randomly only behind the black line ?
2.How to get pseudo 3D model coordinates ?
3.After I have the model coordinates how to move my 2d texture slowly to the model ?
Posted 31 January 2012 - 02:20 PM

Posted 31 January 2012 - 02:55 PM
Vector2 position = new Vector2(random.Next(0, 1000), random.Next(0, 1000));
eninit = new Enemy(enemyTexture, position, 1000, 100, 0.5f);
//adding enemy to the list....
enemies.Add(eninit);
Matrix translation = Matrix.CreateTranslation(
modelTransformaton.X, modelTransformaton.Y, -modelTransformaton.Z);
Posted 31 January 2012 - 03:52 PM
Posted 02 February 2012 - 05:15 AM
if ((texture != null) && (texture.Meshes.Count > 0))
{
Matrix[] transforms = new Matrix[texture.Bones.Count];
texture.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh meshh in texture.Meshes)
{
foreach (BasicEffect effect in meshh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[meshh.ParentBone.Index] *
Matrix.CreateRotationY(0.0f)
* Matrix.CreateTranslation(Vector3.Zero);
effect.View = Matrix.CreateLookAt(new Vector3(0.0f, 50.0f, 5000.0f),
position, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(60.0f), aspectRatio,
1.0f, 10000.0f);
}
meshh.Draw();
}
}
Posted 02 February 2012 - 04:10 PM
Posted 03 February 2012 - 03:59 AM
void AddEnemy()
{
if (enemies.Count <= 10)
{
previousEnemyTime = TimeSpan.Zero;
nextEnemyTime = TimeSpan.FromSeconds(10.0f);
Microsoft.Xna.Framework.Vector3 position = new Microsoft.Xna.Framework.Vector3(random.Next(0, 300) * (-1), random.Next(0, 100) * (-1), 0.0f);
eninit = new Enemy(secondModel, position, 100, 100, 0.5f);
//List<Enemy>
enemies.Add(eninit);
}
}
Posted 03 February 2012 - 04:15 PM
rectangle2 = new Microsoft.Xna.Framework.Rectangle((int)enemy[i].Position.X, (int)enemy[i].Position.Y, enemy[i].Width, enemy[i].Height);
Posted 03 February 2012 - 04:36 PM
This post has been edited by Kilorn: 03 February 2012 - 04:37 PM
Posted 04 February 2012 - 02:59 PM
if ((texture != null) && (texture.Meshes.Count > 0))
{
Matrix[] transforms = new Matrix[texture.Bones.Count];
texture.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh meshh in texture.Meshes)
{
if (this.sphere.Radius == 0)
this.sphere = meshh.BoundingSphere;
else
this.sphere = BoundingSphere.CreateMerged(sphere, meshh.BoundingSphere);
foreach (BasicEffect effect in meshh.Effects)
{
effect.EnableDefaultLighting();
effect.World = transforms[meshh.ParentBone.Index] *
Matrix.CreateRotationY(modelRotation)
* Matrix.CreateTranslation(position);
effect.View = Matrix.CreateLookAt(new Vector3(0.0f, 50.0f, 5000.0f),
Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f), aspectRatio,
1.0f, 10000.0f);
cc = transforms[meshh.ParentBone.Index] *
Matrix.CreateRotationY(modelRotation)
* Matrix.CreateTranslation(position);
}
meshh.Draw();
}
this.sphere.Radius = 50.0f;
sphere.Center = this.position;
sphere.Transform(cc);
}
}
Posted 05 February 2012 - 06:56 AM

pos = Matrix.Invert(translation).Translation;
view1 = transforms[mesh.ParentBone.Index] *
Matrix.CreateScale(1 / mesh.BoundingSphere.Radius) *
scaling * rotation * translation;
projection1 = Matrix.CreatePerspective(
1, 1 / GraphicsDevice.Viewport.AspectRatio, 1f, 10000);
modelsp.Radius = 1000.0f;
modelsp.Center = pos;
DrawShape.AddBoundingSphere(modelsp, Microsoft.Xna.Framework.Color.Green);
DrawShape.Draw(gameTime, view1, projection1);
This post has been edited by mitko900: 05 February 2012 - 07:08 AM
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
