Changeset 171
- Timestamp:
- 2009-07-24 13:00:53 (13 years ago)
- Location:
- aapo_p/FysiikkaPeli2
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
aapo_p/FysiikkaPeli2/Content/obj/x86/Debug/ContentPipeline.xml
r135 r171 9 9 <Options>None</Options> 10 10 <Output>C:\MyTemp\aapo_p\FysiikkaPeli2\bin\x86\Debug\Content\enemy1.xnb</Output> 11 <Time>2009-07-2 1T14:20:26.637247+03:00</Time>11 <Time>2009-07-24T11:13:59.6487224+03:00</Time> 12 12 </Item> 13 13 <Item> … … 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\aapo_p\FysiikkaPeli2\bin\x86\Debug\Content\tykkitorni1.xnb</Output> 38 <Time>2009-07-2 2T10:50:19.6560523+03:00</Time>38 <Time>2009-07-24T12:31:36.104744+03:00</Time> 39 39 </Item> 40 40 <Item> -
aapo_p/FysiikkaPeli2/Peli.cs
r148 r171 21 21 { 22 22 //keskeneräiset: 23 //neliöistä luodaan rajat, koodi on pohjalla 24 //vaihtoehtoisesti tiilistä tehdään reunat(mieluisa vaihtoehto) 25 //laita oma hahmo kuntoon23 24 25 26 26 //tornit, ja ampuminen kaikille 27 27 //päivien vaihtuminen ja vihollisten määrän kasvaminen ja ulkomuodon muuttuminen 28 28 //mahdollisesti myös pistelaskuri 29 // ota selvää miksi nelön luominen ei onnistu????30 //miksi hahmo1 on ohjaus-aliohjelmissa "null"?????????????????????????????? 29 //keksi ammukset 30 31 31 32 32 … … 34 34 { 35 35 ValueDisplay rahaNaytto; 36 ValueDisplay ElamaNaytto; 37 38 int tykinHinta = 100; 36 39 37 40 PhysicsObject waypoint; … … 39 42 PhysicsObject waypoint3; 40 43 PhysicsObject waypoint4; 44 PhysicsObject waypoint5; 45 PhysicsObject waypoint6; 46 PhysicsObject waypoint7; 47 PhysicsObject maali; 48 49 41 50 PhysicsObject hahmo1; 42 51 … … 45 54 46 55 Meter<int> rahaLaskuri; 56 Meter<int> ElamaLaskuri; 47 57 48 58 ListSelectionWindow menu; … … 63 73 Controls.Listen(Keys.D, ButtonPosition.Down, oikealle, "oikealle", hahmo1); 64 74 Controls.Listen(Keys.B, ButtonPosition.Down, ostovalikko, "osta"); 75 Controls.Listen(Keys.P, ButtonPosition.Down, koordinaatti, "näytä hahmon koordinaatti"); 65 76 ShowMouseCursor(true); 77 } 78 bool koordinaatti(ControlEvent e) 79 { 80 MessageDisplay.Add(hahmo1.X.ToString()); 81 MessageDisplay.Add(hahmo1.Y.ToString()); 82 return false; 66 83 } 67 84 … … 126 143 { 127 144 LuoRahaLaskuri(); 145 LuoElamaLaskuri(); 128 146 129 147 menu = new ListSelectionWindow(this); … … 160 178 { 161 179 rahaNaytto.Visible = true; 180 ElamaNaytto.Visible = true; 162 181 menu.Close(); 163 182 … … 186 205 return false; 187 206 } 207 188 208 void tarkistaampuminen(Timer sender) 189 209 { … … 192 212 foreach (var vihu in viholliset) 193 213 { 194 if ((ase.Position - vihu.Position).Magnitude < 1000)214 if ((ase.Position - vihu.Position).Magnitude < 250) 195 215 { 216 217 ase.Power.Value = 1000; 218 Angle kulma = Angle.Radians((vihu.Position - ase.Position).Angle); 196 219 MessageDisplay.Add("PUM!!"); 220 vihu.TakeDamage(new Damage(20)); 221 ase.Angle = kulma; 222 ase.Owner.Angle = kulma; 223 //ase.Shoot(); // FIXME 224 break; 197 225 } 198 226 } … … 200 228 } 201 229 230 void luoammukset( ProjectileWeapon ase ) 231 { 232 CannonBall ammus = new CannonBall(); 233 ammus.Shape = Shapes.CreateCircle(50); 234 ammus.Damage = new Damage(200); 235 ase.Clip = new Clip(ammus); 236 } 237 202 238 private void LuoViholliset() 203 239 { … … 205 241 waypoint2 = luoWaypoint(Level.Left.ToInt() + 350, 450); 206 242 waypoint3 = luoWaypoint(Level.Right.ToInt() - 350, 450); 207 waypoint4 = luoWaypoint(Level.Right.ToInt() - 500, Level.Bottom.ToInt() + 100); 243 waypoint4 = luoWaypoint(230, -550); 244 waypoint5 = luoWaypoint(490, -510); 245 waypoint6 = luoWaypoint(460, 550); 246 waypoint7 = luoWaypoint(Level.Right.ToInt(), Level.Top.ToInt() - 25); 247 maali = luoMaali(625, 475); 208 248 209 249 int vihollistenMaara = 20; … … 215 255 addenemy(a); 216 256 } 257 } 258 private PhysicsObject luoMaali(int x, int y) 259 { 260 IShape lm = Shapes.CreateRectangle(50.0, 50.0); 261 PhysicsObject luomaali = new PhysicsObject(1, lm); 262 luomaali.IgnoresCollisionResponse = true; 263 luomaali.X = x; 264 luomaali.Y = y; 265 luomaali.Visible = false; 266 Level.Objects.Add(luomaali); 267 return maali; 217 268 } 218 269 … … 236 287 Texture2D joku = Content.Load<Texture2D>("enemy1"); 237 288 vihu.AnimatedTexture = AnimatedTexture.FromTexture2D(joku, 320, false); 289 vihu.AnimatedTexture.FPS = 2; 238 290 Level.Objects.Add(vihu); 239 291 vihu.X = Level.Left - x; … … 246 298 AddCollisionHandler(vihu, TultiinWaypointille); 247 299 300 vihu.HitpointsReachedZero += VihuKuoli; 248 301 viholliset.Add(vihu); 302 } 303 304 305 void VihuKuoli(object sender, EventArgs e) 306 { 307 BattleObject vihu = sender as BattleObject; 308 309 vihu.Visible = false; 310 vihu.Lifetime.IsExpired = true; 311 Level.Objects.Remove(vihu); 312 viholliset.Remove(vihu); 313 MessageDisplay.Add("DEAD"); 314 rahaLaskuri.Value += 10; 315 249 316 } 250 317 … … 289 356 return; 290 357 } 291 /*if (c.Other == waypoint5)358 if (c.Other == waypoint5) 292 359 { 293 360 c.Obj.Velocity = new Vector2D(0, 0); 294 361 Vector2D impulssitaas3 = new Vector2D(0,600); 295 c.Obj.Hit(impulssitaas); 296 return; 297 }*/ 362 c.Obj.Hit(impulssitaas3); 363 return; 364 } 365 if (c.Other == waypoint6) 366 { 367 c.Obj.Velocity = new Vector2D(0, 0); 368 Vector2D impulssitaas4 = new Vector2D(600, 0); 369 c.Obj.Hit(impulssitaas4); 370 return; 371 } 372 373 if (c.Other == waypoint7) 374 { 375 ElamaLaskuri.Value -= 1; 376 377 if (ElamaLaskuri.Value == 0) 378 { 379 MessageDisplay.Add("Game Over"); 380 //aseet.Remove; 381 //viholliset.RemoveAll(); 382 hahmo1.X = Level.Right - 25; 383 hahmo1.Y = 0; 384 } 385 386 } 387 298 388 } 299 389 … … 313 403 PhysicsObject luotorni(int x, int y) 314 404 { 315 if (rahaLaskuri.Value == 0) 405 406 407 if (rahaLaskuri.Value < tykinHinta) 316 408 { 317 409 return null; … … 326 418 tykkitorni.Y = y; 327 419 tykkitorni.IgnoresCollisionResponse = true; 328 rahaLaskuri.Value -= 100;420 rahaLaskuri.Value -= tykinHinta; 329 421 330 422 ProjectileWeapon ase = new ProjectileWeapon(); 331 423 Level.Objects.Add(ase); 332 424 ase.Visible = false; 425 ase.IgnoresCollisionResponse = true; 426 ase.Owner = tykkitorni; 427 luoammukset(ase); 333 428 334 429 Level.Objects.Attach(tykkitorni, new Vector2D(0, 0), ase, new Vector2D(0, 0)); … … 509 604 addtile(Level.Right, Level.Bottom + 1300); 510 605 606 addtile(Level.Right - 100, Level.Bottom); 607 addtile(Level.Right - 100, Level.Bottom + 100); 608 addtile(Level.Right - 100, Level.Bottom + 200); 609 addtile(Level.Right - 100, Level.Bottom + 300); 610 addtile(Level.Right - 100, Level.Bottom + 400); 611 addtile(Level.Right - 100, Level.Bottom + 500); 612 addtile(Level.Right - 100, Level.Bottom + 600); 613 addtile(Level.Right - 100, Level.Bottom + 700); 614 addtile(Level.Right - 100, Level.Bottom + 800); 615 addtile(Level.Right - 100, Level.Bottom + 900); 616 addtile(Level.Right - 100, Level.Bottom + 1100); 617 addtile(Level.Right - 100, Level.Bottom + 1200); 618 addtile(Level.Right - 100, Level.Bottom + 1300); 619 511 620 512 621 … … 523 632 Add(rahaNaytto); 524 633 } 525 526 634 void LuoElamaLaskuri() 635 { 636 ElamaLaskuri = new Meter<int>(3, 0, int.MaxValue); 637 ElamaNaytto = new ValueDisplay(this); 638 ElamaNaytto.BindTo(ElamaLaskuri); 639 ElamaNaytto.X = -340; 640 ElamaNaytto.Y = -490; 641 ElamaNaytto.ValueColor = Color.White; 642 ElamaNaytto.Visible = false; 643 Add(ElamaNaytto); 644 ElamaLaskuri.UpperLimit += new Meter<int>.OnLimitHandler(ElamaLaskuri_UpperLimit); 645 } 646 647 void ElamaLaskuri_UpperLimit(Meter<int> sender) 648 { 649 //Tähän pitää laittaa menun avaus 650 // viholliset pitää pysäyttää ja piilottaa (tai poistaa..?) 651 } 527 652 } 528 653 }
Note: See TracChangeset
for help on using the changeset viewer.