Changeset 7630
- Timestamp:
- 2016-07-01 13:06:45 (7 years ago)
- Location:
- 2016/26/JonniN/TankHero
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/26/JonniN/TankHero/TankHero/TankHero/TankHero.cs
r7616 r7630 18 18 Image bottiRunko = LoadImage("t90runko"); 19 19 Image bottiTorni = LoadImage("t90torni"); 20 P hysicsObjectpelaaja;20 Pelaaja pelaaja; 21 21 PhysicsObject botti; 22 Vector spawn = new Vector(-1400, -1 300);22 Vector spawn = new Vector(-1400, -1400); 23 23 24 24 public override void Begin() … … 37 37 Vector kursoriruudulla = Mouse.PositionOnScreen; 38 38 Vector paikkakentällä = Mouse.PositionOnWorld; 39 MediaPlayer.Play("684240_Zound---Metallic"); 39 40 LuoKentta(); 40 41 LuoPelaaja(); 41 42 LuoOhjaimet(); 42 MediaPlayer.Play("684240_Zound---Metallic");43 43 44 44 45 … … 49 50 void LuoPelaaja() 50 51 { 51 pelaaja = new P hysicsObject(150, 200);52 pelaaja.Shape = Shape.FromImage(leopard2a4);52 pelaaja = new Pelaaja(115, 65); 53 //pelaaja.Shape = Shape.FromImage(leopard2a4); 53 54 pelaaja.Image = leopard2a4; 54 55 pelaaja.LinearDamping = 0.90; … … 56 57 pelaaja.Position = spawn; 57 58 pelaaja.Tag = "pelaaja1"; 59 pelaaja.IgnoresExplosions = true; 60 AddCollisionHandler(pelaaja, "vihunammus", PelaajaOttaaVahinkoa); 61 pelaaja.Mass = 10; 58 62 Add(pelaaja); 59 Camera.Zoom(1. 5);63 Camera.Zoom(1.3); 60 64 Camera.Follow(pelaaja); 61 65 //Camera.ZoomToAllObjects(); … … 63 67 64 68 65 torni = new Cannon(1 80, 100);69 torni = new Cannon(170, 100); 66 70 torni.Shape = Shape.FromImage(torninKuva); 67 71 torni.Image = torninKuva; 68 torni.Position = new Vector(- 7, -37);69 torni.Ammo.Value = 1000 0;72 torni.Position = new Vector(-5, 0); 73 torni.Ammo.Value = 1000; 70 74 pelaaja.Add(torni); 71 75 72 76 } 73 77 void PelaajaOttaaVahinkoa(PhysicsObject Pelaaja, PhysicsObject ammus) 78 { 79 pelaaja.ElamaLaskuri.Value--; 80 } 74 81 75 82 void LuoBotti(Vector paikka, double leveys, double korkeus) 76 83 { 77 PhysicsObject botti = new PhysicsObject(leveys*1. 7, korkeus*1.7);84 PhysicsObject botti = new PhysicsObject(leveys*1.2, korkeus*0.65); 78 85 botti.Image = bottiRunko; 79 86 botti.Position = paikka; … … 81 88 botti.AngularDamping = 0.99; 82 89 Add(botti); 83 84 Cannon botintorni = new Cannon(220, 70); 90 AddCollisionHandler(botti, "ammus1", CollisionHandler.DestroyObject); 91 92 Cannon botintorni = new Cannon(215, 65); 85 93 botintorni.Image = bottiTorni; 86 botintorni.Position += new Vector(- 8, 12);94 botintorni.Position += new Vector(-2, 0); 87 95 botintorni.Ammo.Value = 100; 88 96 botintorni.ProjectileCollision = AmmusOsuu; … … 98 106 Timer ajaastin = new Timer(); 99 107 ajaastin.Interval = 3; 100 ajaastin.Timeout += delegate { VihollinenAmpuu(botintorni); }; 108 ajaastin.Timeout += delegate 109 { 110 if (botti.IsDestroyed == true) 111 { 112 ajaastin.Stop(); 113 return; 114 } 115 VihollinenAmpuu(botintorni); 116 }; 101 117 ajaastin.Start(); 102 118 … … 114 130 ajastin.Start(); 115 131 116 117 118 132 } 119 133 … … 127 141 { 128 142 ammus.Size *= 1; 129 //tykki.FireRate = 10;143 ammus.Tag = "vihunammus"; 130 144 Explosion rajahdys = new Explosion(60); 131 145 rajahdys.Position = botintorni.AbsolutePosition + botintorni.AbsoluteAngle.GetVector().Normalize() * 115; … … 145 159 ruudut.SetTileMethod(Color.FromHexCode("FFFF0000"), LuoBotti); 146 160 ruudut.Execute(100, 100); 147 161 Level.CreateBorders(); 148 162 149 163 } … … 166 180 void LuoOhjaimet() 167 181 { 168 Keyboard.Listen(Key.W, ButtonState.Down, Aja, null, new Vector(0, 1 200));169 Keyboard.Listen(Key.S, ButtonState.Down, Aja, null, new Vector(0, -400 ));182 Keyboard.Listen(Key.W, ButtonState.Down, Aja, null, new Vector(0, 10000)); 183 Keyboard.Listen(Key.S, ButtonState.Down, Aja, null, new Vector(0, -4000)); 170 184 Keyboard.Listen(Key.A, ButtonState.Down, Kaanny, null, 1); 171 185 Keyboard.Listen(Key.D, ButtonState.Down, Kaanny, null, -1); … … 173 187 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, AmmuTykilla, "Ammu", torni); 174 188 Mouse.ListenMovement(0.1, TorninLiike, "Käännä tornia"); 175 176 177 189 178 190 } … … 184 196 { 185 197 ammus.Size *= 1; 186 tykki.FireRate = 10;198 tykki.FireRate = 2; 187 199 Explosion rajahdys = new Explosion(60); 188 200 rajahdys.Position = torni.AbsolutePosition + torni.AbsoluteAngle.GetVector().Normalize() * 95; 189 201 rajahdys.Speed = 500; 190 202 rajahdys.UseShockWave = false; 203 ammus.Tag = "ammus1"; 191 204 Add(rajahdys); 192 205 } … … 196 209 { 197 210 ammus.Destroy(); 198 kohde.Destroy();199 211 200 212 } -
2016/26/JonniN/TankHero/TankHero/TankHero/obj/x86/Debug/ContentPipeline-{B903E94D-9570-46DD-8789-F8147DB1F21B}.xml
r7616 r7630 9 9 <Options>None</Options> 10 10 <Output>C:\MyTemp\JonniN\TankHero\TankHero\TankHero\bin\x86\Debug\Content\leopard2a4.xnb</Output> 11 <Time>2016-0 6-29T14:21:18.7737873+03:00</Time>11 <Time>2016-07-01T12:39:51.2551496+03:00</Time> 12 12 </Item> 13 13 <Item> … … 37 37 <Options>None</Options> 38 38 <Output>C:\MyTemp\JonniN\TankHero\TankHero\TankHero\bin\x86\Debug\Content\kartta.xnb</Output> 39 <Time>2016-07-01T1 0:20:41.4796844+03:00</Time>39 <Time>2016-07-01T13:04:43.0351496+03:00</Time> 40 40 </Item> 41 41 <Item> … … 46 46 <Options>None</Options> 47 47 <Output>C:\MyTemp\JonniN\TankHero\TankHero\TankHero\bin\x86\Debug\Content\puu.xnb</Output> 48 <Time>2016-0 6-30T10:33:13.7038918+03:00</Time>48 <Time>2016-07-01T12:10:38.0998496+03:00</Time> 49 49 </Item> 50 50 <Item> … … 73 73 <Options>None</Options> 74 74 <Output>C:\MyTemp\JonniN\TankHero\TankHero\TankHero\bin\x86\Debug\Content\t90runko.xnb</Output> 75 <Time>2016-07-01T 09:29:34.1798844+03:00</Time>75 <Time>2016-07-01T12:48:06.9049496+03:00</Time> 76 76 </Item> 77 77 <BuildSuccessful>true</BuildSuccessful> -
2016/26/JonniN/TankHero/TankHero/TankHeroContent/TankHeroContent.contentproj
r7616 r7630 46 46 </ItemGroup> 47 47 <ItemGroup> 48 <Compile Include="leopard2a4.png">49 <Name>leopard2a4</Name>50 <Importer>TextureImporter</Importer>51 <Processor>TextureProcessor</Processor>52 </Compile>53 </ItemGroup>54 <ItemGroup>55 48 <Compile Include="684240_Zound---Metallic.mp3"> 56 49 <Name>684240_Zound---Metallic</Name> … … 74 67 </ItemGroup> 75 68 <ItemGroup> 69 <Compile Include="hiekka.png"> 70 <Name>hiekka</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="t90torni.png"> 77 <Name>t90torni</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 82 <ItemGroup> 76 83 <Compile Include="puu.png"> 77 84 <Name>puu</Name> … … 81 88 </ItemGroup> 82 89 <ItemGroup> 83 <Compile Include=" hiekka.png">84 <Name> hiekka</Name>90 <Compile Include="leopard2a4.png"> 91 <Name>leopard2a4</Name> 85 92 <Importer>TextureImporter</Importer> 86 93 <Processor>TextureProcessor</Processor> … … 90 97 <Compile Include="t90runko.png"> 91 98 <Name>t90runko</Name> 92 <Importer>TextureImporter</Importer>93 <Processor>TextureProcessor</Processor>94 </Compile>95 </ItemGroup>96 <ItemGroup>97 <Compile Include="t90torni.png">98 <Name>t90torni</Name>99 99 <Importer>TextureImporter</Importer> 100 100 <Processor>TextureProcessor</Processor>
Note: See TracChangeset
for help on using the changeset viewer.