- Timestamp:
- 2017-06-14 14:51:54 (6 years ago)
- Location:
- 2017/24/IlariI/piXgel GAmE/piXgel GAmE/piXgel_GAmE
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/24/IlariI/piXgel GAmE/piXgel GAmE/piXgel_GAmE/piXgel_GAmE.cs
r8653 r8663 9 9 public class piXgel_GAmE : PhysicsGame 10 10 { 11 11 AssaultRifle hahmonase; 12 12 13 PhysicsObject hahmo; 13 14 Vector nopeusVasemmalle = new Vector(-100.0, 0.0); … … 23 24 public override void Begin() 24 25 { 25 hahmo = new PhysicsObject( 25, 30);26 hahmo = new PhysicsObject(30, 30); 26 27 hahmo.CanRotate = false; 27 28 hahmo.Restitution = 0.0; 28 29 30 hahmonase = new AssaultRifle(30, 10); 31 32 33 34 hahmonase.ProjectileCollision = Ammusosui; 35 hahmo.Add(hahmonase); 36 37 Keyboard.Listen(Key.Space, ButtonState.Down, Ammuaseella, "Ammu", hahmonase); 38 29 39 30 40 PhysicsObject vihollinen = new PhysicsObject(40, 40); … … 33 43 vihollinen.Y = -200; 34 44 45 35 46 FollowerBrain seuraajanAivot = new FollowerBrain(hahmo); 36 47 Add(vihollinen); … … 38 49 vihollinen.Brain = seuraajanAivot; 39 50 40 seuraajanAivot.Speed = 300;51 seuraajanAivot.Speed = 60; 41 52 seuraajanAivot.DistanceFar = 600; 42 seuraajanAivot.DistanceClose = 200;53 seuraajanAivot.DistanceClose = 37; 43 54 seuraajanAivot.StopWhenTargetClose = true; 44 55 … … 88 99 } 89 100 101 void Ammusosui(PhysicsObject ammus, PhysicsObject kohde) 102 { 103 ammus.Destroy(); 104 kohde.Destroy(); 105 } 106 107 void Ammuaseella(AssaultRifle ase) 108 { 109 PhysicsObject ammus = ase.Shoot(); 110 111 if(ammus != null) 112 { 113 ammus.Size *= 0.5; 114 115 ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 116 } 117 } 118 90 119 void KavelytaPelaajaa(Vector suunta) 91 120 { 92 121 hahmo.Velocity = suunta; 122 if(suunta.X<0) 123 { 124 hahmonase.Angle = Angle.FromDegrees(180.0); 125 } 126 if (suunta.X>0) 127 { 128 hahmonase.Angle = Angle.FromDegrees(180.0); 129 130 } 131 if (suunta.Y > 0) 132 { hahmonase.Angle = Angle.FromDegrees(90.0); 133 93 134 94 135 } 136 if (suunta.Y < 0) 137 { 138 hahmonase.Angle = Angle.FromDegrees(90.0); 139 } 95 140 96 141 void KunPaaseeLahelle()
Note: See TracChangeset
for help on using the changeset viewer.