- Timestamp:
- 2015-06-25 08:33:19 (8 years ago)
- Location:
- 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs
r6307 r6310 43 43 44 44 public virtual void DoTheThing() { } 45 46 public SoundEffect sound; 45 47 } 46 48 47 //Luokka maajussien erikoisuuksille.48 49 public class MilkImprovement : Improvement 49 50 { 50 51 52 51 public override void DoTheThing() 53 52 { … … 55 54 Owner.PlayAnimation(Animations[1]); 56 55 game.CreateMilkParticles(this.Owner, 10, 200, 300, new Vector(0, -30), "milkparticle"); 56 this.sound.Play(); 57 57 58 58 } 59 59 60 60 public MilkImprovement(double width, double height) 61 : base(width, height) 62 { 63 64 } 65 } 66 67 68 public class PitchForkImprovement : Improvement 69 { 70 public override void DoTheThing() 71 { 72 HillbillyRun game = this.Game as HillbillyRun; 73 Owner.PlayAnimation(Animations[1]); 74 //game.CreateMilkParticles(this.Owner, 10, 200, 300, new Vector(0, -30), "milkparticle"); 75 //TODO: hitting things w/ pitchfork 76 77 } 78 79 public PitchForkImprovement(double width, double height) 61 80 : base(width, height) 62 81 { … … 94 113 improvement.Owner = this; 95 114 96 improvement.Destroy();115 //improvement.Destroy(); 97 116 } 98 117 … … 102 121 { 103 122 improvement.DoTheThing(); 123 104 124 } 105 125 } … … 153 173 private Image cartImage = LoadImage("cart"); 154 174 private Image milkImage = LoadImage("tonkkaitem"); 175 private Image pitchforkImage = LoadImage("fork"); 155 176 156 177 private Image cartWheelImage = LoadImage("cartwheel"); … … 400 421 level.SetTileMethod(Color.Harlequin, CreateCart); 401 422 level.SetTileMethod(Color.White, CreateBlockObject); 423 //level.SetTileMethod(Color.DarkGray, (new AbstractTileMap<Color>.TileMethod[] { CreateMilk, CreatePitchfork })[levelNumber]); // Vain jos jaksan vippastaa maitokannun pysymään mukana ClearAllin läpi hmm 402 424 level.SetTileMethod(Color.DarkGray, CreateMilk); 425 level.SetTileMethod(Color.FromHexCode("A17FFF"), CreatePitchfork); 426 403 427 level.SetTileMethod(Color.Gray, (new AbstractTileMap<Color>.TileMethod[] { CreateCrawly, CreateWorm })[levelNumber]); // ಠ_ಠ 404 428 level.SetTileMethod(Color.Red, CreateFireMage); … … 407 431 //level.SetTileMethod(Color.Orange, CreateDummy, Color.Orange); //TODO: CreateTombstone 408 432 409 level.SetTileMethod(Color.FromHexCode("FF6A00"), CreateTreeTrunk); 433 level.SetTileMethod(Color.FromHexCode("FF6A00"), CreateTreeTrunk); //Pihhh jostain heksoista. Ikävästi haisee luovuttamiselta! :----D 410 434 level.SetTileMethod(Color.FromHexCode("57007F"), CreateTreeRoot); 411 435 level.SetTileMethod(Color.FromHexCode("00FF21"), CreateTreeBranch); … … 414 438 415 439 level.Execute(TILE_SIZE, TILE_SIZE); 440 } 441 442 void CreatePitchfork(Vector position, double width, double height) 443 { 444 double size = 30; 445 double ratio = pitchforkImage.Width / pitchforkImage.Height; 446 447 Improvement fork = new PitchForkImprovement(size * ratio, size); 448 fork.Image = pitchforkImage; 449 fork.Animations = new List<Animation> { pitchforkWalk, pitchforkAttack }; 450 fork.Position = position; 451 fork.Tag = "improvement"; 452 Add(fork); 453 416 454 } 417 455 … … 507 545 milk.Animations = new List<Animation> { milkWalk, milkThrow }; 508 546 milk.Position = position; 509 milk.Tag = "milk"; 547 //milk.Tag = "milk"; 548 milk.Tag = "improvement"; 549 milk.sound = splash; 510 550 Add(milk); 511 551 … … 770 810 if (player.Improvement != null) 771 811 { 772 Improvement parannus = new MilkImprovement(player.Improvement.Width, player.Improvement.Height);773 parannus.Image = player.Improvement.Image;812 Improvement parannus = player.Improvement; 813 //parannus.Image = player.Improvement.Image; 774 814 parannus.Position = player.Position; 775 parannus.Animations = player.Improvement.Animations; 776 parannus.Tag = player.Improvement.Tag; 777 parannus.Size = new Vector(60, 60); 778 Add(parannus); 815 parannus.IsVisible = true; 816 parannus.IgnoresCollisionResponse = false; 817 parannus.Tag = "improvement"; 818 //parannus.Animations = player.Improvement.Animations; 819 //parannus.Tag = player.Improvement.Tag; 820 //parannus.Size = new Vector(60, 60); 821 //Add(parannus); 779 822 } 780 823 … … 785 828 }; 786 829 787 AddCollisionHandler(player, "milk", CollectMilk); 788 } 830 AddCollisionHandler(player, "improvement", CollectImprovement); 831 // AddCollisionHandler(player, "improvement", CollectImprovement); 832 } 833 834 //void CollectImprovement(PhysicsObject player, PhysicsObject fork) 835 //{ 836 // //TODO: Collecting the fork 837 // HillBilly billy = player as HillBilly; 838 // if (billy == null) 839 // return; 840 841 // Improvement forkI = fork as Improvement; 842 // billy.GainImprovement(forkI); 843 844 // Remove(fork); 845 //} 789 846 790 847 void CreateGroundTop(Vector position, double width, double height) … … 848 905 public void CreateMilkParticles(HillBilly billy, int size, int xBase, int yBase, Vector position, String tag) 849 906 { 850 splash.Play();907 //splash.Play(); 851 908 for (int i = 0; i < 10; i++) 852 909 { … … 881 938 if (player.Improvement == null) 882 939 { 940 883 941 CreateMilkParticles(player, 5, 100, 100, new Vector(0, player.Height/3), "tears"); 884 942 return; … … 894 952 } 895 953 896 void Collect Milk(PhysicsObject player, PhysicsObject milk)954 void CollectImprovement(PhysicsObject player, PhysicsObject milk) 897 955 { 898 956 HillBilly billy = player as HillBilly; … … 903 961 billy.GainImprovement(milkI); 904 962 905 Remove(milk); 963 milk.IsVisible = false; 964 milk.IgnoresCollisionResponse = true; 965 milk.Tag = "none"; 966 967 //Remove(milk); 906 968 //billy.AnimWalk = new Animation(milkWalk); 907 969 //billy.AnimIdle = new Animation(milkWalk.CurrentFrame); -
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj
r6303 r6310 309 309 </Compile> 310 310 </ItemGroup> 311 <ItemGroup> 312 <Compile Include="fork.png"> 313 <Name>fork</Name> 314 <Importer>TextureImporter</Importer> 315 <Processor>TextureProcessor</Processor> 316 </Compile> 317 </ItemGroup> 311 318 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 312 319 <!-- 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.