- Timestamp:
- 2010-07-09 13:07:46 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/27/Vekakart/Catch The Rainbow/Catch The Rainbow/Peli.cs
r1217 r1238 17 17 PlatformCharacter Max; 18 18 19 SoundEffect OhYes; 20 SoundEffect WCAR; 21 22 int Rainbowlaskuri = 5; 23 19 24 protected override void Begin() 20 25 { 21 26 ClearAll(); 27 OhYes = LoadSoundEffect("Oh yesh"); 28 WCAR = LoadSoundEffect("Wanna c a rainbow"); 22 29 //LuoMax(); 23 30 AsetaOhjaimet(); … … 50 57 PhysicsObject Rainbow = PhysicsObject.CreateStaticObject(25, 25); 51 58 Rainbow.Image = Image.FromFile("Rainbow.png"); 59 AddCollisionHandler(Rainbow, KasitteleRainbowTormays); 52 60 return Rainbow; 53 61 } … … 150 158 PhysicsObject LuoChandler() 151 159 { 152 Chandler = new PhysicsObject(20, 45); 153 //Chandler.Image = LoadImage ("Chandler1") 160 Chandler = PhysicsObject.CreateStaticObject(20, 45); 161 Chandler.Image = LoadImage ("Chandler1"); 162 Image[] chandlerinani = LoadImages("Chandler1", "Chandler2"); 163 Chandler.Animation = new Animation(chandlerinani); 164 Chandler.Animation.FPS = 2; 165 Chandler.Animation.Start(); 166 167 Timer ajastin = new Timer(); 168 ajastin.Tag = Chandler; 169 ajastin.Interval = 2.0; 170 ajastin.Trigger += Aani; 171 Add(ajastin); 172 ajastin.Start(); 154 173 return Chandler; 155 174 } … … 179 198 voiheittaa = true; 180 199 } 200 void KasitteleRainbowTormays(PhysicsObject Rainbow, PhysicsObject kohde) 201 { 202 if (kohde.Tag.ToString() == "Max") 203 { 204 Remove(Rainbow); 205 Rainbowlaskuri--; 206 207 OhYes.Play(); 208 if (Rainbowlaskuri == 0) 209 { 210 Begin(); 211 } 212 } 213 214 } 215 void Aani(Timer sender) 216 { 217 PhysicsObject bing = (PhysicsObject)sender.Tag; 218 double etaisyys = bing.X - Max.X; 219 if (etaisyys < 0) 220 { 221 etaisyys = etaisyys * -1; 222 } 223 if (etaisyys < 200) 224 { 225 WCAR.Play(); 226 } 227 } 181 228 }
Note: See TracChangeset
for help on using the changeset viewer.