Changeset 3815 for 2012/30


Ignore:
Timestamp:
2012-07-27 12:34:08 (11 years ago)
Author:
juiitamm
Message:

Talletus.

Location:
2012/30/TuomasW/Mortal Rally/Mortal Rally
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2012/30/TuomasW/Mortal Rally/Mortal Rally/Mortal Rally/Mortal_Rally.cs

    r3774 r3815  
    1414 
    1515    Image taustaKuva = LoadImage("rata"); 
    16                                                                              
     16 
     17    Vector autonPaikka = new Vector(-50, -1300); 
     18    Vector auton2Paikka = new Vector(-50, 1100); 
    1719 
    1820    Automobile auto; 
     
    2426        LuoKenttä(); 
    2527 
    26          
     28        MediaPlayer.Play("power-juice"); 
     29        MediaPlayer.IsRepeating= true; 
    2730 
    2831        Level.CreateBorders(1, true); 
     
    6467    Automobile LuoAuto(double x, double y) //ask about free shipping! 
    6568    { 
     69 
     70 
    6671 
    6772 
     
    7681       auto.AngularDamping = 0.01; 
    7782       auto.LinearDamping = 0.992; 
     83        auto.IgnoresExplosions=true; 
    7884       Add(auto); 
     85 
    7986       return auto; 
    8087 
     
    99106         PhysicsObject aidat = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    100107         aidat.Position = paikka; 
    101          aidat.Color = Color.OrangeRed; 
     108         aidat.Color = Color.Brown; 
    102109         // aidat.Image =  
    103110         Add(aidat); 
     
    119126    } 
    120127 
     128    //olen homo t. paska 
     129 
    121130    void autonSuunta(PhysicsObject auto) 
    122131    { 
     
    131140    void AutoHajoaa(PhysicsObject auto, PhysicsObject auto2) 
    132141    { 
    133         if (auto.Velocity.Magnitude > 100)  
     142        if (auto.Velocity.Magnitude > 100 && auto.Velocity.Magnitude > auto2.Velocity.Magnitude) 
    134143        { 
    135             auto2.Destroy(); 
     144 
     145            Remove(auto2); 
     146             
     147            Explosion rajahdys = new Explosion(500); 
     148            rajahdys.Position = auto2.Position; 
     149            Add(rajahdys); 
     150 
     151 
     152            //auto2.Destroy(); 
     153//            AddCollisionHandler(auto, auto2, CollisionHandler.ExplodeTarget(500, false)); 
     154            AddCollisionHandler(auto, auto2, CollisionHandler.PlaySound("boom")); 
     155            //LuoAuto(-50, 1100); 
     156 
     157            Timer.SingleShot(0.5, delegate 
     158            { 
     159                auto2.Stop(); 
     160                auto2.Position = auton2Paikka; 
     161                Add(auto2); 
     162            }); 
     163 
    136164        } 
    137165    } 
     166        //if (Automobile.IsDestroyed()) 
     167        //{ 
     168          //  LuoAuto(); 
     169        //} 
     170   // } 
    138171 
    139172    void Auto2Hajoaa(PhysicsObject auto2, PhysicsObject auto) 
    140173    { 
    141         if (auto2.Velocity.Magnitude > 100) 
     174        if (auto2.Velocity.Magnitude > 100 && auto2.Velocity.Magnitude > auto.Velocity.Magnitude) 
    142175        { 
    143             auto.Destroy(); 
     176 
     177            Remove(auto); 
     178 
     179            Explosion rajahdys = new Explosion(500); 
     180            rajahdys.Position = auto2.Position; 
     181            Add(rajahdys); 
     182 
     183 
     184            //auto.Destroy(); 
     185            //AddCollisionHandler(auto2, auto, CollisionHandler.ExplodeTarget(500, true)); 
     186            AddCollisionHandler(auto2, auto, CollisionHandler.PlaySound("boom")); 
     187 
     188            Timer.SingleShot(1, delegate 
     189            { 
     190                auto.Stop(); 
     191                auto.Position = autonPaikka; 
     192                Add(auto); 
     193            }); 
    144194        } 
    145195    } 
    146196 
    147197 
     198     
     199     
    148200 
    149201    
  • 2012/30/TuomasW/Mortal Rally/Mortal Rally/Mortal RallyContent/Mortal RallyContent.contentproj

    r3774 r3815  
    8686    </Compile> 
    8787  </ItemGroup> 
     88  <ItemGroup> 
     89    <Compile Include="boom.wav"> 
     90      <Name>boom</Name> 
     91      <Importer>WavImporter</Importer> 
     92      <Processor>SoundEffectProcessor</Processor> 
     93    </Compile> 
     94  </ItemGroup> 
     95  <ItemGroup> 
     96    <Compile Include="power-juice.mp3"> 
     97      <Name>power-juice</Name> 
     98      <Importer>Mp3Importer</Importer> 
     99      <Processor>SongProcessor</Processor> 
     100    </Compile> 
     101  </ItemGroup> 
    88102  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    89103  <!--  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.