- Timestamp:
- 2013-07-25 10:51:06 (10 years ago)
- Location:
- 2013/30/VilleF/Lentokone/Lentokone
- Files:
-
- 4 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/30/VilleF/Lentokone/Lentokone/Lentokone/Lentokone.cs
r4650 r4651 28 28 IntMeter KomboLaskuri; 29 29 30 30 31 31 public override void Begin() 32 32 { … … 35 35 tekstikentta.Y = Screen.Top - 10; 36 36 Add(tekstikentta); 37 LuoPistelaskuri(); 37 LuoPistelaskuri(); 38 38 miesa = LoadAnimation("blingbling"); 39 39 juusto = LoadAnimation("ukkeli"); … … 54 54 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 55 55 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 56 Keyboard.Listen(Key.Left, ButtonState.Down, 57 HidastaPelaajaa, null); 58 Keyboard.Listen(Key.Right, ButtonState.Down, 59 LiikutaPelaajaa, null, 1); 60 Keyboard.Listen(Key.Up, ButtonState.Down, 61 KaannaPelaajaa, null, 1.0); 62 Keyboard.Listen(Key.Up, ButtonState.Released, 63 KaannaPelaajaa, null, 0.0); 64 Keyboard.Listen(Key.Down, ButtonState.Down, 65 KaannaPelaajaa, null, -1.0); 66 Keyboard.Listen(Key.Down, ButtonState.Released, 67 KaannaPelaajaa, null, 0.0); 56 Keyboard.Listen(Key.Left, ButtonState.Down, HidastaPelaajaa, null); 57 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, 1); 58 Keyboard.Listen(Key.Up, ButtonState.Down, KaannaPelaajaa, null, 3.0); 59 Keyboard.Listen(Key.Up, ButtonState.Released, KaannaPelaajaa, null, 0.0); 60 Keyboard.Listen(Key.Down, ButtonState.Down, KaannaPelaajaa, null, -3.0); 61 Keyboard.Listen(Key.Down, ButtonState.Released, KaannaPelaajaa, null, 0.0); 68 62 Keyboard.Listen(Key.Space, ButtonState.Released, TiputaPommi, "Ammu"); 69 63 Keyboard.Listen(Key.R, ButtonState.Released, LuoPelaaja, "Ammu"); … … 89 83 90 84 Label komboNaytto = new Label(); 91 komboNaytto.X = Screen.Right - 200;92 komboNaytto.Y = Screen.Top - 200;85 komboNaytto.X = Screen.Right - 200; 86 komboNaytto.Y = Screen.Top - 200; 93 87 komboNaytto.TextColor = Color.Green; 94 88 //pisteNaytto.Color = Color.White; … … 110 104 void Kombot() 111 105 { 112 if (KomboLaskuri.Value == 3) { Label tekstikentta = new Label("kombo"); 113 Add(tekstikentta); 114 // PommiOsuu(100); 106 if (KomboLaskuri.Value == 3) 107 { 108 Label tekstikentta = new Label("kombo"); 109 Add(tekstikentta); 110 // PommiOsuu(100); 115 111 116 112 } … … 160 156 } 161 157 } 162 163 void TiputaPommi() 164 158 159 void TiputaPommi() 165 160 { 166 161 … … 169 164 pommi.Image = pommik; 170 165 pommi.Position = pelaaja.Position; 171 166 172 167 pommi.CollisionIgnoreGroup = pelaaja.CollisionIgnoreGroup; 173 168 174 169 175 170 Add(pommi); 176 171 177 172 AddCollisionHandler(pommi, PommiOsuu); 178 173 } 179 180 181 182 183 184 if(kohde.Tag.Equals("vihollinen"))185 186 187 188 189 190 191 192 193 194 195 Explosion e = new Explosion(6000);196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 {214 215 174 175 void PommiOsuu(PhysicsObject pommi, PhysicsObject kohde) 176 { 177 //Int k = 0; 178 179 if (kohde.Tag.Equals("vihollinen")) 180 { 181 kohde.Destroy(); 182 pisteLaskuri.Value += 1; 183 KomboLaskuri.Value += 1; 184 komboLaskurinAjastin.Reset(); 185 186 } 187 if (KomboLaskuri > 3) 188 { 189 190 Explosion e = new Explosion(600); 191 e.Position = pommi.Position; 192 pommi.Destroy(); 193 Add(e); 194 e.ShockwaveReachesObject += delegate(IPhysicsObject rKohde, Vector v) { if (rKohde.Tag.Equals("vihollinen")) rKohde.Destroy(); }; 195 } 196 else 197 { 198 Explosion e = new Explosion(60); 199 e.Position = pommi.Position; 200 pommi.Destroy(); 201 Add(e); 202 e.ShockwaveReachesObject += delegate(IPhysicsObject rKohde, Vector v) { if (rKohde.Tag.Equals("vihollinen")) rKohde.Destroy(); }; 203 //pisteet++;} 204 } 205 206 } 207 void Rajahdys() 208 { 209 210 } 216 211 217 212 void KaannaPelaajaa(double kaannos) 218 213 { 219 214 pelaaja.AngularVelocity = kaannos; 220 221 222 } 215 } 223 216 224 217 … … 237 230 { 238 231 pelaaja.Velocity = new Vector(pelaaja.Velocity.X * 0.95, pelaaja.Velocity.Y); 239 232 240 233 } 241 234 242 235 void PelaajaTormasi(PhysicsObject tormaaja, PhysicsObject kohde) 243 236 { 244 237 245 238 } 246 239 void LiikutaPelaajaa(int suunta) 247 240 { 248 pelaaja.Push(Vector.FromLengthAndAngle(3000 *suunta, pelaaja.Angle));249 } 250 251 241 pelaaja.Push(Vector.FromLengthAndAngle(3000 * suunta, pelaaja.Angle)); 242 } 243 244 252 245 void LuoKentta() 253 246 { … … 270 263 271 264 272 273 274 265 266 267 275 268 void LuoPelaaja() 276 269 { … … 285 278 pelaaja.Animation.FPS = 3; 286 279 Add(pelaaja); 287 AddCollisionHandler(pelaaja, CollisionHandler.ExplodeObject(200, true));288 AddCollisionHandler(pelaaja,"vihollinen", CollisionHandler.ExplodeTarget(50, true));280 AddCollisionHandler(pelaaja, CollisionHandler.ExplodeObject(200, true)); 281 AddCollisionHandler(pelaaja, "vihollinen", CollisionHandler.ExplodeTarget(50, true)); 289 282 pelaaja.MaxVelocity = 600; 290 Timer ajastin = new Timer();291 ajastin.Interval = 0.1;292 ajastin.Timeout += KaannaKohtiMaata;293 ajastin.Start();294 pisteLaskuri.Value = -10;283 Timer ajastin = new Timer(); 284 ajastin.Interval = 0.1; 285 ajastin.Timeout += KaannaKohtiMaata; 286 ajastin.Start(); 287 pisteLaskuri.Value = -10; 295 288 } 296 289 297 290 void KaannaKohtiMaata() 298 291 { 299 if ((pelaaja.Angle.Degrees > 70) && (pelaaja.Angle.Degrees < 110))292 if ((pelaaja.Angle.Degrees > 70) && (pelaaja.Angle.Degrees < 110)) 300 293 return; 301 294 if ((pelaaja.Angle.Degrees >= 110) || (pelaaja.Angle.Degrees <= -90)) … … 305 298 } 306 299 307 300 308 301 }
Note: See TracChangeset
for help on using the changeset viewer.