Guest User

Untitled

a guest
Feb 11th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.98 KB | None | 0 0
  1.         public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 CamSpot)
  2.         {
  3.             background.Draw(spriteBatch, CamSpot);
  4.             //Draw the sun
  5.             spriteBatch.Draw(tex_Sun, Vector2.Zero, null,
  6.                 Color.White, 0, new Vector2(tex_Sun.Width / 2, tex_Sun.Height / 2), 2, SpriteEffects.None, 0.92f);
  7.  
  8.             // Draw all of the planets in the system
  9.             for (int i = 0; i < planetList.Count; i++)
  10.             {
  11.                 p = planetList[i];
  12.                 if(Vector2.Distance(CamSpot, ConvertUnits.ToDisplayUnits(p.body.Position)) < spriteBatch.GraphicsDevice.Viewport.Width + 400)
  13.                 {
  14.                     spriteBatch.Draw(p.baseTexture, ConvertUnits.ToDisplayUnits(p.pos), null,
  15.                         Color.White, 0, new Vector2(p.baseTexture.Width / 2, p.baseTexture.Height / 2), p.scale, SpriteEffects.None, 0.9f);
  16.                     spriteBatch.Draw(p.shadowTexture, ConvertUnits.ToDisplayUnits(p.pos), null,
  17.                         Color.White, p.angle, new Vector2(p.shadowTexture.Width / 2, p.shadowTexture.Height / 2), p.scale, SpriteEffects.None, 0.89f);
  18.                 }
  19.  
  20.                 for (int n = 0; n < p.moonList.Count; n++)
  21.                 {
  22.                     m = p.moonList[n];
  23.                     if (Vector2.Distance(CamSpot, ConvertUnits.ToDisplayUnits(m.body.Position)) < spriteBatch.GraphicsDevice.Viewport.Width + 400)
  24.                     {
  25.                         spriteBatch.Draw(m.baseTexture, ConvertUnits.ToDisplayUnits(m.pos), null,
  26.                             Color.White, 0, new Vector2(m.baseTexture.Width / 2, m.baseTexture.Height / 2), m.scale, SpriteEffects.None, 0.9f);
  27.  
  28.                         if (m.moon == true) // If you're not a port, draw me a shadow!
  29.                             spriteBatch.Draw(m.shadowTexture, ConvertUnits.ToDisplayUnits(m.pos), null,
  30.                                 Color.White, p.angle, new Vector2(m.shadowTexture.Width / 2, m.shadowTexture.Height / 2), m.scale, SpriteEffects.None, 0.89f);
  31.                         p.moonList[n] = m;
  32.                     }
  33.                 }
  34.  
  35.                 for(int v = 0; v < borderList.Count(); v++)
  36.                     if (Vector2.Distance(CamSpot, ConvertUnits.ToDisplayUnits(borderList[v])) < spriteBatch.GraphicsDevice.Viewport.Width + 400)
  37.                     {
  38.                         if (v + 1 < borderList.Count())
  39.                         {
  40.                             float angle = MathHelper.ToRadians((float)System.Math.Atan2(borderList[v + 1].Y - borderList[v].Y, borderList[v + 1].X - borderList[v].X) * (float)(180 / System.Math.PI) + 90);
  41.                             spriteBatch.Draw(tex_EdgeOfSystem, ConvertUnits.ToDisplayUnits(borderList[v]), null,
  42.                                 Color.White, angle, new Vector2(tex_EdgeOfSystem.Width / 2, tex_EdgeOfSystem.Height), 1, SpriteEffects.None, 0.9f);
  43.                         }
  44.                     }
  45.  
  46.                 planetList[i] = p;
  47.             }
Advertisement
Add Comment
Please, Sign In to add comment