Changeset 870 for 2010/24/Vilvaini/Smile Jump
- Timestamp:
- 2010-06-15 15:00:33 (12 years ago)
- Location:
- 2010/24/Vilvaini/Smile Jump
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/Vilvaini/Smile Jump/Content/Content.contentproj
r867 r870 61 61 </Compile> 62 62 </ItemGroup> 63 <ItemGroup> 64 <Compile Include="smile jump%28Gun%29.png"> 65 <Name>smile jump%28Gun%29</Name> 66 <Importer>TextureImporter</Importer> 67 <Processor>TextureProcessor</Processor> 68 </Compile> 69 </ItemGroup> 63 70 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 64 71 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/24/Vilvaini/Smile Jump/Peli.cs
r867 r870 7 7 class Tasohyppely : PhysicsGame 8 8 { 9 const double nopeus = 200; 9 const double nopeus = 300; 10 const double tasokorkeus = 0; 10 11 const double hyppyVoima = 4000; 12 13 Timer aikaLaskuri; // laskee aikaa 11 14 12 15 IntMeter pisteLaskuri; … … 18 21 int kenttaNro; // monesko kenttä on menossa 19 22 23 private void aikaLoppui(Timer sender) 24 { 25 // täydennä: mitä tapahtuu, kun aika loppui 26 lisaaTaso(RandomGen.NextInt(-150, 100), Level.Bottom + 150); 27 const double tasokorkeus = tasokorkeus + 200; 28 aikaLaskuri.Reset(); // nollataan aikalaskuri oletusarvoonsa, joka oli 0. 29 } 20 30 21 31 protected override void Begin() … … 24 34 kenttaNro = 0; 25 35 Level.Width = 1024; 26 Level.Height = 1000;36 Level.Height = 5000; 27 37 28 38 // Luodaan pistelaskuri … … 43 53 44 54 seuraavaKentta(); 45 MessageDisplay.Add("Etsi iso tähti!"); 55 MessageDisplay.Add("Pompi pidemmälle kuin toinen pelaaja!"); 56 57 aikaLaskuri = new Timer(); // luodaan uusi ajastin, nimeltä aikaLaskuri 58 aikaLaskuri.Interval = 0.1; // ajastukseksi 5 sekuntia 59 aikaLaskuri.Trigger += new Timer.TriggerHandler(aikaLoppui); // // asetetaan tapahtuma, kun aikaLaskuri kun 5 sekuntia on kulunut. 60 Add(aikaLaskuri); // lisätään aikaLaskuri peliin 61 aikaLaskuri.Start(); // käynnistetään aikaLaskuri 46 62 } 47 63 … … 55 71 56 72 // Asetetaan painovoima 57 Gravity = new Vector(0, - 1000);73 Gravity = new Vector(0, -600); 58 74 59 75 luoKentta(); … … 65 81 { 66 82 Level.CreateBorders(1, true); // Miksei reunat näy? 67 Level.Background.CreateGradient(Color. White, Color.SkyBlue);83 Level.Background.CreateGradient(Color.Beige, Color.Wheat); 68 84 69 lisaaTaso(-200, -350); 70 lisaaTaso(0, -100); 85 lisaaTaso(RandomGen.NextInt(-150, 100), Level.Bottom + 150); 86 lisaaTaso(RandomGen.NextInt(-50, 200), Level.Bottom + 300); 87 lisaaTaso(RandomGen.NextInt(-100, 350), Level.Bottom + 450); 88 lisaaTaso(RandomGen.NextInt(-250, 400), Level.Bottom + 600); 89 lisaaTaso(RandomGen.NextInt(-450, 500), Level.Bottom + 750); 90 lisaaTaso(RandomGen.NextInt(-550, 400), Level.Bottom + 900); 91 lisaaTaso(RandomGen.NextInt(-350, 600), Level.Bottom + 1050); 71 92 72 93 lisaaMaali(); … … 76 97 void lisaaTaso(double x, double y) 77 98 { 78 PhysicsObject taso = PhysicsObject.CreateStaticObject(1 00, 30);99 PhysicsObject taso = PhysicsObject.CreateStaticObject(150, 30); 79 100 taso.Color = Color.Green; 80 101 taso.X = x; … … 91 112 pelaaja1.Y = Level.Bottom + 120; 92 113 93 AddCollisionHandler(pelaaja1, osuiMaaliin);94 95 114 pelaaja2 = new PlatformCharacter(40, 40); 96 115 pelaaja2.Mass = 4.0; … … 98 117 pelaaja2.X = 50; 99 118 pelaaja2.Y = Level.Bottom + 120; 100 101 AddCollisionHandler(pelaaja2, osuiMaaliin);102 119 103 120 Add(pelaaja1); … … 151 168 } 152 169 153 void osuiMaaliin(PhysicsObject collidingObject, PhysicsObject otherObject)154 {155 if (otherObject.Tag.ToString() == "maali")156 {157 this.PlaySound("maali");158 int edellisenKentanPisteet = pisteLaskuri.Value;159 seuraavaKentta();160 MessageDisplay.Add("Pääsit läpi kentän " + kenttaNro + ". Pisteitä: " + edellisenKentanPisteet);161 }162 }163 170 164 171 protected override void Update(Time time)
Note: See TracChangeset
for help on using the changeset viewer.