• Content count

  • Joined

  • Last visited

Community Reputation

105 Neutral

About Sasstraliss

  • Rank
  1. [quote name='Starnick' timestamp='1350270618' post='4990226'] Two things need to happen: 1. You need an Effect that supports normal mapping. The default BasicEffect in XNA doesn't handle normal or specular maps, just diffuse. [/quote] How can I do just the diffuse then with the BasicEffect? All the tutorials for BasicEffect I've found only use Diffuse as a DiffuseColor Vector. I actually have an image map for it, which I can't find resources on how to use with BasicEffect. Also, if I need an effect other than BasicEffect, where can I find resources for it? I checked out the Normal Mapping example on MSDN, the one with the lizard. Looks mighty complicated.
  2. I'm a beginner in XNA, trying my luck at a basic 3D game. I have some very talented 3D modellers backing me, and while I have on issue importing the .fbx files (the models themselves) into my basic 3D universe in XNA, I have no idea how include the normal maps, diffuse, and specular that they've included with their models. The normal, diffuse and specular are all in .tga image file format, and I don't know how I can add those to the drawing of my model. Right now my code for drawing the 3D object is as follows: [source lang="csharp"] private void DrawObject(Model spaceStation, Matrix world, Matrix view, Matrix projection) { foreach (ModelMesh mesh in spaceStation.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = world; effect.View = view; effect.Projection = projection; } mesh.Draw(); } }[/source]
  3. I have an explosion sprite, with 16 frames. Everytime the player collides with an asteroid, the gamestate is set to loseScreen, and when the loseScreen is the gamestate, the lose() function is continually called until the gamestate changes. Inside the lose() function, this code draws the animated spritesheet, which runs through the 16 frame animation. It should always start from frame 0, but it doesn't always. Sometimes it starts at frame 10, and only runs for 6 frames before finishing. That's the issue. The code inside the lose() function to draw the explosion animation is as follows: [CODE]expFrameID = 0; expFrameID += (int)(time * expFPS) % expFrameCount; Rectangle expRect = new Rectangle(expFrameID * expFrameWidth, 0, 63, 63); spriteBatch.Draw(explosion, shipLocation, expRect, Color.White, 0f, new Vector2(32, 32), 1.0f, pickupSpriteEffects, 0.1f); if (expFrameID == 15) expIsDrawn = true;[/CODE] The time variable is as follows, it gets the total elapsed game time. [CODE]time = (float)gameTime.TotalGameTime.TotalSeconds;[/CODE] I've tried changing TotalGameTime to ElapsedGameTime, nothing changed. It's the following line from the lose() function that I believe is the issue, perhaps: [CODE]expFrameID += (int)(time * expFPS) % expFrameCount;[/CODE] It works, and it animates. However it doesn't always start at frame 0. it starts from random frames between 0 and 16, but it still runs correctly at 16 frames per second. So, how do I get it to always start from frame 0? Would I solve my issue by making a new time variable that starts a timer from 0 only when the lose() function is called? How do I do that?