- Timestamp:
- 2012-07-27 12:34:08 (11 years ago)
- 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 14 14 15 15 Image taustaKuva = LoadImage("rata"); 16 16 17 Vector autonPaikka = new Vector(-50, -1300); 18 Vector auton2Paikka = new Vector(-50, 1100); 17 19 18 20 Automobile auto; … … 24 26 LuoKenttä(); 25 27 26 28 MediaPlayer.Play("power-juice"); 29 MediaPlayer.IsRepeating= true; 27 30 28 31 Level.CreateBorders(1, true); … … 64 67 Automobile LuoAuto(double x, double y) //ask about free shipping! 65 68 { 69 70 66 71 67 72 … … 76 81 auto.AngularDamping = 0.01; 77 82 auto.LinearDamping = 0.992; 83 auto.IgnoresExplosions=true; 78 84 Add(auto); 85 79 86 return auto; 80 87 … … 99 106 PhysicsObject aidat = PhysicsObject.CreateStaticObject(leveys, korkeus); 100 107 aidat.Position = paikka; 101 aidat.Color = Color. OrangeRed;108 aidat.Color = Color.Brown; 102 109 // aidat.Image = 103 110 Add(aidat); … … 119 126 } 120 127 128 //olen homo t. paska 129 121 130 void autonSuunta(PhysicsObject auto) 122 131 { … … 131 140 void AutoHajoaa(PhysicsObject auto, PhysicsObject auto2) 132 141 { 133 if (auto.Velocity.Magnitude > 100 )142 if (auto.Velocity.Magnitude > 100 && auto.Velocity.Magnitude > auto2.Velocity.Magnitude) 134 143 { 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 136 164 } 137 165 } 166 //if (Automobile.IsDestroyed()) 167 //{ 168 // LuoAuto(); 169 //} 170 // } 138 171 139 172 void Auto2Hajoaa(PhysicsObject auto2, PhysicsObject auto) 140 173 { 141 if (auto2.Velocity.Magnitude > 100 )174 if (auto2.Velocity.Magnitude > 100 && auto2.Velocity.Magnitude > auto.Velocity.Magnitude) 142 175 { 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 }); 144 194 } 145 195 } 146 196 147 197 198 199 148 200 149 201 -
2012/30/TuomasW/Mortal Rally/Mortal Rally/Mortal RallyContent/Mortal RallyContent.contentproj
r3774 r3815 86 86 </Compile> 87 87 </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> 88 102 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 89 103 <!-- 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.