Changeset 679 for 2010/23/Kavaisan/Tasohyppely1/Peli.cs
- Timestamp:
- 2010-06-10 14:42:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/Kavaisan/Tasohyppely1/Peli.cs
r655 r679 26 26 { 27 27 kenttaNro = 1; 28 Level.Width = 2000; 29 Level.Height = 1000; 30 28 29 // Zoomataan lähemmäksi 30 Camera.ZoomFactor = 2.0; 31 32 Camera.StayInLevel = true; 33 34 seuraavaKentta(); 35 MessageDisplay.Add("Etsi iso tähti!"); 36 } 37 38 void seuraavaKentta() 39 { 40 ClearAll(); 41 42 lisaaPisteLaskuri(); 43 44 // Asetetaan painovoima 45 Gravity = new Vector(0, -1000); 46 47 luoKentta(); 48 kenttaNro++; 49 if (kenttaNro > 2) kenttaNro = 1; 50 51 lisaaNappaimet(); 52 Camera.Follow(pelaaja1); 53 } 54 55 void lisaaPisteLaskuri() 56 { 31 57 // Luodaan pistelaskuri 32 58 pisteLaskuri = new IntMeter(0); … … 35 61 pisteNaytto = new ValueDisplay(); 36 62 pisteNaytto.Text = "Pisteitä: "; 37 pisteNaytto.X = Screen.RightSafe - 250;38 pisteNaytto.Y = Screen.TopSafe - 50;63 pisteNaytto.X = Screen.RightSafe - 150; 64 pisteNaytto.Y = Screen.TopSafe - 20; 39 65 pisteNaytto.BindTo(pisteLaskuri); 40 66 Add(pisteNaytto); // lisätään peliin 41 67 42 // Zoomataan lähemmäksi 43 Camera.ZoomFactor = 2.0; 44 45 Camera.StayInLevel = true; 46 47 seuraavaKentta(); 48 MessageDisplay.Add("Etsi iso tähti!"); 49 } 50 51 void seuraavaKentta() 52 { 53 ClearAll(); 54 pisteLaskuri.Reset(); 55 56 // Asetetaan painovoima 57 Gravity = new Vector(0, -1000); 58 59 luoKentta(); 60 kenttaNro++; 61 if (kenttaNro > 2) kenttaNro = 1; 62 63 lisaaNappaimet(); 64 Camera.Follow(pelaaja1); 68 65 69 } 66 70 67 71 void luoKentta() 68 72 { 73 Level.Width = 2000; 74 Level.Height = 1000; 69 75 Level.CreateBorders(); 70 76 Level.Background.CreateGradient(Color.White, Color.SkyBlue); … … 121 127 122 128 AddCollisionHandler(pelaaja1, osuiKenttaOlioon); 123 129 124 130 Add(pelaaja1); 125 131 } … … 160 166 { 161 167 hahmo.Walk(nopeus); 168 pisteLaskuri.Value = (int)((pelaaja1.Y + (Level.Height / 2)) / ruudunKorkeus); 162 169 } 163 170 … … 165 172 { 166 173 hahmo.Jump(voima); 174 pisteLaskuri.Value = (int)((pelaaja1.Y +(Level.Height/2)) / ruudunKorkeus); 167 175 } 168 176 … … 173 181 this.PlaySound("maali"); 174 182 int edellisenKentanPisteet = pisteLaskuri.Value; 175 kenttaNro = +1;183 kenttaNro += 1; 176 184 177 185 seuraavaKentta(); … … 181 189 if (otherObject.Tag.ToString() == "tuuppaaja") 182 190 { 183 MessageDisplay.Add("Tormattiin tuuppaajaan");184 191 collidingObject.Hit(new Vector(0, -10000)); 185 Explosion e = new Explosion(100 );192 Explosion e = new Explosion(1000); 186 193 e.Position = otherObject.Position; 187 194 Add(e);
Note: See TracChangeset
for help on using the changeset viewer.