Changeset 1261 for 2010/27


Ignore:
Timestamp:
2010-07-22 11:51:03 (13 years ago)
Author:
anlakane
Message:

Nappulan sammumisbugi korjattu, ikkunaa pienenntty, lisätty anti-realistinen animaatio nappulan syttymiseen.

Location:
2010/27/anlakane/Nopeuspeli
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2010/27/anlakane/Nopeuspeli/Content/Content.contentproj

    r1212 r1261  
    9090    </Compile> 
    9191  </ItemGroup> 
     92  <ItemGroup> 
     93    <Compile Include="00.png"> 
     94      <Name>00</Name> 
     95      <Importer>TextureImporter</Importer> 
     96      <Processor>TextureProcessor</Processor> 
     97    </Compile> 
     98  </ItemGroup> 
     99  <ItemGroup> 
     100    <Compile Include="11.png"> 
     101      <Name>11</Name> 
     102      <Importer>TextureImporter</Importer> 
     103      <Processor>TextureProcessor</Processor> 
     104    </Compile> 
     105    <Compile Include="22.png"> 
     106      <Name>22</Name> 
     107      <Importer>TextureImporter</Importer> 
     108      <Processor>TextureProcessor</Processor> 
     109    </Compile> 
     110    <Compile Include="33.png"> 
     111      <Name>33</Name> 
     112      <Importer>TextureImporter</Importer> 
     113      <Processor>TextureProcessor</Processor> 
     114    </Compile> 
     115  </ItemGroup> 
    92116</Project> 
  • 2010/27/anlakane/Nopeuspeli/Ohjelma.cs

    r1207 r1261  
    77        using (Peli game = new Peli()) 
    88        { 
    9 #if !DEBUG 
    10             game.IsFullScreen = true; 
    11 #endif 
    129            game.Run(); 
    1310        } 
  • 2010/27/anlakane/Nopeuspeli/Peli.cs

    r1212 r1261  
    99    List<GameObject> painikkeet; 
    1010    List<GameObject> painamattomat; 
    11     const double painikkeenLeveys = 100; 
     11 
     12    Animation painike0animaatio; 
     13    Animation painike1animaatio; 
     14    Animation painike2animaatio; 
     15    Animation painike3animaatio; 
     16 
     17    const double painikkeenLeveys = 200; 
    1218    const double painikkeenKorkeus = painikkeenLeveys; 
    1319    Timer painikkeidenSytytin; 
     
    2026    int montakoPainikettaPainettu; 
    2127 
     28    bool peliPaattynyt; 
     29 
    2230    Sound piip; 
    2331 
     
    2836        painikkeidenMaara = 4; 
    2937 
     38        SetWindowSize(600, 400, false); 
    3039        Level.Background.Image = LoadImage("tausta"); 
    3140        Level.Background.Size = new Vector(Screen.Width, Screen.Height); 
     
    7786    void LisaaPainikkeet() 
    7887    { 
     88        Image[] painike0kuvat = LoadImages("0", "00"); 
     89        Image[] painike1kuvat = LoadImages("1", "11"); 
     90        Image[] painike2kuvat = LoadImages("2", "22"); 
     91        Image[] painike3kuvat = LoadImages("3", "33"); 
     92        painike0animaatio = new Animation(painike0kuvat); 
     93        painike1animaatio = new Animation(painike1kuvat); 
     94        painike2animaatio = new Animation(painike2kuvat); 
     95        painike3animaatio = new Animation(painike3kuvat); 
     96        painike0animaatio.FPS = 15; 
     97        painike1animaatio.FPS = 15; 
     98        painike2animaatio.FPS = 15; 
     99        painike3animaatio.FPS = 15; 
     100 
    79101        for (int i = 0; i < painikkeidenMaara; i++) 
    80102        { 
     
    99121        painike.Tag = painikkeet.Count.ToString(); 
    100122        painike.Image = LoadImage((painikkeet.Count - 1).ToString() + "_"); 
     123 
    101124        return painike; 
    102125    } 
     
    131154    void PeliPaattyy(Timer t) 
    132155    { 
     156        peliPaattynyt = true; 
    133157        painikkeidenSytytin.Stop(); 
    134158        nopeutusAjastin.Stop(); 
     
    142166    void AloitaPeli() 
    143167    { 
     168        peliPaattynyt = false; 
    144169        for (int i = 0; i < painikkeet.Count; i++) 
    145170        { 
     
    161186    void SytytaJokinPainike(Timer t) 
    162187    { 
    163         int sytytettavanIndeksi = RandomGen.NextInt(0, painikkeet.Count - 1); 
     188        int sytytettavanIndeksi = RandomGen.NextInt(0, painikkeet.Count - 1); // Arvotaan sytytettävä nappula 
    164189        Sytyta(sytytettavanIndeksi); 
    165190        painamattomat.Add(painikkeet[sytytettavanIndeksi]); 
     
    168193        switch (sytytettavanIndeksi) 
    169194        { 
    170             case 0 : 
     195            case 0: 
    171196                piip.Pitch = -1; 
    172197                break; 
     
    180205                piip.Pitch = -0.15; 
    181206                break; 
    182  
    183         } 
    184          
     207        } 
     208 
    185209        piip.Play(); 
    186210    } 
     
    188212    void Sytyta(int i) 
    189213    { 
    190         painikkeet[i].Image = LoadImage(i.ToString());         
     214        switch (i) 
     215        { 
     216            case 0: 
     217                painikkeet[i].Animation = painike0animaatio; 
     218                break; 
     219            case 1: 
     220                painikkeet[i].Animation = painike1animaatio; 
     221                break; 
     222            case 2: 
     223                painikkeet[i].Animation = painike2animaatio; 
     224                break; 
     225            case 3: 
     226                painikkeet[i].Animation = painike3animaatio; 
     227                break; 
     228        } 
     229        painikkeet[i].Animation.Start(); 
    191230    } 
    192231 
     
    198237    void Sammuta(int i) 
    199238    { 
    200         painikkeet[i].Image = LoadImage(i.ToString() + "_");         
    201     } 
    202  
    203  
     239        if (!peliPaattynyt) // Ei sammuteta nappulaa jos peli on päättynyt. 
     240        {  
     241            painikkeet[i].Animation.Stop(); 
     242            painikkeet[i].Image = LoadImage(i.ToString() + "_"); 
     243        } 
     244    } 
    204245} 
Note: See TracChangeset for help on using the changeset viewer.