- Timestamp:
- 2015-07-02 11:38:53 (4 years ago)
- Location:
- 2015/27/MiroS/Raiskintapeli
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/TankkiPeli.cs
r6687 r6731 11 11 Image tankkikuva = LoadImage("Tankki"); 12 12 Image Vihulainen = LoadImage("Vihulainen"); 13 Image rajahdys = LoadImage("Rajahdys"); 14 Image pommi1 = LoadImage("Pommi"); 13 15 14 16 PhysicsObject tankki; … … 18 20 19 21 //IsFullScreen = true; 22 23 Level.Background.Color = Color.Black; 20 24 21 25 Level.Width = Screen.Width; … … 48 52 vihu.CanRotate = false; 49 53 Add(vihu); 50 54 55 RandomMoverBrain aivot = new RandomMoverBrain(); 56 aivot.WanderRadius = 200.0; 57 aivot.ChangeMovementSeconds = 2.0; 58 vihu.Brain = aivot; 59 60 AssaultRifle vihunAse = new AssaultRifle(20.0, 20.0); 61 vihunAse.ProjectileCollision = AmmusOsui; 62 vihunAse.IsVisible = false; 63 vihu.Add(vihunAse); 64 65 Timer vihunAjastin = new Timer(); 66 vihunAjastin.Interval = 1.0; 67 vihunAjastin.Timeout += delegate { VihuAmpuu(vihunAse); }; 68 vihunAjastin.Start(); 69 70 } 71 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 72 { 73 ammus.Destroy(); 51 74 } 52 75 53 76 void JättääPommin(PhysicsObject tankki) 54 77 { 55 PhysicsObject pommi = new PhysicsObject( 15.0, 15.0);78 PhysicsObject pommi = new PhysicsObject(30.0, 30.0); 56 79 pommi.Position = tankki.Position; 57 80 Add(pommi); 58 pommi.Color = Color.Black; 59 pommi.CanRotate=false; 81 pommi.Color = Color.Blue; 82 pommi.CanRotate = false; 83 pommi.Image = pommi1; 60 84 Timer.SingleShot(2.0, delegate 61 85 { 62 86 pommi.Destroy(); 63 Explosion räjähdys = new Explosion(100.0); 64 räjähdys.Position = pommi.Position; 65 Add(räjähdys); 87 Explosion raj = new Explosion(300.0); 88 raj.Speed = 900.0; 89 raj.Position = pommi.Position; 90 raj.Image = rajahdys; 91 Add(raj); 66 92 }); 67 93 … … 72 98 ammus.Position = tankki.Position; 73 99 Add(ammus); 74 ammus.Color = Color. Yellow;75 ammus.Hit(tankki.Angle.GetVector()* 1000);76 Timer.SingleShot( 2.0, delegate100 ammus.Color = Color.Red; 101 ammus.Hit(tankki.Angle.GetVector()*3000); 102 Timer.SingleShot(0.70, delegate 77 103 { 78 104 ammus.Destroy(); 79 105 }); 106 80 107 81 108 } … … 90 117 { 91 118 92 Keyboard.Listen(Key.X, ButtonState.Pressed, JättääPommin, "Jättää pommin", tankki);93 Keyboard.Listen(Key.Z, ButtonState.Pressed, Ampuu, "Ampuu tykillä", tankki);119 Mouse.Listen(MouseButton.Right, ButtonState.Pressed, JättääPommin, "Jättää pommin", tankki); 120 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Ampuu, "Ampuu tykillä", tankki); 94 121 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 95 122 … … 106 133 void LiikuWASD() 107 134 { 108 tankki.Push(Vector.FromLengthAndAngle(8000, tankki.Angle)); 135 tankki.Push(Vector.FromLengthAndAngle(9000, tankki.Angle)); 136 } 137 void VihuAmpuu(AssaultRifle ase) 138 { 139 ase.AbsoluteAngle = (tankki.Position - ase.Parent.Position).Angle; 140 PhysicsObject panos=ase.Shoot(); 141 142 if(panos !=null) 143 { 144 panos.MaximumLifetime = TimeSpan.FromSeconds(1.0); 145 146 } 147 109 148 } 110 149 } -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/TankkiPeli.csproj.Debug.cachefile
r6687 r6731 1 1 Content\Tankki.xnb 2 2 Content\Vihulainen.xnb 3 Content\Rajahdys.xnb 4 Content\Pommi.xnb -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/obj/x86/Debug/ContentPipeline-{81739508-248F-43AA-A768-73E659A05863}.xml
r6687 r6731 19 19 <Output>C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Vihulainen.xnb</Output> 20 20 <Time>2015-07-01T13:52:00.884992+03:00</Time> 21 </Item> 22 <Item> 23 <Source>Rajahdys.png</Source> 24 <Name>Rajahdys</Name> 25 <Importer>TextureImporter</Importer> 26 <Processor>TextureProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Rajahdys.xnb</Output> 29 <Time>2015-07-02T10:05:25.1204149+03:00</Time> 30 </Item> 31 <Item> 32 <Source>Pommi.png</Source> 33 <Name>Pommi</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Pommi.xnb</Output> 38 <Time>2015-07-02T10:12:57.6706149+03:00</Time> 21 39 </Item> 22 40 <BuildSuccessful>true</BuildSuccessful> -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/obj/x86/Debug/TankkiPeli.csproj.FileListAbsolute.txt
r6687 r6731 9 9 C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\obj\x86\Debug\TankkiPeli.csprojResolveAssemblyReference.cache 10 10 C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Vihulainen.xnb 11 C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Rajahdys.xnb 12 C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Pommi.xnb -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/obj/x86/Debug/cachefile-{81739508-248F-43AA-A768-73E659A05863}-targetpath.txt
r6687 r6731 1 1 Content\Tankki.xnb 2 2 Content\Vihulainen.xnb 3 Content\Rajahdys.xnb 4 Content\Pommi.xnb -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/RaiskintapeliContent/TankkiPeliContent.contentproj
r6687 r6731 59 59 </Compile> 60 60 </ItemGroup> 61 <ItemGroup> 62 <Compile Include="Rajahdys.png"> 63 <Name>Rajahdys</Name> 64 <Importer>TextureImporter</Importer> 65 <Processor>TextureProcessor</Processor> 66 </Compile> 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="Pommi.png"> 70 <Name>Pommi</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 61 75 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 62 76 <!-- 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.