- Timestamp:
- 2011-06-09 11:22:52 (10 years ago)
- Location:
- 2011/23/iltakuop/Blocks/Blocks
- Files:
-
- 3 added
- 3 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/23/iltakuop/Blocks/Blocks/Blocks/Peli.cs
r1799 r1807 35 35 PhysicsObject tnt; 36 36 PhysicsObject elämä; 37 PhysicsObject Power1; 38 PhysicsObject Power2; 37 39 38 40 PhysicsObject alaReuna; … … 54 56 Image taustaKuva3 = LoadImage("Taustakuva3"); 55 57 Image mailanKuva = LoadImage("Maila"); 58 Image elämänKuva = LoadImage("elämä"); 59 Image Power2Kuva = LoadImage("Power2"); 60 Image Power1Kuva = LoadImage("Power1"); 56 61 int pisteet; 57 62 int elämät = 3; … … 444 449 void AnnaPowerUp(PhysicsObject kohde) 445 450 { 446 int elämäPower = RandomGen.NextInt(0, 20); 447 if (elämäPower == 0) 451 int Power = RandomGen.NextInt(0, 100); 452 //int mailaPower1 = RandomGen.NextInt(0, 20); 453 //int mailaPower2 = RandomGen.NextInt(0, 20); 454 if (Power < 5) 448 455 { 449 456 PudotaElämä(kohde); 457 } 458 else if ((Power > 4)&&(Power < 10)) 459 { 460 PudotaPower1(kohde); 461 } 462 else if ((Power > 9) && (Power < 15)) 463 { 464 PudotaPower2(kohde); 450 465 } 451 466 } … … 457 472 elämä.Tag = "elämä"; 458 473 elämä.Position = kohde.Position; 459 elämä. Shape = Shape.Circle;474 elämä.Image = elämänKuva; 460 475 Vector impulssi = new Vector(0, -100); 461 476 Add(elämä); 462 477 elämä.Hit(impulssi); 463 478 } 479 480 void PudotaPower1(PhysicsObject kohde) 481 { 482 Power1 = new PhysicsObject(10, 10); 483 Power1.IgnoresCollisionResponse = true; 484 Power1.Tag = "Power1"; 485 Power1.Position = kohde.Position; 486 Power1.Image = Power1Kuva; 487 Vector impulssi = new Vector(0, -100); 488 Add(Power1); 489 Power1.Hit(impulssi); 490 } 491 492 493 void PudotaPower2(PhysicsObject kohde) 494 { 495 Power2 = new PhysicsObject(10, 10); 496 Power2.IgnoresCollisionResponse = true; 497 Power2.Tag = "Power2"; 498 Power2.Position = kohde.Position; 499 Power2.Image = Power2Kuva; 500 Vector impulssi = new Vector(0, -100); 501 Add(Power2); 502 Power2.Hit(impulssi); 503 } 504 464 505 void TarkistaVoitto() 465 506 { … … 662 703 maila.Restitution = 0.5; 663 704 maila.Color = Color.Green; 705 AddCollisionHandler(maila, KäsitteleMailanTörmäys); 664 706 return maila; 665 707 } … … 722 764 } 723 765 766 void KäsitteleMailanTörmäys(PhysicsObject maila, PhysicsObject kohde) 767 { 768 if (kohde.Tag.ToString() == "elämä") 769 { 770 AnnaElämä(); 771 kohde.Destroy(); 772 } 773 else if (kohde.Tag.ToString() == "Power1") 774 { 775 maila.Width += 30; 776 kohde.Destroy(); 777 } 778 else if (kohde.Tag.ToString() == "Power2") 779 { 780 kohde.Destroy(); 781 maila.Width -= 20; 782 } 783 } 784 724 785 void AsetaNopeus(PhysicsObject maila, Vector nopeus) 725 786 { -
2011/23/iltakuop/Blocks/Blocks/BlocksContent/BlocksContent.contentproj
r1797 r1807 141 141 </Compile> 142 142 </ItemGroup> 143 <ItemGroup> 144 <Compile Include="elämä.png"> 145 <Name>elämä</Name> 146 <Importer>TextureImporter</Importer> 147 <Processor>TextureProcessor</Processor> 148 </Compile> 149 </ItemGroup> 150 <ItemGroup> 151 <Compile Include="Power1.png"> 152 <Name>Power1</Name> 153 <Importer>TextureImporter</Importer> 154 <Processor>TextureProcessor</Processor> 155 </Compile> 156 </ItemGroup> 157 <ItemGroup> 158 <Compile Include="Power2.png"> 159 <Name>Power2</Name> 160 <Importer>TextureImporter</Importer> 161 <Processor>TextureProcessor</Processor> 162 </Compile> 163 </ItemGroup> 143 164 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 144 165 <!-- 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.