Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 CamSpot)
- {
- background.Draw(spriteBatch, CamSpot);
- //Draw the sun
- spriteBatch.Draw(tex_Sun, Vector2.Zero, null,
- Color.White, 0, new Vector2(tex_Sun.Width / 2, tex_Sun.Height / 2), 2, SpriteEffects.None, 0.92f);
- // Draw all of the planets in the system
- for (int i = 0; i < planetList.Count; i++)
- {
- p = planetList[i];
- if(Vector2.Distance(CamSpot, ConvertUnits.ToDisplayUnits(p.body.Position)) < spriteBatch.GraphicsDevice.Viewport.Width + 400)
- {
- spriteBatch.Draw(p.baseTexture, ConvertUnits.ToDisplayUnits(p.pos), null,
- Color.White, 0, new Vector2(p.baseTexture.Width / 2, p.baseTexture.Height / 2), p.scale, SpriteEffects.None, 0.9f);
- spriteBatch.Draw(p.shadowTexture, ConvertUnits.ToDisplayUnits(p.pos), null,
- Color.White, p.angle, new Vector2(p.shadowTexture.Width / 2, p.shadowTexture.Height / 2), p.scale, SpriteEffects.None, 0.89f);
- }
- for (int n = 0; n < p.moonList.Count; n++)
- {
- m = p.moonList[n];
- if (Vector2.Distance(CamSpot, ConvertUnits.ToDisplayUnits(m.body.Position)) < spriteBatch.GraphicsDevice.Viewport.Width + 400)
- {
- spriteBatch.Draw(m.baseTexture, ConvertUnits.ToDisplayUnits(m.pos), null,
- Color.White, 0, new Vector2(m.baseTexture.Width / 2, m.baseTexture.Height / 2), m.scale, SpriteEffects.None, 0.9f);
- if (m.moon == true) // If you're not a port, draw me a shadow!
- spriteBatch.Draw(m.shadowTexture, ConvertUnits.ToDisplayUnits(m.pos), null,
- Color.White, p.angle, new Vector2(m.shadowTexture.Width / 2, m.shadowTexture.Height / 2), m.scale, SpriteEffects.None, 0.89f);
- p.moonList[n] = m;
- }
- }
- for(int v = 0; v < borderList.Count(); v++)
- if (Vector2.Distance(CamSpot, ConvertUnits.ToDisplayUnits(borderList[v])) < spriteBatch.GraphicsDevice.Viewport.Width + 400)
- {
- if (v + 1 < borderList.Count())
- {
- 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);
- spriteBatch.Draw(tex_EdgeOfSystem, ConvertUnits.ToDisplayUnits(borderList[v]), null,
- Color.White, angle, new Vector2(tex_EdgeOfSystem.Width / 2, tex_EdgeOfSystem.Height), 1, SpriteEffects.None, 0.9f);
- }
- }
- planetList[i] = p;
- }
Advertisement
Add Comment
Please, Sign In to add comment