Changeset 1238 for 2010/27


Ignore:
Timestamp:
2010-07-09 13:07:46 (13 years ago)
Author:
vekakart
Message:

Valmistin pelin loppuun asti

Location:
2010/27/Vekakart/Catch The Rainbow/Catch The Rainbow
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2010/27/Vekakart/Catch The Rainbow/Catch The Rainbow/Content/Content.contentproj

    r1217 r1238  
    6262    </Compile> 
    6363  </ItemGroup> 
     64  <ItemGroup> 
     65    <Compile Include="Chandler1.png"> 
     66      <Name>Chandler1</Name> 
     67      <Importer>TextureImporter</Importer> 
     68      <Processor>TextureProcessor</Processor> 
     69    </Compile> 
     70  </ItemGroup> 
     71  <ItemGroup> 
     72    <Compile Include="Chandler2.png"> 
     73      <Name>Chandler2</Name> 
     74      <Importer>TextureImporter</Importer> 
     75      <Processor>TextureProcessor</Processor> 
     76    </Compile> 
     77  </ItemGroup> 
     78  <ItemGroup> 
     79    <Compile Include="Oh yesh.wav"> 
     80      <Name>Oh yesh</Name> 
     81      <Importer>WavImporter</Importer> 
     82      <Processor>SoundEffectProcessor</Processor> 
     83    </Compile> 
     84  </ItemGroup> 
     85  <ItemGroup> 
     86    <Compile Include="Wanna c a rainbow.wav"> 
     87      <Name>Wanna c a rainbow</Name> 
     88      <Importer>WavImporter</Importer> 
     89      <Processor>SoundEffectProcessor</Processor> 
     90    </Compile> 
     91  </ItemGroup> 
    6492</Project> 
  • 2010/27/Vekakart/Catch The Rainbow/Catch The Rainbow/Peli.cs

    r1217 r1238  
    1717    PlatformCharacter Max; 
    1818 
     19    SoundEffect OhYes; 
     20    SoundEffect WCAR; 
     21 
     22    int Rainbowlaskuri = 5; 
     23 
    1924    protected override void Begin() 
    2025    { 
    2126        ClearAll(); 
     27        OhYes = LoadSoundEffect("Oh yesh"); 
     28        WCAR = LoadSoundEffect("Wanna c a rainbow"); 
    2229        //LuoMax(); 
    2330        AsetaOhjaimet(); 
     
    5057        PhysicsObject Rainbow = PhysicsObject.CreateStaticObject(25, 25); 
    5158        Rainbow.Image = Image.FromFile("Rainbow.png"); 
     59        AddCollisionHandler(Rainbow, KasitteleRainbowTormays); 
    5260        return Rainbow; 
    5361    } 
     
    150158    PhysicsObject LuoChandler() 
    151159    { 
    152         Chandler = new PhysicsObject(20, 45); 
    153         //Chandler.Image = LoadImage ("Chandler1") 
     160        Chandler = PhysicsObject.CreateStaticObject(20, 45); 
     161        Chandler.Image = LoadImage ("Chandler1"); 
     162        Image[] chandlerinani = LoadImages("Chandler1", "Chandler2"); 
     163        Chandler.Animation = new Animation(chandlerinani); 
     164        Chandler.Animation.FPS = 2; 
     165        Chandler.Animation.Start(); 
     166 
     167        Timer ajastin = new Timer(); 
     168        ajastin.Tag = Chandler; 
     169        ajastin.Interval = 2.0; 
     170        ajastin.Trigger += Aani; 
     171        Add(ajastin); 
     172        ajastin.Start(); 
    154173        return Chandler; 
    155174    } 
     
    179198        voiheittaa = true; 
    180199    } 
     200    void KasitteleRainbowTormays(PhysicsObject Rainbow, PhysicsObject kohde) 
     201    { 
     202        if (kohde.Tag.ToString() == "Max") 
     203        { 
     204            Remove(Rainbow); 
     205            Rainbowlaskuri--; 
     206 
     207            OhYes.Play(); 
     208            if (Rainbowlaskuri == 0) 
     209            { 
     210                Begin(); 
     211            } 
     212        } 
     213 
     214    } 
     215    void Aani(Timer sender) 
     216    { 
     217            PhysicsObject bing = (PhysicsObject)sender.Tag; 
     218        double etaisyys = bing.X - Max.X; 
     219        if (etaisyys < 0) 
     220        { 
     221            etaisyys = etaisyys * -1; 
     222        } 
     223        if (etaisyys < 200) 
     224        { 
     225            WCAR.Play(); 
     226        } 
     227    } 
    181228} 
Note: See TracChangeset for help on using the changeset viewer.