- Timestamp:
- 2015-06-24 22:56:25 (6 years ago)
- Location:
- 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
- Files:
-
- 17 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs
r6295 r6297 55 55 Owner.PlayAnimation(Animations[1]); 56 56 game.CreateMilkParticles(this.Owner, 10, 200, 300, new Vector(0, -30), "milkparticle"); 57 57 58 58 } 59 59 … … 101 101 if (Animation != improvement.Animations[1]) 102 102 { 103 103 improvement.DoTheThing(); 104 104 } 105 105 } … … 144 144 145 145 # region Images 146 private Image[] groundImages = LoadImages("ground", "ground "); //Näitä ei tosin kaikkia kenties jaksa tehdä erilaisiksi levelistä riippuen147 private Image[] groundTopImages = LoadImages("ground_top", "ground_top ");146 private Image[] groundImages = LoadImages("ground", "ground_forest"); //Näitä ei tosin kaikkia kenties jaksa tehdä erilaisiksi levelistä riippuen 147 private Image[] groundTopImages = LoadImages("ground_top", "ground_top_forest"); 148 148 private Image[] foregroundDecorations = LoadImages("viljaa", "grass"); 149 private Image[] blockImages = LoadImages("box2", " box");149 private Image[] blockImages = LoadImages("box2", "rock"); 150 150 151 151 private Image[] houseImages = LoadImages("house", "houseburned"); … … 159 159 private Image smokeImage2 = LoadImage("smoke2"); 160 160 161 private Image treeTrunkImage = LoadImage("bigtree"); 162 private Image treeBottomImage = LoadImage("bigtree3x2"); 163 private Image treeBranchImage = LoadImage("bigtreebranch"); 161 164 private Image forestBackgroundImage = LoadImage("forestbackground"); 162 165 … … 174 177 private Animation firemageAnimation; 175 178 private Animation firemageCastAnimation; 179 private Animation wormAnimation; 176 180 #endregion 177 181 … … 336 340 firemageAnimation = LoadAnimation("firemage"); 337 341 firemageCastAnimation = LoadAnimation("firemagecast"); 342 wormAnimation = LoadAnimation("worm"); 338 343 339 344 cameraOffset = Window.Width / 4; … … 362 367 Add(forestBackground, -3); 363 368 Layers[-3].RelativeTransition = new Vector(0.5, 1.0); 364 Level.Background.CreateGradient(Color.Black, Color.SkyBlue); 369 370 if (levelNumber == 1) 371 { 372 Level.Background.CreateGradient(Color.Black, Color.FromHexCode("495147")); 373 } 374 else 375 { 376 Level.Background.CreateGradient(Color.Black, Color.SkyBlue); 377 } 365 378 } 366 379 … … 384 397 level.SetTileMethod(Color.White, CreateBlockObject); 385 398 level.SetTileMethod(Color.DarkGray, CreateMilk); 386 level.SetTileMethod(Color.Gray, CreateCrawly);399 level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm })[levelNumber]); // ಠ_ಠ 387 400 level.SetTileMethod(Color.Red, CreateFireMage); 388 401 level.SetTileMethod(Color.Rose, CreateFlame, true); 389 402 //level.SetTileMethod(Color.Azure, CreateDummy, Color.Azure); //TODO: CreateSmoke 390 403 //level.SetTileMethod(Color.Orange, CreateDummy, Color.Orange); //TODO: CreateTombstone 404 405 level.SetTileMethod(Color.FromHexCode("FF6A00"), CreateTreeTrunk); 406 level.SetTileMethod(Color.FromHexCode("57007F"), CreateTreeRoot); 407 level.SetTileMethod(Color.FromHexCode("00FF21"), CreateTreeBranch); 408 391 409 level.Optimize(Color.Brown); //Color.Black //Tekee jännittäviä asioita wheatille, jos optimoidaan (tietysti). Jotenn. 410 392 411 level.Execute(TILE_SIZE, TILE_SIZE); 412 } 413 414 void CreateTreeBranch(Vector position, double width, double height) 415 { 416 PhysicsObject branch = PhysicsObject.CreateStaticObject(width, height); 417 branch.Position = position; 418 branch.Image = treeBranchImage; 419 Add(branch, -1); 420 } 421 422 void CreateTreeTrunk(Vector position, double width, double height) 423 { 424 GameObject trunk = new GameObject(width * 3, height); 425 trunk.Position = position; 426 trunk.Image = treeTrunkImage; 427 Add(trunk, -1); 428 } 429 430 void CreateTreeRoot(Vector position, double width, double height) 431 { 432 GameObject roots = new GameObject(width * 9, height * 4); 433 roots.Position = position; 434 roots.Y -= height; 435 roots.Image = treeBottomImage; 436 Add(roots, -1); 393 437 } 394 438 … … 429 473 flame.Destroy(); 430 474 savu.Destroy(); 431 475 432 476 }); 433 477 } … … 467 511 //milk.Tag = "milk"; 468 512 //Add(milk); 513 } 514 515 void CreateWorm(Vector position, double width, double height) 516 { 517 PlatformCharacter worm = new PlatformCharacter(width, height * 0.6); 518 worm.Position = position; 519 worm.Animation = new Animation(wormAnimation); 520 worm.Animation.FPS = RandomGen.NextInt(18, 24); 521 worm.Animation.Step(RandomGen.NextInt(0, 16)); 522 worm.Animation.Resume(); 523 worm.Tag = "worm"; 524 worm.CollisionIgnoreGroup = 3; 525 Add(worm, 1); 526 527 PlatformWandererBrain brain = new PlatformWandererBrain(); 528 brain.Speed = 60; 529 brain.FallsOffPlatforms = true; 530 worm.Brain = brain; 469 531 } 470 532 … … 555 617 mage.PlayAnimation(firemageCastAnimation); 556 618 557 Timer.SingleShot(1.5, 558 delegate 619 Timer.SingleShot(1.5, 620 delegate 559 621 { 560 622 for (int i = 0; i < 6; i++) … … 580 642 } 581 643 }); 582 644 583 645 }; 584 646 //castTimer.Start(); … … 601 663 }); 602 664 603 AddCollisionHandler(trigger, "player", delegate(PhysicsObject a, PhysicsObject b) { castTimer.Start(); });665 AddCollisionHandler(trigger, "player", delegate(PhysicsObject a, PhysicsObject b) { castTimer.Start(); }); 604 666 } 605 667 … … 672 734 player.Tag = "player"; 673 735 Add(player); 736 674 737 AddCollisionHandler(player, "burn", delegate(PhysicsObject p, PhysicsObject t) 675 738 { 676 HillBilly billy = p as HillBilly; 677 billy.Life.Value--; 678 739 player.Life.Value--; 679 740 }); 741 742 AddCollisionHandler(player, "worm", delegate(PhysicsObject p, PhysicsObject worm) 743 { 744 if (player.Y > worm.Y && Math.Abs(player.X - worm.X) < worm.Width / 2.0) 745 { 746 worm.Destroy(); 747 } 748 else 749 { 750 player.Life.Value--; 751 } 752 }); 753 680 754 681 755 player.Life.LowerLimit += delegate … … 685 759 Loss(); 686 760 } 687 else 688 { 761 else 762 { 689 763 players.Remove(player); 690 764 … … 694 768 parannus.Image = player.Improvement.Image; 695 769 parannus.Position = player.Position; 696 parannus.Animations = player.Improvement.Animations; 770 parannus.Animations = player.Improvement.Animations; 697 771 parannus.Tag = player.Improvement.Tag; 698 772 parannus.Size = new Vector(60, 60); … … 701 775 702 776 player.Destroy(); 703 704 777 778 705 779 } 706 780 }; … … 719 793 // Maanpinnan näkyvä osa. 720 794 GameObject visibleGround = new GameObject(width, height); 721 visibleGround.Image = ground Images[levelNumber];795 visibleGround.Image = groundTopImages[levelNumber]; 722 796 visibleGround.Position = position; 723 797 visibleGround.TextureWrapSize = new Vector(width / TILE_SIZE, height / TILE_SIZE); … … 730 804 { 731 805 GameObject wheatBlock = new GameObject(width * 1.5, height * 2); 732 wheatBlock.Image = foregroundDecorations[ 0];806 wheatBlock.Image = foregroundDecorations[levelNumber]; 733 807 wheatBlock.X = visibleGround.X; 734 808 wheatBlock.Bottom = visibleGround.Bottom; … … 741 815 { 742 816 PhysicsObject ground = PhysicsObject.CreateStaticObject(width, height); 743 ground.Image = ground TopImages[levelNumber];817 ground.Image = groundImages[levelNumber]; 744 818 ground.Position = position; 745 819 ground.TextureWrapSize = new Vector(width / TILE_SIZE, height / TILE_SIZE); 746 Add(ground );820 Add(ground, -1); 747 821 } 748 822 #endregion -
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj
r6288 r6297 247 247 </Compile> 248 248 </ItemGroup> 249 <ItemGroup> 250 <Compile Include="rock.png"> 251 <Name>rock</Name> 252 <Importer>TextureImporter</Importer> 253 <Processor>TextureProcessor</Processor> 254 </Compile> 255 <Compile Include="spikes.png"> 256 <Name>spikes</Name> 257 <Importer>TextureImporter</Importer> 258 <Processor>TextureProcessor</Processor> 259 </Compile> 260 </ItemGroup> 261 <ItemGroup> 262 <Compile Include="worm.anim"> 263 <Name>worm</Name> 264 <Importer>AnimationImporter</Importer> 265 <Processor>AnimationContentProcessor</Processor> 266 </Compile> 267 </ItemGroup> 268 <ItemGroup> 269 <Compile Include="bigtree.png"> 270 <Name>bigtree</Name> 271 <Importer>TextureImporter</Importer> 272 <Processor>TextureProcessor</Processor> 273 </Compile> 274 <Compile Include="bigtree3x2.png"> 275 <Name>bigtree3x2</Name> 276 <Importer>TextureImporter</Importer> 277 <Processor>TextureProcessor</Processor> 278 </Compile> 279 <Compile Include="bigtreebranch.png"> 280 <Name>bigtreebranch</Name> 281 <Importer>TextureImporter</Importer> 282 <Processor>TextureProcessor</Processor> 283 </Compile> 284 </ItemGroup> 285 <ItemGroup> 286 <Compile Include="ground_forest.png"> 287 <Name>ground_forest</Name> 288 <Importer>TextureImporter</Importer> 289 <Processor>TextureProcessor</Processor> 290 </Compile> 291 <Compile Include="ground_top_forest.png"> 292 <Name>ground_top_forest</Name> 293 <Importer>TextureImporter</Importer> 294 <Processor>TextureProcessor</Processor> 295 </Compile> 296 </ItemGroup> 249 297 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 250 298 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.