- Timestamp:
- 2015-07-02 14:45:03 (7 years ago)
- Location:
- 2015/27/JesseS
- Files:
-
- 31 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/JesseS/VoltsTank/VoltsTank/VoltsTank/VoltsTank.cs
r6733 r6753 11 11 AssaultRifle pelaajan1Ase; 12 12 AssaultRifle pelaajan2Ase; 13 AssaultRifle pelaajan3Ase; 13 14 PhysicsObject pelaaja1; 14 15 PhysicsObject pelaaja2; 16 PhysicsObject pelaaja3; 15 17 16 18 DoubleMeter pelaajan1Health; 17 19 DoubleMeter pelaajan2Health; 20 DoubleMeter pelaajan3Health; 18 21 19 22 Image ammuksenKuva = LoadImage("Ammus"); … … 21 24 Image pelaaja1tank = LoadImage("pelaaja1tank"); 22 25 Image pelaaja2tank = LoadImage("pelaaja2tank"); 23 24 double maxNopeus = 1500.0; 26 Image pelaaja3tank = LoadImage("pelaaja3tank"); 27 28 Image taustakuva = LoadImage("taustakuva"); 29 30 double maxNopeus = 2000.0; 31 int pelaajienMaara = 3; 25 32 26 33 public override void Begin() 27 34 { 28 IsFullScreen = true;29 35 30 36 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Quit game"); 31 37 ControllerOne.Listen(Button.Back, ButtonState.Pressed, ConfirmExit, "Quit game"); 32 38 33 34 39 40 IsFullScreen = true; 35 41 MultiSelectWindow alkuValikko = new MultiSelectWindow("VoltsTank", 36 42 "Play", "Quit game"); … … 41 47 42 48 43 49 44 50 } 45 51 … … 47 53 { 48 54 ClearAll(); 49 LuoPelaaja1();50 Luo Pelaaja2();55 IsFullScreen = true; 56 LuoKentta(); 51 57 52 58 ControllerOne.ListenAnalog(AnalogControl.LeftStick, 0.1, … … 67 73 ControllerTwo.Listen(Button.LeftTrigger, ButtonState.Down, AmmuAseella, "Ammu", pelaajan2Ase); 68 74 69 //ControllerTwo.Listen(Button.RightTrigger, ButtonState.Down, AmmuAseella, "Ammu", pelaajan2Ase); 70 //ControllerTwo.Listen(Button.LeftTrigger, ButtonState.Down, AmmuAseella, "Ammu", pelaajan2Ase); 75 ControllerThree.Listen(Button.RightTrigger, ButtonState.Down, AmmuAseella, "Ammu", pelaajan3Ase); 76 ControllerThree.Listen(Button.LeftTrigger, ButtonState.Down, AmmuAseella, "Ammu", pelaajan3Ase); 77 78 ControllerThree.ListenAnalog(AnalogControl.LeftStick, 0.1, 79 LiikutaPelaajaa, "Liikuta pelaajaa tattia pyörittämällä.", pelaaja3); 80 81 ControllerThree.ListenAnalog(AnalogControl.RightTrigger, 0.1, 82 AmmuTykilla, "Käytä oikeaa liipasinta ampumisen tavoin.", pelaaja3); 83 71 84 } 72 85 … … 81 94 double liipasimenAsento = liipasimenTila.State; 82 95 } 83 void LuoPelaaja1() 84 { 85 86 pelaaja1 = new PhysicsObject(40, 40); 87 pelaaja1.LinearDamping = 0.1; 88 pelaaja1.AngularDamping = 0.1; 89 Add(pelaaja1); 90 91 pelaaja1.Image = pelaaja1tank; 96 void LuoPelaaja1(Vector paikka, double leveys, double korkeus) 97 { 98 pelaaja1 = LuoPelaaja(paikka, leveys, korkeus, pelaaja1tank); 92 99 93 100 pelaajan1Ase = new AssaultRifle(30, 10); … … 99 106 100 107 pelaajan1Health = new DoubleMeter(100, 0, 100); 101 pelaajan1Health.LowerLimit += delegate { 108 pelaajan1Health.LowerLimit += delegate 109 { 102 110 pelaajan1Ase.Ammo.Value = 0; 103 111 pelaajan1Ase.Destroy(); 104 112 pelaajienMaara--; 105 113 Explosion rajahdys = new Explosion(200); 106 114 rajahdys.Position = pelaaja1.Position; … … 108 116 109 117 pelaaja1.Destroy(); 110 LoppuValikko(); 111 118 if (pelaajienMaara < 2) 119 LoppuValikko(); 120 112 121 }; 113 122 } 114 void LuoPelaaja2() 115 { 116 pelaaja2 = new PhysicsObject(40, 40); 117 pelaaja2.LinearDamping = 0.1; 118 pelaaja2.AngularDamping = 0.1; 119 Add(pelaaja2); 120 121 pelaaja2.Image = pelaaja2tank; 123 void LuoPelaaja2(Vector paikka, Double leveys, Double korkeus) 124 { 125 pelaaja2 = LuoPelaaja(paikka, leveys, korkeus, pelaaja2tank); 122 126 123 127 pelaajan2Ase = new AssaultRifle(30, 10); 128 pelaajan2Ase.Ammo.Value = 1000; 124 129 pelaajan2Ase.ProjectileCollision = AmmusOsui; 125 130 pelaajan2Ase.IsVisible = false; 126 131 127 132 pelaaja2.Add(pelaajan2Ase); 128 133 … … 132 137 pelaajan2Ase.Ammo.Value = 0; 133 138 pelaajan2Ase.Destroy(); 134 139 pelaajienMaara--; 135 140 Explosion rajahdys = new Explosion(200); 136 rajahdys.Position = pelaaja 2.Position;141 rajahdys.Position = pelaaja1.Position; 137 142 Add(rajahdys); 138 pelaaja2.Destroy(); 139 LoppuValikko(); 143 144 pelaaja1.Destroy(); 145 if (pelaajienMaara < 2) 146 LoppuValikko(); 147 140 148 }; 141 149 } 150 void LuoPelaaja3(Vector paikka, Double leveys, Double korkeus) 151 { 152 pelaaja3 = LuoPelaaja(paikka, leveys, korkeus, pelaaja3tank); 153 154 pelaajan3Ase = new AssaultRifle(30, 10); 155 pelaajan3Ase.Ammo.Value = 1000; 156 pelaajan3Ase.ProjectileCollision = AmmusOsui; 157 pelaajan3Ase.IsVisible = false; 158 159 pelaaja3.Add(pelaajan3Ase); 160 161 pelaajan3Health = new DoubleMeter(100, 0, 100); 162 pelaajan3Health.LowerLimit += delegate 163 { 164 pelaajan3Ase.Ammo.Value = 0; 165 pelaajan3Ase.Destroy(); 166 pelaajienMaara--; 167 Explosion rajahdys = new Explosion(200); 168 rajahdys.Position = pelaaja3.Position; 169 Add(rajahdys); 170 171 pelaaja3.Destroy(); 172 if (pelaajienMaara < 2) 173 LoppuValikko(); 174 175 }; 176 } 177 178 PhysicsObject LuoPelaaja(Vector paikka, double leveys, double korkeus, Image kuva) 179 { 180 181 PhysicsObject pelaaja1 = new PhysicsObject(leveys, korkeus); 182 pelaaja1.LinearDamping = 0.1; 183 pelaaja1.AngularDamping = 0.1; 184 Add(pelaaja1); 185 186 pelaaja1.Image = kuva; 187 188 pelaaja1.Position = paikka; 189 190 191 return pelaaja1; 192 } 142 193 143 194 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 144 195 { 145 196 ammus.Destroy(); 146 if (kohde == pelaaja1) 197 if (kohde == pelaaja1) 147 198 { 148 199 pelaajan1Health.Value -= 20; … … 151 202 { 152 203 pelaajan2Health.Value -= 20; 204 } 205 else if (kohde == pelaaja3) 206 { 207 208 pelaajan3Health.Value -= 20; 153 209 } 154 210 } … … 180 236 181 237 } 238 void LuoKentta() 239 { 240 TileMap ruudut = TileMap.FromLevelAsset("Map1"); 241 ruudut.SetTileMethod('#', LuoPalikka); 242 ruudut.SetTileMethod('1', LuoPelaaja1); 243 ruudut.SetTileMethod('2', LuoPelaaja2); 244 ruudut.SetTileMethod('3', LuoPelaaja3); 245 246 ruudut.Execute(40, 40); 247 Camera.ZoomToLevel(); 248 249 //GameObject kehys = new GameObject(taustakuva); 250 //kehys.Width = 3000; 251 //kehys.Height = Screen.Height; 252 //Add(kehys, -3); 253 254 Level.Background.Color = Color.Aqua; 255 256 } 257 void LuoPalikka(Vector paikka, double leveys, double korkeus) 258 { 259 PhysicsObject palikka = PhysicsObject.CreateStaticObject(leveys, korkeus); 260 palikka.Position = paikka; 261 palikka.Color = Color.Black; 262 Add(palikka); 263 264 } 265 266 182 267 } -
2015/27/JesseS/VoltsTank/VoltsTank/VoltsTank/VoltsTank.csproj.Debug.cachefile
r6724 r6753 2 2 Content\Pelaaja1Tank.xnb 3 3 Content\Pelaaja2Tank.xnb 4 Content\Map1.xnb 5 Content\taustakuva.xnb 6 Content\pelaaja3tank.xnb 7 Content\Map1.txt -
2015/27/JesseS/VoltsTank/VoltsTank/VoltsTank/obj/x86/Debug/ContentPipeline-{2F24256F-9E1A-4769-8E9A-3FFC69AEE13C}.xml
r6724 r6753 28 28 <Output>C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\Pelaaja2Tank.xnb</Output> 29 29 <Time>2015-07-02T10:01:46.3373237+03:00</Time> 30 </Item> 31 <Item> 32 <Source>Map1.txt</Source> 33 <Name>Map1</Name> 34 <Importer>TextFileImporter</Importer> 35 <Processor>TextFileContentProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\Map1.xnb</Output> 38 <Time>2015-07-02T14:00:33.9370237+03:00</Time> 39 </Item> 40 <Item> 41 <Source>taustakuva.png</Source> 42 <Name>taustakuva</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\taustakuva.xnb</Output> 47 <Time>2015-07-02T13:07:16.1524237+03:00</Time> 48 </Item> 49 <Item> 50 <Source>pelaaja3tank.png</Source> 51 <Name>pelaaja3tank</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\pelaaja3tank.xnb</Output> 56 <Time>2015-07-02T14:31:32.9222237+03:00</Time> 30 57 </Item> 31 58 <BuildSuccessful>true</BuildSuccessful> -
2015/27/JesseS/VoltsTank/VoltsTank/VoltsTank/obj/x86/Debug/VoltsTank.csproj.FileListAbsolute.txt
r6724 r6753 10 10 C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\Pelaaja1Tank.xnb 11 11 C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\Pelaaja2Tank.xnb 12 C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\Map1.xnb 13 C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\Map1.txt 14 C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\taustakuva.xnb 15 C:\MyTemp\JesseS\VoltsTank\VoltsTank\VoltsTank\bin\x86\Debug\Content\pelaaja3tank.xnb -
2015/27/JesseS/VoltsTank/VoltsTank/VoltsTank/obj/x86/Debug/cachefile-{2F24256F-9E1A-4769-8E9A-3FFC69AEE13C}-targetpath.txt
r6724 r6753 2 2 Content\Pelaaja1Tank.xnb 3 3 Content\Pelaaja2Tank.xnb 4 Content\Map1.xnb 5 Content\taustakuva.xnb 6 Content\pelaaja3tank.xnb 7 Content\Map1.txt -
2015/27/JesseS/VoltsTank/VoltsTank/VoltsTankContent/VoltsTankContent.contentproj
r6724 r6753 66 66 </Compile> 67 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="Map1.txt"> 70 <Name>Map1</Name> 71 <Importer>TextFileImporter</Importer> 72 <Processor>TextFileContentProcessor</Processor> 73 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 74 </Compile> 75 </ItemGroup> 76 <ItemGroup> 77 <Compile Include="taustakuva.png"> 78 <Name>taustakuva</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 </Compile> 82 </ItemGroup> 83 <ItemGroup> 84 <Compile Include="pelaaja3tank.png"> 85 <Name>pelaaja3tank</Name> 86 <Importer>TextureImporter</Importer> 87 <Processor>TextureProcessor</Processor> 88 </Compile> 89 </ItemGroup> 68 90 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 69 91 <!-- 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.