Changeset 6270


Ignore:
Timestamp:
2015-06-24 14:59:48 (8 years ago)
Author:
frmaenpa
Message:
 
Location:
2015/26/FransM/Pixels
Files:
6 added
19 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/FransM/Pixels/Pixels/Pixels/Pixels.cs

    r6238 r6270  
    2020    Image alinkuva = LoadImage("Alin"); 
    2121    Image ruohokuva = LoadImage("Maapalaruoholla"); 
    22  
     22    Image alempikuva = LoadImage("Alempi");  
     23 
     24  
    2325    public override void Begin() 
    2426    { 
     
    2628      
    2729        SmoothTextures = false; 
    28        
    29  
     30         
     31        //Inventory test = new Inventory(); 
     32        //test.AddItem(new PhysicsObject(porakuva), porakuva); 
     33        //Add(test); 
     34 
     35        MediaPlayer.Play("CaveMusicX"); 
     36        MediaPlayer.IsRepeating = true; 
    3037 
    3138        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     
    3441    void LuoKentta() 
    3542    { 
    36         Level.Background.CreateGradient(Color.White, Color.Red); 
     43        Level.Background.Image = taustakuva; 
    3744 
    3845        ColorTileMap ruudut = ColorTileMap.FromLevelAsset("Maa"); 
     
    4451        ruudut.SetTileMethod(Color.FromHexCode("0026FF"), LuoTaso5); 
    4552        ruudut.SetTileMethod(Color.FromHexCode("00FF21"), LuoTaso6); 
    46  
    47  
     53        ruudut.SetTileMethod(Color.FromHexCode("FF6A00"), LuoTaso7); 
     54       // ruudut.SetTileMethod(Color.FromHexCode("7F3300"), LuoTaso8); 
     55 
     56         
    4857        ruudut.Execute(60, 60); 
    49  
    50         //Camera.ZoomToLevel(); 
     58        Level.Background.FitToLevel(); 
     59 
    5160        IsMouseVisible = true; 
    5261        Camera.StayInLevel = true; 
     
    6271        }, ""); 
    6372        IsFullScreen = true; 
    64     } 
    65  
     73 
     74 
     75    } 
     76    void EsineValitsin(Vector paikka) 
     77    { 
     78        int arpa = RandomGen.NextInt(0, 100); 
     79        if (arpa <= 50) 
     80        { 
     81            EsineLuoja(paikka, "Pora"); 
     82        } 
     83        else 
     84        { 
     85 
     86        } 
     87    } 
     88    void EsineLuoja(Vector paikka, String tag) 
     89    { 
     90        GameObject esine = new GameObject(LoadImage(tag)); 
     91        esine.Position = paikka; 
     92        Add(esine, 1); 
     93    } 
    6694 
    6795    void LuoTaso(Vector paikka, double leveys, double korkeus) 
     
    82110        taso2.CollisionIgnoreGroup = 1; 
    83111        Add(taso2); 
     112        if (RandomGen.NextInt(0, 100) < 20) 
     113        { 
     114            EsineValitsin(paikka); 
     115        } 
    84116    } 
    85117 
     
    112144 
    113145    void LuoTaso6(Vector paikka, double leveys, double korkeus) 
     146 
    114147    { 
    115148        PhysicsObject taso6 = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     
    119152        Add(taso6); 
    120153    } 
     154 
     155    void LuoTaso7(Vector paikka, double leveys, double korkeus) 
     156    { 
     157        PhysicsObject taso7 = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     158        taso7.Position = paikka; 
     159        taso7.Image = alempikuva; 
     160        taso7.CollisionIgnoreGroup = 1; 
     161        Add(taso7); 
     162    } 
    121163} 
     164 
     165 
     166/// <summary> 
     167/// Esinevalikko. 
     168/// </summary> 
     169class Inventory : Widget 
     170{ 
     171    /// <summary> 
     172    /// Tapahtuma, kun esine on valittu. 
     173    /// </summary> 
     174    public event Action<PhysicsObject> ItemSelected; 
     175 
     176    /// <summary> 
     177    /// Luo uuden esinevalikon. 
     178    /// </summary> 
     179    public Inventory() 
     180        : base(new HorizontalLayout()) 
     181    { 
     182    } 
     183 
     184    /// <summary> 
     185    /// Lisää esineen. 
     186    /// </summary> 
     187    /// <param name="item">Lisättävä esine.</param> 
     188    /// <param name="kuva">Esineen ikoni, joka näkyy valikossa.</param> 
     189    public void AddItem(PhysicsObject item, Image kuva) 
     190    { 
     191        PushButton icon = new PushButton(kuva); 
     192        Add(icon); 
     193        icon.Clicked += delegate() { SelectItem(item); }; 
     194    } 
     195 
     196    void SelectItem(PhysicsObject item) 
     197    { 
     198        if (ItemSelected != null) 
     199        { 
     200            ItemSelected(item); 
     201        } 
     202    } 
     203} 
  • 2015/26/FransM/Pixels/Pixels/Pixels/Pixels.csproj.Debug.cachefile

    r6238 r6270  
    1111Content\seinÀ.xnb 
    1212Content\Alin.xnb 
     13Content\Alempi.xnb 
     14Content\CaveMusicX.xnb 
     15Content\Kivi3.xnb 
     16Content\CaveMusicX.wma 
  • 2015/26/FransM/Pixels/Pixels/Pixels/obj/x86/Debug/ContentPipeline-{23DE9823-17E1-4AFC-BB04-6AA018C329F7}.xml

    r6238 r6270  
    99      <Options>None</Options> 
    1010      <Output>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Taustakuva.xnb</Output> 
    11       <Time>2015-06-23T10:23:30.7718957+03:00</Time> 
     11      <Time>2015-06-24T14:12:49.0725085+03:00</Time> 
    1212    </Item> 
    1313    <Item> 
     
    1818      <Options>None</Options> 
    1919      <Output>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Maa.xnb</Output> 
    20       <Time>2015-06-24T11:35:35.9293975+03:00</Time> 
     20      <Time>2015-06-24T14:27:19.3271527+03:00</Time> 
    2121    </Item> 
    2222    <Item> 
     
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\TNT.xnb</Output> 
    38       <Time>2015-06-23T12:37:17.1763957+03:00</Time> 
     38      <Time>2015-06-24T14:07:10.6245085+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    108108      <Options>None</Options> 
    109109      <Output>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Alin.xnb</Output> 
    110       <Time>2015-06-24T11:59:56.4430975+03:00</Time> 
     110      <Time>2015-06-24T14:25:49.5664991+03:00</Time> 
     111    </Item> 
     112    <Item> 
     113      <Source>Alempi.png</Source> 
     114      <Name>Alempi</Name> 
     115      <Importer>TextureImporter</Importer> 
     116      <Processor>TextureProcessor</Processor> 
     117      <Options>None</Options> 
     118      <Output>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Alempi.xnb</Output> 
     119      <Time>2015-06-24T14:18:05.9683085+03:00</Time> 
     120    </Item> 
     121    <Item> 
     122      <Source>CaveMusicX.mp3</Source> 
     123      <Name>CaveMusicX</Name> 
     124      <Importer>Mp3Importer</Importer> 
     125      <Processor>SongProcessor</Processor> 
     126      <Options>None</Options> 
     127      <Output>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\CaveMusicX.xnb</Output> 
     128      <Extra>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\CaveMusicX.wma</Extra> 
     129      <Time>2015-06-24T11:58:24.4691975+03:00</Time> 
     130    </Item> 
     131    <Item> 
     132      <Source>Kivi3.png</Source> 
     133      <Name>Kivi3</Name> 
     134      <Importer>TextureImporter</Importer> 
     135      <Processor>TextureProcessor</Processor> 
     136      <Options>None</Options> 
     137      <Output>C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Kivi3.xnb</Output> 
     138      <Time>2015-06-24T14:29:42.0358536+03:00</Time> 
    111139    </Item> 
    112140    <BuildSuccessful>true</BuildSuccessful> 
  • 2015/26/FransM/Pixels/Pixels/Pixels/obj/x86/Debug/Pixels.csproj.FileListAbsolute.txt

    r6238 r6270  
    1919C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\seinÀ.xnb 
    2020C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Alin.xnb 
     21C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Alempi.xnb 
     22C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\CaveMusicX.xnb 
     23C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\CaveMusicX.wma 
     24C:\MyTemp\FransM\Pixels\Pixels\Pixels\bin\x86\Debug\Content\Kivi3.xnb 
  • 2015/26/FransM/Pixels/Pixels/Pixels/obj/x86/Debug/cachefile-{23DE9823-17E1-4AFC-BB04-6AA018C329F7}-targetpath.txt

    r6238 r6270  
    1111Content\seinÀ.xnb 
    1212Content\Alin.xnb 
     13Content\Alempi.xnb 
     14Content\CaveMusicX.xnb 
     15Content\CaveMusicX.wma 
     16Content\Kivi3.xnb 
  • 2015/26/FransM/Pixels/Pixels/PixelsContent/PixelsContent.contentproj

    r6238 r6270  
    129129    </Compile> 
    130130  </ItemGroup> 
     131  <ItemGroup> 
     132    <Compile Include="Alempi.png"> 
     133      <Name>Alempi</Name> 
     134      <Importer>TextureImporter</Importer> 
     135      <Processor>TextureProcessor</Processor> 
     136    </Compile> 
     137  </ItemGroup> 
     138  <ItemGroup> 
     139    <Compile Include="CaveMusicX.mp3"> 
     140      <Name>CaveMusicX</Name> 
     141      <Importer>Mp3Importer</Importer> 
     142      <Processor>SongProcessor</Processor> 
     143    </Compile> 
     144  </ItemGroup> 
     145  <ItemGroup> 
     146    <Compile Include="Kivi3.png"> 
     147      <Name>Kivi3</Name> 
     148      <Importer>TextureImporter</Importer> 
     149      <Processor>TextureProcessor</Processor> 
     150    </Compile> 
     151  </ItemGroup> 
    131152  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    132153  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
Note: See TracChangeset for help on using the changeset viewer.