- Timestamp:
- 2015-07-02 14:50:17 (6 years ago)
- Location:
- 2015/27/MiroS/Raiskintapeli
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/TankkiPeli.cs
r6731 r6757 15 15 16 16 PhysicsObject tankki; 17 IntMeter healthit; 17 18 18 19 public override void Begin() … … 21 22 //IsFullScreen = true; 22 23 23 Level.Background.Color = Color.Black;24 24 25 25 26 Level.Width = Screen.Width; 26 27 Level.Height = Screen.Height; 27 Camera.ZoomToLevel();28 28 29 Level.CreateBorders();30 L isaaPelaaja();29 //Level.CreateBorders(); 30 LuoKentta(); 31 31 LisaaOhjaimet(); 32 33 Camera.Follow(tankki); 34 32 35 LuoMappi(1); 33 36 } 34 void LisaaPelaaja( )37 void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 35 38 { 36 37 tankki = new PhysicsObject(50.0, 50.0); 38 tankki.X = -1.0; 39 tankki.Y = -300.0; 39 tankki = new PhysicsObject(50, 50); 40 tankki.Position = paikka; 40 41 tankki.Image = tankkikuva; 41 42 tankki.LinearDamping = 0.1; 42 43 tankki.AngularDamping = 0.1; 44 healthit = new IntMeter(400, 0, 400); 45 healthit.LowerLimit += delegate { 46 tankki.Destroy(); 47 ClearControls(); 48 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 49 }; 43 50 Add(tankki); 44 45 51 } 46 52 … … 55 61 RandomMoverBrain aivot = new RandomMoverBrain(); 56 62 aivot.WanderRadius = 200.0; 57 aivot.ChangeMovementSeconds = 2.0;63 aivot.ChangeMovementSeconds = 40.0; 58 64 vihu.Brain = aivot; 59 65 … … 68 74 vihunAjastin.Start(); 69 75 76 healthit = new IntMeter(40, 0, 40); 77 healthit.LowerLimit += delegate { 78 vihu.Destroy(); 79 ClearControls(); 80 70 81 } 71 82 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 72 83 { 73 84 ammus.Destroy(); 85 if (kohde == tankki) 86 { 87 healthit.Value -= 50; 88 } 89 74 90 } 75 91 … … 95 111 void Ampuu(PhysicsObject tankki) 96 112 { 97 PhysicsObject ammus = new PhysicsObject( 5.0, 5.0);113 PhysicsObject ammus = new PhysicsObject(9.0, 9.0); 98 114 ammus.Position = tankki.Position; 99 115 Add(ammus); 100 ammus.Color = Color. Red;116 ammus.Color = Color.Yellow; 101 117 ammus.Hit(tankki.Angle.GetVector()*3000); 102 Timer.SingleShot(0.70, delegate 103 { 104 ammus.Destroy(); 105 }); 118 Timer.SingleShot(0.50, delegate 119 { 120 ammus.Destroy(); 121 122 }); 123 106 124 107 125 … … 128 146 { 129 147 tankki.Angle = (Mouse.PositionOnWorld - tankki.Position).Angle; 130 131 132 148 } 133 149 void LiikuWASD() … … 147 163 148 164 } 165 void LuoKentta() 166 { 167 ColorTileMap kentta = ColorTileMap.FromLevelAsset("kentta1"); 168 169 kentta.SetTileMethod(Color.Black, LuoSeina); 170 kentta.SetTileMethod(Color.FromHexCode("4CFF00"), LisaaPelaaja); 171 172 kentta.Execute(20, 20); 173 174 175 176 Level.Background.Color = Color.Black; 177 178 179 } 180 void LuoSeina(Vector paikka, double leveys, double korkeus) 181 { 182 PhysicsObject seina = PhysicsObject.CreateStaticObject(leveys, korkeus); 183 seina.Position = paikka; 184 Add(seina); 185 } 149 186 } -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/TankkiPeli.csproj.Debug.cachefile
r6731 r6757 3 3 Content\Rajahdys.xnb 4 4 Content\Pommi.xnb 5 Content\kentta1.xnb -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/obj/x86/Debug/ContentPipeline-{81739508-248F-43AA-A768-73E659A05863}.xml
r6731 r6757 37 37 <Output>C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Pommi.xnb</Output> 38 38 <Time>2015-07-02T10:12:57.6706149+03:00</Time> 39 </Item> 40 <Item> 41 <Source>kentta1.png</Source> 42 <Name>kentta1</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\kentta1.xnb</Output> 47 <Time>2015-07-02T14:34:55.6913156+03:00</Time> 39 48 </Item> 40 49 <BuildSuccessful>true</BuildSuccessful> -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/obj/x86/Debug/TankkiPeli.csproj.FileListAbsolute.txt
r6731 r6757 11 11 C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Rajahdys.xnb 12 12 C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\Pommi.xnb 13 C:\MyTemp\MiroS\Raiskintapeli\Raiskintapeli\Raiskintapeli\bin\x86\Debug\Content\kentta1.xnb -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/Raiskintapeli/obj/x86/Debug/cachefile-{81739508-248F-43AA-A768-73E659A05863}-targetpath.txt
r6731 r6757 3 3 Content\Rajahdys.xnb 4 4 Content\Pommi.xnb 5 Content\kentta1.xnb -
2015/27/MiroS/Raiskintapeli/Raiskintapeli/RaiskintapeliContent/TankkiPeliContent.contentproj
r6731 r6757 73 73 </Compile> 74 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="kentta1.png"> 77 <Name>kentta1</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 75 82 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 76 83 <!-- 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.