Changeset 5605


Ignore:
Timestamp:
2014-07-23 17:40:30 (5 years ago)
Author:
mijoilmo
Message:

lisätty tähdet sekä parempi zoomi

Location:
2014/30/MikkoI/WindowsGame1
Files:
8 added
1 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/Camera/Camera.cs

    r5603 r5605  
    2020        public Matrix getMatrix(Vector2 gridSize, Vector2 mapSize, Vector2 screenSize) 
    2121        { 
    22             //viewPortBounds(); 
     22            viewPortBounds(); 
    2323 
    2424            Vector3 pixelMapSize = new Vector3((gridSize.X * mapSize.X / 2), (gridSize.Y * mapSize.Y / 2), 0); 
     
    3434 
    3535            //if (yaw < -70) { yaw = -70; } else if (yaw > 70) { yaw = 70; }//rajoita pyörittämistä (-70 - 70) 
    36             if (pitch < -88) { pitch = -88; } else if (pitch > -45) { pitch = -45; }//rajoittaa ylös-alas-liikettä 
    37             if (zoomFactor < 0.2f) { zoomFactor = 0.2f; } else if (zoomFactor > 3f) { zoomFactor = 3f; }//rajoittaa zoomia 
     36            if (pitch < -82) { pitch = -82; } else if (pitch > -45) { pitch = -45; }//rajoittaa ylös-alas-liikettä 
     37            if (zoomFactor < 0.1f) { zoomFactor = 0.1f; } else if (zoomFactor > 3f) { zoomFactor = 3f; }//rajoittaa zoomia 
    3838        } 
    3939    } 
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/Game1.cs

    r5603 r5605  
    7979            /*LOAD ALL TEXTURES*/ 
    8080            textures.Add("testitile", Content.Load<Texture2D>("Graphics/Test/taso5.1")); 
    81             textures.Add("testipuu", Content.Load<Texture2D>("Graphics/Test/kuusi")); 
    82             textures.Add("aurinko", Content.Load<Texture2D>("Graphics/Taivas/Aurinko")); 
     81 
     82            //KÄYTETTÄVÄT PUUT 
     83            textures.Add("puut/kuusi", Content.Load<Texture2D>("Graphics/Puut/kuusi")); 
     84            textures.Add("puut/mänty", Content.Load<Texture2D>("Graphics/Puut/mänty")); 
     85            textures.Add("puut/ohut", Content.Load<Texture2D>("Graphics/Puut/ohut")); 
     86            textures.Add("puut/kuollut", Content.Load<Texture2D>("Graphics/Puut/kuollut")); 
     87 
     88            //TAIVAS 
     89            textures.Add("taivas/aurinko", Content.Load<Texture2D>("Graphics/Taivas/Aurinko")); 
     90            textures.Add("taivas/tähdet", Content.Load<Texture2D>("Graphics/Taivas/Tähdet")); 
    8391 
    8492            effect = new BasicEffect(GraphicsDevice); 
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/Map/Map.cs

    r5582 r5605  
    2828            this.texture = texture;//DEBUG 
    2929 
    30             this.Tiles = new Tile[w,h]; 
     30            this.Tiles = new Tile[w, h]; 
    3131 
    3232            texture.GetData(colorMap); 
     
    3535        void buildMap() 
    3636        { 
    37             for (var x = 0; x < Size.X; x++) { 
    38                 for (var y = 0; y < Size.Y; y++) { 
    39                     Tiles[x,y] = new Tile("testitile");//jotain shittiä myöhemmin 
    40                     if (Pikseli.Instance.random.NextDouble()<0.1) 
    41                     Objects.Add(new MapObject("testipuu", x, y)); 
     37            for (var x = 0; x < Size.X; x++) 
     38            { 
     39                for (var y = 0; y < Size.Y; y++) 
     40                { 
     41                    Tiles[x, y] = new Tile("testitile");//jotain shittiä myöhemmin 
     42                    if (Pikseli.Instance.random.NextDouble() > 0.1) { continue; } 
     43 
     44                    string textureId = ""; 
     45                    switch ((int)Math.Floor((double)(Pikseli.Instance.random.NextDouble() * 4))) 
     46                    { 
     47                        case 0: 
     48                            textureId = "puut/kuollut"; 
     49                            break; 
     50                        case 1: 
     51                            textureId = "puut/kuusi"; 
     52                            break; 
     53                        case 2: 
     54                            textureId = "puut/mänty"; 
     55                            break; 
     56                        case 3: 
     57                            textureId = "puut/ohut"; 
     58                            break; 
     59                    } 
     60                    Objects.Add(new MapObject(textureId, x, y)); 
    4261                } 
    4362            } 
    44              
    45              
     63 
     64 
    4665        } 
    4766    } 
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/Render/MapRenderer.cs

    r5603 r5605  
    2222            this.map = map; 
    2323            this.screenSize = screenSize; 
    24             baseSunPosition = new Vector3(map.Size.X/2, map.Size.Y/2, 160); 
     24            baseSunPosition = new Vector3(map.Size.X / 2, map.Size.Y / 2, 40); 
    2525        } 
    2626        void renderGroundTile(Texture2D texture, int x, int y) 
     
    3535        } 
    3636 
     37        void renderDistantSprite(Texture2D texture, Vector3 position, Vector2 size, Matrix matrix) 
     38        {//Renderöi kaukaisia juttuja kuten auringon ja tähdet 
     39            Vector3 calcPosition = Vector3.Transform(position * 64.0f, matrix); 
     40            spriteBatch.Draw(texture, new Rectangle((int)(calcPosition.X), (int)(calcPosition.Y), (int)size.X, (int)size.Y), null, Color.White, 0f, new Vector2(texture.Width / 2, texture.Height / 2), SpriteEffects.None, 1f); 
     41        } 
     42        void renderBackground(Texture2D texture, Vector2 size) 
     43        { 
     44            spriteBatch.Draw(texture, new Rectangle(0, 0, (int)size.X, (int)size.Y), Color.White); 
     45        } 
     46 
    3747        public void RenderMap(Camera camera) 
    3848        {//renderöi koko mapin, kutsu ulkopuolelta 
    3949            Matrix matrix = camera.getMatrix(new Vector2(64, 64), map.Size, screenSize);//mapin tilen koko 64x64 
    4050 
    41             sunAngle += 1/3000.0f;//auringon pyörimisnopeus 
     51            sunAngle += 1 / 3000.0f;//auringon pyörimisnopeus 
    4252 
    43             Vector3 sunPosition = baseSunPosition + new Vector3((float)Math.Sin(sunAngle), (float)Math.Cos(sunAngle), 0) * 400; 
     53            Vector3 sunPosition = baseSunPosition + new Vector3((float)Math.Sin(sunAngle), (float)Math.Cos(sunAngle), 0) * 100; 
    4454 
    4555            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend); 
    4656            Vector3 fixedSun = sunPosition; 
    4757            fixedSun.Z *= -1.0f; 
    48             fixedSun.Z += 162;//alaspäin että näkyy pelissä 
    49             Vector3 sun = Vector3.Transform(fixedSun * 64.0f, matrix); 
    50             Texture2D sunTexture = Pikseli.Instance.textures["aurinko"]; 
    51             spriteBatch.Draw(sunTexture, new Rectangle((int)(sun.X), (int)(sun.Y), sunTexture.Width, (int)(sunTexture.Height)), null, new Color(1f, 1f, 0f, 1f), 0f, new Vector2(sunTexture.Width / 2, sunTexture.Height / 2), SpriteEffects.None, 0f); 
     58            fixedSun.Z += 22;//alaspäin että näkyy pelissä 
     59 
     60            Texture2D sunTexture = Pikseli.Instance.textures["taivas/aurinko"]; 
     61            Texture2D starBackground = Pikseli.Instance.textures["taivas/tähdet"]; 
     62 
     63            renderDistantSprite(sunTexture, fixedSun, new Vector2(sunTexture.Width * camera.zoomFactor * 5, sunTexture.Height * camera.zoomFactor * 5), matrix); 
     64            renderBackground(starBackground, new Vector2(starBackground.Width, starBackground.Height)); 
     65 
    5266            spriteBatch.End(); 
    5367 
     
    7791 
    7892                double dot = Vector3.Dot(Vector3.UnitZ, suunta); 
    79                 double testi = 1.0 / dot; 
    80                 double shadowHeight = (28000.0 / sunPosition.Z); 
    8193 
    82                 spriteBatch.Draw(texture, new Rectangle((int)((obj.position.X + 0.5) * 64), (int)((obj.position.Y + 0.5) * 64), texture.Width, (int)(testi * texture.Height - texture.Height)), null, new Color(0f, 0f, 0f, 0.5f), shadowAngle, new Vector2(texture.Width / 2, texture.Height), SpriteEffects.None, 0.5f); 
     94                spriteBatch.Draw(texture, new Rectangle((int)((obj.position.X + 0.5) * 64), (int)((obj.position.Y + 0.5) * 64), texture.Width, (int)((1.0 / dot) * texture.Height - texture.Height)), null, new Color(0f, 0f, 0f, 0.5f), shadowAngle, new Vector2(texture.Width / 2, texture.Height), SpriteEffects.None, 0.5f); 
    8395                //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); 
    8496            } 
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/WindowsGame1.csproj.Debug.cachefile

    r5603 r5605  
    22Content\Graphics\Test\Kuusi.xnb 
    33Content\Graphics\Taivas\Aurinko.xnb 
     4Content\Graphics\Puut\Kuollut.xnb 
     5Content\Graphics\Puut\Kuusi.xnb 
     6Content\Graphics\Puut\MÀnty.xnb 
     7Content\Graphics\Puut\Ohut.xnb 
     8Content\Graphics\Taivas\TÀhdet.xnb 
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/obj/x86/Debug/WindowsGame1.csproj.FileListAbsolute.txt

    r5603 r5605  
    88C:\MyTemp\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Test\Kuusi.xnb 
    99C:\MyTemp\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Taivas\Aurinko.xnb 
     10D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Test\taso5.1.xnb 
     11D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Test\Kuusi.xnb 
     12D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Taivas\Aurinko.xnb 
     13D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\WindowsGame1.exe 
     14D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\WindowsGame1.pdb 
     15D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\obj\x86\Debug\WindowsGame1.csprojResolveAssemblyReference.cache 
     16D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt 
     17D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\obj\x86\Debug\WindowsGame1.exe 
     18D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\obj\x86\Debug\WindowsGame1.pdb 
     19D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Puut\Kuollut.xnb 
     20D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Puut\Kuusi.xnb 
     21D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Puut\MÀnty.xnb 
     22D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Puut\Ohut.xnb 
     23D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1\bin\x86\Debug\Content\Graphics\Taivas\TÀhdet.xnb 
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/obj/x86/Debug/cachefile-{97A5BC4F-C40A-4D52-BF03-8923DFD60CA0}-targetpath.txt

    r5603 r5605  
    22Content\Graphics\Test\Kuusi.xnb 
    33Content\Graphics\Taivas\Aurinko.xnb 
     4Content\Graphics\Puut\Kuollut.xnb 
     5Content\Graphics\Puut\Kuusi.xnb 
     6Content\Graphics\Puut\MÀnty.xnb 
     7Content\Graphics\Puut\Ohut.xnb 
     8Content\Graphics\Taivas\TÀhdet.xnb 
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1Content/WindowsGame1Content.contentproj

    r5603 r5605  
    5151    </Compile> 
    5252  </ItemGroup> 
     53  <ItemGroup> 
     54    <Compile Include="Graphics\Puut\Kuollut.png"> 
     55      <Name>Kuollut</Name> 
     56      <Importer>TextureImporter</Importer> 
     57      <Processor>TextureProcessor</Processor> 
     58    </Compile> 
     59    <Compile Include="Graphics\Puut\Kuusi.png"> 
     60      <Name>Kuusi</Name> 
     61      <Importer>TextureImporter</Importer> 
     62      <Processor>TextureProcessor</Processor> 
     63    </Compile> 
     64    <Compile Include="Graphics\Puut\Mänty.png"> 
     65      <Name>Mänty</Name> 
     66      <Importer>TextureImporter</Importer> 
     67      <Processor>TextureProcessor</Processor> 
     68    </Compile> 
     69    <Compile Include="Graphics\Puut\Ohut.png"> 
     70      <Name>Ohut</Name> 
     71      <Importer>TextureImporter</Importer> 
     72      <Processor>TextureProcessor</Processor> 
     73    </Compile> 
     74  </ItemGroup> 
     75  <ItemGroup> 
     76    <Compile Include="Graphics\Taivas\Tähdet.png"> 
     77      <Name>Tähdet</Name> 
     78      <Importer>TextureImporter</Importer> 
     79      <Processor>TextureProcessor</Processor> 
     80    </Compile> 
     81  </ItemGroup> 
    5382  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    5483  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1Content/obj/x86/Debug/WindowsGame1Content.contentproj.FileListAbsolute.txt

    r5558 r5605  
    11C:\MyTemp\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1Content\obj\x86\Debug\WindowsGame1Content.contentprojResolveAssemblyReference.cache 
     2D:\Csharp feat jypeli\MikkoI\WindowsGame1\WindowsGame1\WindowsGame1Content\obj\x86\Debug\WindowsGame1Content.contentprojResolveAssemblyReference.cache 
Note: See TracChangeset for help on using the changeset viewer.