Changeset 2567
- Timestamp:
- 2011-08-05 09:10:27 (11 years ago)
- Location:
- 2011/31/EsaN/DevOid
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/31/EsaN/DevOid/DevOid/DevOid/DevOid.csproj.Debug.cachefile
r2543 r2567 10 10 Content\hiirip.xnb 11 11 Content\hiiris.xnb 12 Content\punaisenvalintak.xnb 13 Content\sinisenvalintak.xnb -
2011/31/EsaN/DevOid/DevOid/DevOid/Peli.cs
r2543 r2567 9 9 public class Peli : PhysicsGame 10 10 { 11 PhysicsObject alus; 12 13 GameObject punaisenvalinta; 14 GameObject sinisenvalinta; 15 16 PhysicsObject bbase; 17 PhysicsObject rbase; 18 PhysicsObject pbase; 19 PhysicsObject pbase2; 20 PhysicsObject pbase3; 21 PhysicsObject pbase4; 22 11 23 Widget hiiris; 12 24 Widget hiirip; 25 13 26 Label maara1; 14 27 Label maara2; … … 17 30 Label maara5; 18 31 Label maara6; 32 19 33 int aluksia1; 20 34 int aluksia2; … … 24 38 int aluksia6; 25 39 40 double perusnopeus1; 41 double perusnopeus2; 42 double perusnopeus3; 43 double perusnopeus4; 44 double perusnopeus5; 45 double perusnopeus6; 46 47 List<GameObject> baset = new List<GameObject>(); 48 49 List<Label> maarat = new List<Label>(); 50 26 51 27 52 public override void Begin() … … 34 59 35 60 LuoMeri(); 61 62 36 63 LuoSaari2(700, 700, -385, 200, -45); 37 64 LuoSaari1(700, 700, -100, -250, 0); … … 39 66 LuoSaari3(700, 700, 287, 250, 0); 40 67 LuoSaari4(700, 700, 200, -100, 0); 41 LuoBBase(50, 50, 200, -150, 0, 1); 42 LuoRBase(50, 50, -200, 200, 0, 2); 43 LuoPBase(30, 30, 200, 100, 0, 3); 44 LuoPBase(50, 50, -100, -250, 0, 4); 45 LuoPBase(40, 40, 425, 200, 0, 5); 46 LuoPBase(35, 35, -375, 0, 0, 6); 68 69 70 LuobBase(50, 50, 200, -150, 0, 1); 71 LuorBase(50, 50, -200, 200, 0, 2); 72 LuopBase1(30, 30, 200, 100, 0, 3); 73 LuopBase2(50, 50, -100, -250, 0, 4); 74 LuopBase3(40, 40, 425, 200, 0, 5); 75 LuopBase4(35, 35, -375, 0, 0, 6); 76 77 47 78 LuoHiiri1(50, 50, -400, 350, 0); 48 79 LuoHiiri2(50, 50, 400, -350, 0); … … 54 85 //tukikohtien tekstit ja ajastimet 55 86 56 LuoAjastin1(1, 0, 200, -150); 57 LuoAjastin2(1, 0, -200, 200); 58 LuoAjastin3(1, 0, 200, 100); 59 LuoAjastin4(1, 0, -100, -250); 60 LuoAjastin5(1, 0, 425, 200); 61 LuoAjastin6(1, 0, 0, 0); 62 63 Keyboard.Listen(Key.Left, ButtonState.Down, 64 LiikutaRastia1, null, new Vector(-2, 0)); 65 Keyboard.Listen(Key.Right, ButtonState.Down, 66 LiikutaRastia1, null, new Vector(2, 0)); 67 Keyboard.Listen(Key.Up, ButtonState.Down, 68 LiikutaRastia1, null, new Vector(0, 2)); 69 Keyboard.Listen(Key.Down, ButtonState.Down, 70 LiikutaRastia1, null, new Vector(0, -2)); 71 72 73 //pelaaja 2 74 75 Keyboard.Listen(Key.A, ButtonState.Down, 76 LiikutaRastia2, null, new Vector(-2, 0)); 77 Keyboard.Listen(Key.D, ButtonState.Down, 78 LiikutaRastia2, null, new Vector(2, 0)); 79 Keyboard.Listen(Key.W, ButtonState.Down, 80 LiikutaRastia2, null, new Vector(0, 2)); 81 Keyboard.Listen(Key.S, ButtonState.Down, 82 LiikutaRastia2, null, new Vector(0, -2)); 87 LuoAjastin1(1, 0, 270, -204); 88 LuoAjastin2(1, 0, -270, 268); 89 LuoAjastin3(1, 0, 270, 132); 90 LuoAjastin4(1, 0, -133, -339); 91 LuoAjastin5(1, 0, 575, 268); 92 LuoAjastin6(1, 0, -507, -3); 93 94 //pelaaja 1 95 96 Keyboard.Listen(Key.Left, ButtonState.Down, 97 LiikutaRastia1, null, new Vector(-2, 0)); 98 Keyboard.Listen(Key.Right, ButtonState.Down, 99 LiikutaRastia1, null, new Vector(2, 0)); 100 Keyboard.Listen(Key.Up, ButtonState.Down, 101 LiikutaRastia1, null, new Vector(0, 2)); 102 Keyboard.Listen(Key.Down, ButtonState.Down, 103 LiikutaRastia1, null, new Vector(0, -2)); 104 Keyboard.Listen(Key.NumPad0, ButtonState.Pressed, ValitseBase, ""); 105 106 107 108 //pelaaja 2 109 110 Keyboard.Listen(Key.A, ButtonState.Down, 111 LiikutaRastia2, null, new Vector(-2, 0)); 112 Keyboard.Listen(Key.D, ButtonState.Down, 113 LiikutaRastia2, null, new Vector(2, 0)); 114 Keyboard.Listen(Key.W, ButtonState.Down, 115 LiikutaRastia2, null, new Vector(0, 2)); 116 Keyboard.Listen(Key.S, ButtonState.Down, 117 LiikutaRastia2, null, new Vector(0, -2)); 118 Keyboard.Listen(Key.Space, ButtonState.Pressed, sinisenbasevalinta, ""); 83 119 84 120 … … 152 188 } 153 189 154 void Luo BBase(double leveys, double korkeus, double x, double y, double rotation, int basenumero)190 void LuobBase(double leveys, double korkeus, double x, double y, double rotation, int basenumero) 155 191 { 156 192 157 193 Image bbasek = LoadImage("bluebase"); 158 PhysicsObject bluebase = new PhysicsObject(leveys, korkeus); 194 bbase = new PhysicsObject(leveys, korkeus); 195 baset.Add(bbase); 159 196 PhysicsObject.CreateStaticObject(leveys, korkeus); 160 b luebase.X = x;161 b luebase.Y = y;162 b luebase.Angle = Angle.FromDegrees(rotation);163 b luebase.Image = bbasek;164 Add (b luebase);165 166 } 167 168 void Luo RBase(double leveys, double korkeus, double x, double y, double rotation, int basenumero)197 bbase.X = x; 198 bbase.Y = y; 199 bbase.Angle = Angle.FromDegrees(rotation); 200 bbase.Image = bbasek; 201 Add (bbase); 202 203 } 204 205 void LuorBase(double leveys, double korkeus, double x, double y, double rotation, int basenumero) 169 206 { 170 207 171 208 Image rbasek = LoadImage("redbase"); 172 PhysicsObject redbase = new PhysicsObject(leveys, korkeus); 209 rbase = new PhysicsObject(leveys, korkeus); 210 baset.Add(rbase); 173 211 PhysicsObject.CreateStaticObject(leveys, korkeus); 174 r edbase.X = x;175 r edbase.Y = y;176 r edbase.Angle = Angle.FromDegrees(rotation);177 r edbase.Image = rbasek;178 Add(r edbase);179 180 } 181 182 void Luo PBase(double leveys, double korkeus, double x, double y, double rotation, int basenumero)212 rbase.X = x; 213 rbase.Y = y; 214 rbase.Angle = Angle.FromDegrees(rotation); 215 rbase.Image = rbasek; 216 Add(rbase); 217 218 } 219 220 void LuopBase1(double leveys, double korkeus, double x, double y, double rotation, int basenumero) 183 221 { 184 222 185 223 Image pbasek = LoadImage("plainbase"); 186 PhysicsObject plainbase = new PhysicsObject(leveys, korkeus); 224 pbase = new PhysicsObject(leveys, korkeus); 225 baset.Add(pbase); 187 226 PhysicsObject.CreateStaticObject(leveys, korkeus); 188 plainbase.X = x; 189 plainbase.Y = y; 190 plainbase.Angle = Angle.FromDegrees(rotation); 191 plainbase.Image = pbasek; 192 Add(plainbase); 227 pbase.X = x; 228 pbase.Y = y; 229 pbase.Angle = Angle.FromDegrees(rotation); 230 pbase.Image = pbasek; 231 Add(pbase); 232 233 } 234 235 void LuopBase2(double leveys, double korkeus, double x, double y, double rotation, int basenumero) 236 { 237 238 Image pbasek = LoadImage("plainbase"); 239 PhysicsObject pbase2 = new PhysicsObject(leveys, korkeus); 240 baset.Add(pbase2); 241 PhysicsObject.CreateStaticObject(leveys, korkeus); 242 pbase2.X = x; 243 pbase2.Y = y; 244 pbase2.Angle = Angle.FromDegrees(rotation); 245 pbase2.Image = pbasek; 246 Add(pbase2); 247 248 } 249 250 void LuopBase3(double leveys, double korkeus, double x, double y, double rotation, int basenumero) 251 { 252 253 Image pbasek = LoadImage("plainbase"); 254 PhysicsObject plainbase3 = new PhysicsObject(leveys, korkeus); 255 baset.Add(plainbase3); 256 PhysicsObject.CreateStaticObject(leveys, korkeus); 257 plainbase3.X = x; 258 plainbase3.Y = y; 259 plainbase3.Angle = Angle.FromDegrees(rotation); 260 plainbase3.Image = pbasek; 261 Add(plainbase3); 262 263 } 264 265 void LuopBase4(double leveys, double korkeus, double x, double y, double rotation, int basenumero) 266 { 267 268 Image pbasek = LoadImage("plainbase"); 269 PhysicsObject plainbase4 = new PhysicsObject(leveys, korkeus); 270 baset.Add(plainbase4); 271 PhysicsObject.CreateStaticObject(leveys, korkeus); 272 plainbase4.X = x; 273 plainbase4.Y = y; 274 plainbase4.Angle = Angle.FromDegrees(rotation); 275 plainbase4.Image = pbasek; 276 Add(plainbase4); 193 277 194 278 } … … 316 400 } 317 401 318 void LuoAjastin1( double perusnopeus , int aluksia1, double x, double y)402 void LuoAjastin1( double perusnopeus1, int aluksia1, double x, double y) 319 403 { 320 404 Timer ajastin = new Timer(); 321 ajastin.Interval = perusnopeus ;405 ajastin.Interval = perusnopeus1; 322 406 ajastin.Timeout += lisaaalus1; 323 407 ajastin.Start(); … … 331 415 Add(maara1); 332 416 } 333 void LuoAjastin2( double perusnopeus , int aluksia2, double x, double y)417 void LuoAjastin2( double perusnopeus2, int aluksia2, double x, double y) 334 418 { 335 419 Timer ajastin = new Timer(); 336 ajastin.Interval = perusnopeus ;420 ajastin.Interval = perusnopeus2; 337 421 ajastin.Timeout += lisaaalus2; 338 422 ajastin.Start(); … … 347 431 } 348 432 349 void LuoAjastin3( double perusnopeus , int aluksia3, double x, double y)433 void LuoAjastin3( double perusnopeus3, int aluksia3, double x, double y) 350 434 { 351 435 Timer ajastin = new Timer(); 352 ajastin.Interval = perusnopeus ;436 ajastin.Interval = perusnopeus3; 353 437 ajastin.Timeout += lisaaalus3; 354 438 ajastin.Start(); … … 362 446 } 363 447 364 void LuoAjastin4( double perusnopeus , int aluksia4, double x, double y)448 void LuoAjastin4( double perusnopeus4, int aluksia4, double x, double y) 365 449 { 366 450 Timer ajastin = new Timer(); 367 ajastin.Interval = perusnopeus ;451 ajastin.Interval = perusnopeus4; 368 452 ajastin.Timeout += lisaaalus4; 369 453 ajastin.Start(); … … 378 462 } 379 463 380 void LuoAjastin5( double perusnopeus , int aluksia5, double x, double y)464 void LuoAjastin5( double perusnopeus5, int aluksia5, double x, double y) 381 465 { 382 466 Timer ajastin = new Timer(); 383 ajastin.Interval = perusnopeus ;467 ajastin.Interval = perusnopeus5; 384 468 ajastin.Timeout += lisaaalus5; 385 469 ajastin.Start(); … … 394 478 } 395 479 396 void LuoAjastin6(double perusnopeus , int aluksia1, double x, double y)480 void LuoAjastin6(double perusnopeus6, int aluksia1, double x, double y) 397 481 { 398 482 Timer ajastin = new Timer(); 399 ajastin.Interval = perusnopeus ;483 ajastin.Interval = perusnopeus6; 400 484 ajastin.Timeout += lisaaalus6; 401 485 ajastin.Start(); … … 452 536 } 453 537 454 455 456 } 538 void lisaaalus6() 539 { 540 541 aluksia6++; 542 maara6.Text = aluksia6.ToString(); 543 544 } 545 546 547 void ValitseBase() 548 { 549 550 Vector hiirenPaikka = Camera.ScreenToWorld( hiirip.Position ); 551 552 foreach ( PhysicsObject b in baset) 553 { 554 555 if (hiirenPaikka.X < b.X + 50 && hiirenPaikka.X > b.X - 50 && hiirenPaikka.Y < b.Y + 50 && hiirenPaikka.Y > b.Y - 50) 556 { 557 if (punaisenvalinta == null) 558 { 559 punaisenvalinta = new GameObject(100, 100); 560 punaisenvalinta.Position = b.Position; 561 Image punaisenvalintak = LoadImage("punaisenvalintak"); 562 punaisenvalinta.Image = punaisenvalintak; 563 564 Add(punaisenvalinta, 1); 565 } 566 567 else 568 { 569 570 punaisenvalinta.Position = b.Position; 571 572 } 573 574 } 575 576 } 577 } 578 579 void sinisenbasevalinta() 580 { 581 582 Vector shiirenPaikka = Camera.ScreenToWorld(hiiris.Position); 583 584 foreach (PhysicsObject b in baset) 585 if (shiirenPaikka.X < b.X + 50 && shiirenPaikka.X > b.X - 50 && shiirenPaikka.Y < b.Y + 50 && shiirenPaikka.Y > b.Y - 50) 586 { 587 if (sinisenvalinta == null) 588 { 589 sinisenvalinta = new GameObject(100, 100); 590 sinisenvalinta.Position = b.Position; 591 Image sinisenvalintak = LoadImage("sinisenvalintak"); 592 sinisenvalinta.Image = sinisenvalintak; 593 594 Add(sinisenvalinta, 1); 595 596 alus = new PhysicsObject(100, 100); 597 alus.Position = b.Position; 598 Image alusk = LoadImage("alus"); 599 alus.Image = alusk; 600 } 601 602 else 603 { 604 605 sinisenvalinta.Position = b.Position; 606 607 } 608 609 } 610 } 611 612 613 614 } 615 616 -
2011/31/EsaN/DevOid/DevOid/DevOid/obj/x86/Debug/DevOid.csproj.FileListAbsolute.txt
r2543 r2567 18 18 C:\MyTemp\EsaN\DevOid\DevOid\DevOid\bin\x86\Debug\Content\hiirip.xnb 19 19 C:\MyTemp\EsaN\DevOid\DevOid\DevOid\bin\x86\Debug\Content\hiiris.xnb 20 C:\MyTemp\EsaN\DevOid\DevOid\DevOid\bin\x86\Debug\Content\punaisenvalintak.xnb 21 C:\MyTemp\EsaN\DevOid\DevOid\DevOid\bin\x86\Debug\Content\sinisenvalintak.xnb -
2011/31/EsaN/DevOid/DevOid/DevOid/obj/x86/Debug/cachefile-{14B54A56-7075-4480-92EA-C8481771F4DD}-targetpath.txt
r2543 r2567 10 10 Content\hiirip.xnb 11 11 Content\hiiris.xnb 12 Content\punaisenvalintak.xnb 13 Content\sinisenvalintak.xnb -
2011/31/EsaN/DevOid/DevOid/DevOidContent/DevOidContent.contentproj
r2542 r2567 113 113 </Compile> 114 114 </ItemGroup> 115 <ItemGroup> 116 <Compile Include="punaisenvalintak.png"> 117 <Name>punaisenvalintak</Name> 118 <Importer>TextureImporter</Importer> 119 <Processor>TextureProcessor</Processor> 120 </Compile> 121 </ItemGroup> 122 <ItemGroup> 123 <Compile Include="sinisenvalintak.png"> 124 <Name>sinisenvalintak</Name> 125 <Importer>TextureImporter</Importer> 126 <Processor>TextureProcessor</Processor> 127 </Compile> 128 </ItemGroup> 115 129 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 116 130 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2011/31/EsaN/DevOid/DevOid/DevOidContent/obj/x86/Debug/ContentPipeline.xml
r2543 r2567 101 101 <Time>2011-08-03T18:39:17.8192088+03:00</Time> 102 102 </Item> 103 <Item> 104 <Source>punaisenvalintak.png</Source> 105 <Name>punaisenvalintak</Name> 106 <Importer>TextureImporter</Importer> 107 <Processor>TextureProcessor</Processor> 108 <Options>None</Options> 109 <Output>C:\MyTemp\EsaN\DevOid\DevOid\DevOid\bin\x86\Debug\Content\punaisenvalintak.xnb</Output> 110 <Time>2011-08-04T12:40:05.5136921+03:00</Time> 111 </Item> 112 <Item> 113 <Source>sinisenvalintak.png</Source> 114 <Name>sinisenvalintak</Name> 115 <Importer>TextureImporter</Importer> 116 <Processor>TextureProcessor</Processor> 117 <Options>None</Options> 118 <Output>C:\MyTemp\EsaN\DevOid\DevOid\DevOid\bin\x86\Debug\Content\sinisenvalintak.xnb</Output> 119 <Time>2011-08-04T14:11:57.5019598+03:00</Time> 120 </Item> 103 121 <BuildSuccessful>true</BuildSuccessful> 104 122 <Settings>
Note: See TracChangeset
for help on using the changeset viewer.