Ignore:
Timestamp:
2014-07-23 12:57:36 (5 years ago)
Author:
mijoilmo
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/Render/MapRenderer.cs

    r5581 r5582  
    1414        Map map; 
    1515        Vector2 screenSize; 
    16         Vector3 sunPosition = new Vector3(0,0,15); 
     16        Vector3 sunPosition = new Vector3(0, 0, 15); 
    1717 
    1818        public MapRenderer(SpriteBatch spriteBatch, Map map, Vector2 screenSize) 
     
    4747            //varjot testi 
    4848 
    49             sunPosition = new Vector3((float)Pikseli.Instance.gameTime.TotalGameTime.TotalSeconds, (float)Pikseli.Instance.gameTime.TotalGameTime.TotalSeconds, 0); 
     49            sunPosition = new Vector3(-20 + (float)Pikseli.Instance.gameTime.TotalGameTime.TotalSeconds + 1.42f, -20 + (float)Pikseli.Instance.gameTime.TotalGameTime.TotalSeconds, 0); 
    5050 
    5151            foreach (MapObject obj in map.Objects) 
     
    5757 
    5858 
    59                 float shadowAngle = (float)(Math.Atan2(erotus.Y, erotus.X) - Math.PI/2); 
     59                float shadowAngle = (float)(Math.Atan2(erotus.Y, erotus.X) - Math.PI / 2); 
    6060                double shadowOffsetX = Math.Cos(shadowAngle + Math.PI / 2) * 5, 
    6161                    shadowOffsetY = Math.Sin(shadowAngle + Math.PI / 2) * 5; 
    62  
    63                 spriteBatch.Draw(texture, new Rectangle((int)((obj.position.X + 0.5) * 64 + shadowOffsetX), (int)((obj.position.Y + 0.5) * 64 + shadowOffsetY), texture.Width, texture.Height), null, new Color(0f,0f,0f,0.3f), shadowAngle, new Vector2(texture.Width / 2, texture.Height), SpriteEffects.None, 0f); 
     62                     
     63                spriteBatch.Draw(texture, new Rectangle((int)((obj.position.X + 0.5) * 64), (int)((obj.position.Y + 0.5) * 64), texture.Width, texture.Height), null, new Color(0f, 0f, 0f, 0.5f), shadowAngle, new Vector2(texture.Width / 2, texture.Height), SpriteEffects.None, 0f); 
    6464                //spriteBatch.Draw(obj.texture, new Rectangle((int)(obj.position.X + 0.5) * 64, (int)(obj.position.Y + 0.5) * 64, (int)obj.texture.Width, (int)obj.texture.Height), null, Color.Gray, MathHelper.ToRadians(30), new Vector2(obj.texture.Width / 2, obj.texture.Height), SpriteEffects.None, 0f); 
    6565            } 
Note: See TracChangeset for help on using the changeset viewer.