Changeset 9126
- Timestamp:
- 2017-07-26 14:13:59 (6 years ago)
- Location:
- 2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb_helicopter
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb_helicopter/Bomb_helicopter.cs
r9122 r9126 22 22 PhysicsObject ohjus; 23 23 Image Ohjus = LoadImage("ohjuspieni"); 24 25 24 26 25 27 … … 39 41 Laukaisija(500, -450); 40 42 Laukaisija(1400, -450); 43 41 44 42 45 … … 87 90 Add(helikopteri); 88 91 89 92 AddCollisionHandler(helikopteri, "ohjus", OhjusTormaa); 93 // AddCollisionHandler(helikopteri, ohjus, OhjusTormaa); 90 94 } 95 96 91 97 92 98 void HelikopteriTormaa(PhysicsObject tormaaja, PhysicsObject kohde) … … 132 138 { 133 139 PhysicsObject ohjus = new PhysicsObject(40.0, 60.0); 140 134 141 ohjus.Image = Ohjus; 135 142 ohjus.Position = laukaisija.Position; 136 143 Add(ohjus); 137 ohjus.Hit(new Vector(0, 1200)); 144 ohjus.Tag = "ohjus"; 145 138 146 139 Vector suunta = (helikopteri.Position - ohjus.Position).Normalize(); 140 ohjus.Angle = suunta.Angle; 147 Vector suunta = (ohjus.Position - helikopteri.Position).Normalize(); 148 ohjus.Angle = suunta.Angle+Angle.FromDegrees(90); 149 ohjus.MaximumLifetime = TimeSpan.FromSeconds(6); 150 ohjus.MoveTo(helikopteri.Position, 600); 151 //ohjus.Hit(Vector.FromLengthAndAngle(2000, ohjus.Angle)); 141 152 142 153 } 154 155 void OhjusTormaa(PhysicsObject tormaaja, PhysicsObject kohde) 156 { 157 //tormaaja.Velocity = new Vector(tormaaja.Velocity.X, 0); 158 kohde.Destroy(); 159 tormaaja.Destroy(); 160 MessageDisplay.Add("Game Over"); 161 Explosion rajahdys = new Explosion(200); 162 rajahdys.Position = helikopteri.Position; 163 Add(rajahdys); 164 } 143 165 }
Note: See TracChangeset
for help on using the changeset viewer.