- Timestamp:
- 2015-06-24 22:51:14 (7 years ago)
- Location:
- 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs
r6293 r6295 54 54 HillbillyRun game = this.Game as HillbillyRun; 55 55 Owner.PlayAnimation(Animations[1]); 56 game.CreateMilkParticles(this.Owner );56 game.CreateMilkParticles(this.Owner, 10, 200, 300, new Vector(0, -30), "milkparticle"); 57 57 58 58 } … … 78 78 public Improvement Improvement { get; set; } 79 79 80 public Label Name { get; set; } 81 82 private ProgressBar visibleLife; 83 public ProgressBar VisibleLife 84 { 85 get { return visibleLife; } 86 set { visibleLife = value; } 87 } 88 80 89 public void GainImprovement(Improvement improvement) 81 90 { … … 96 105 } 97 106 98 public HillBilly(double leveys, double korkeus )107 public HillBilly(double leveys, double korkeus, String name) 99 108 : base(leveys, korkeus) 100 109 { 101 110 111 this.visibleLife = new ProgressBar(50, 15); //(this.Width, this.Height/8); 112 this.Add(visibleLife); 113 this.visibleLife.Position += new Vector(0, this.Height / 2 + this.Height / 5); 114 this.visibleLife.BindTo(this.lifeCounter); 115 this.visibleLife.Color = Color.Black; 116 117 this.Name = new Label(name); 118 this.Add(Name); 119 this.Name.Position += new Vector(0, this.Height / 2 + this.Height / 3); 102 120 } 103 121 } … … 117 135 public const double TILE_SIZE = 70; 118 136 137 public String[] names = new String[] { "Adolfiina", "Rasputiina", "Hermanniina", "Joosefiina"}; 138 119 139 private double cameraTargetX; // Sijainti jossa kameran pitäisi olla. 120 140 private Vector cameraTarget; … … 369 389 //level.SetTileMethod(Color.Azure, CreateDummy, Color.Azure); //TODO: CreateSmoke 370 390 //level.SetTileMethod(Color.Orange, CreateDummy, Color.Orange); //TODO: CreateTombstone 371 level.Optimize(Color.B lack, Color.Brown);391 level.Optimize(Color.Brown); //Color.Black //Tekee jännittäviä asioita wheatille, jos optimoidaan (tietysti). Jotenn. 372 392 level.Execute(TILE_SIZE, TILE_SIZE); 373 393 } … … 574 594 mage.Destroy(); 575 595 castTimer.Stop(); 576 //NextLevel();596 NextLevel(); 577 597 } 578 598 Timer.SingleShot(0.5, delegate { immune = false; }); … … 639 659 void CreatePlayer(Vector position, double width, double height) 640 660 { 641 HillBilly player = new HillBilly(width, height * 2 );661 HillBilly player = new HillBilly(width, height * 2, names[players.Count()]); 642 662 player.Shape = Shape.Rectangle; 643 663 player.Position = position + new Vector(0, height * 0.5); … … 741 761 742 762 Keyboard.Listen(Key.F12, ButtonState.Pressed, NextLevel, null); 763 Keyboard.Listen(Key.R, ButtonState.Pressed, StartGame, null); 743 764 744 765 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Show help"); … … 746 767 } 747 768 748 public void CreateMilkParticles(HillBilly billy )769 public void CreateMilkParticles(HillBilly billy, int size, int xBase, int yBase, Vector position, String tag) 749 770 { 750 771 for (int i = 0; i < 10; i++) 751 772 { 752 773 const double maxLife = 1.0; 753 PhysicsObject milkParticle = new PhysicsObject( 10, 10, Shape.Circle);774 PhysicsObject milkParticle = new PhysicsObject(size, size, Shape.Circle); 754 775 milkParticle.Color = new Color(255, 255, 255, 128); 755 milkParticle.Position = billy.Position + new Vector(0, -30);776 milkParticle.Position = billy.Position + position; 756 777 milkParticle.IgnoresCollisionResponse = true; 757 milkParticle.Tag = "milkparticle";778 milkParticle.Tag = tag; 758 779 milkParticle.LifetimeLeft = TimeSpan.FromSeconds(maxLife); 759 780 Add(milkParticle); … … 772 793 var rx = RandomGen.NextDouble(-50, 50); 773 794 var ry = RandomGen.NextDouble(-50, 50); 774 milkParticle.Hit(new Vector(billy.FacingDirection.GetVector().X * ( 200 + rx), 300+ ry));795 milkParticle.Hit(new Vector(billy.FacingDirection.GetVector().X * (xBase + rx), yBase + ry)); 775 796 } 776 797 } … … 780 801 if (player.Improvement == null) 781 802 { 782 player.Jump(200); //TODO: CRY ALL THE TEARS :'( 803 804 CreateMilkParticles(player, 5, 100, 100, new Vector(0, player.Height/3), "tears"); 805 //for (int i = 0; i < 5; i++) 806 //{ 807 // const double maxLife = 1.0; 808 // PhysicsObject milkParticle = new PhysicsObject(5, 5, Shape.Circle); 809 // milkParticle.Color = new Color(255, 255, 255, 128); 810 // milkParticle.Position = player.Position + new Vector(0, player.Height / 3); 811 // milkParticle.IgnoresCollisionResponse = true; 812 // milkParticle.LifetimeLeft = TimeSpan.FromSeconds(maxLife); 813 // Add(milkParticle); 814 815 // // Väri muuttuu läpinäkyväksi. 816 // var fadeTimer = new Timer { Interval = 0.07 }; 817 // fadeTimer.Timeout += delegate 818 // { 819 // byte c = 255; 820 // milkParticle.Color = new Color(c, c, c, (byte)(128 * milkParticle.LifetimeLeft.TotalSeconds / maxLife)); 821 // }; 822 // fadeTimer.Start(); 823 // milkParticle.Destroyed += fadeTimer.Stop; 824 825 // // Random lentonopeus. 826 // var rx = RandomGen.NextDouble(-50, 50); 827 // var ry = RandomGen.NextDouble(-50, 50); 828 // milkParticle.Hit(new Vector(player.FacingDirection.GetVector().X * (100 + rx), 100 + ry)); 829 //} 783 830 return; 784 831 }
Note: See TracChangeset
for help on using the changeset viewer.