Changeset 8910
- Timestamp:
- 2017-07-05 11:24:01 (5 years ago)
- Location:
- 2017/27/EinoS/FireFight_Demo
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/27/EinoS/FireFight_Demo/FireFight_Demo/FireFight_Demo/FireFight_Demo.cs
r8906 r8910 18 18 PhysicsObject ylareuna; 19 19 PhysicsObject ammus; 20 Image pelaaja1kuva = LoadImage("PlayerPrototype"); 20 Image pelaaja1kuva = LoadImage("IdleBO1"); 21 Image pelaaja2kuva = LoadImage("IdleRO1"); 21 22 int kenttanro = 1; 22 23 int pelaaja1hypyt = 1; … … 27 28 public override void Begin() 28 29 { 30 ClearAll(); 29 31 if(alkuvalikkoKayty == false) 30 32 { 31 33 ValikkoTausta(); 32 MultiSelectWindow alkuvalikko = new MultiSelectWindow(" FireFight Demo", "Aloita peli", "Lopeta");34 MultiSelectWindow alkuvalikko = new MultiSelectWindow("", "Aloita peli", "Lopeta"); 33 35 alkuvalikko.AddItemHandler(0, delegate { 34 36 AloitaPeli(kenttanro); … … 84 86 void Kamera() 85 87 { 86 Camera.ZoomToLevel(); 87 88 Camera.ZoomFactor = 1; 89 Camera.Follow(pelaaja1, pelaaja2); 90 Camera.StayInLevel = true; 88 91 } 89 92 void Luokentta(int kenttanro) … … 102 105 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 103 106 alareuna = Level.CreateBottomBorder(1, false); 107 alareuna.Tag = "alareuna"; 104 108 ylareuna = Level.CreateTopBorder(1, false); 109 ylareuna.Tag = "ylareuna"; 105 110 Level.CreateHorizontalBorders(1, false, Color.Azure); 106 111 } … … 114 119 Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja2, nopeus); 115 120 Keyboard.Listen(Key.S, ButtonState.Pressed, Hyppaa, "Pelaaja laskeutuu", pelaaja2, -nopeus); 116 Keyboard.Listen(Key.A, ButtonState.Pressed, Liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus); 117 Keyboard.Listen(Key.D, ButtonState.Pressed, Liikuta, "Liikkuu oikealle", pelaaja2, nopeus); 121 Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus); 122 Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Liikkuu oikealle", pelaaja2, nopeus); 123 Keyboard.Listen(Key.LeftShift, ButtonState.Pressed, Pelaaja2Ammu, "Ampuu aseella", pelaaja2); 118 124 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 119 125 } … … 133 139 { 134 140 ammus = new PhysicsObject(8, 8, Shape.Circle); 135 ammus.X = pelaaja1.X + 50;141 ammus.X = pelaaja1.X - 80; 136 142 ammus.Y = pelaaja1.Y + 73; 137 143 ammus.Color = Color.Black; 138 144 ammus.IgnoresGravity = true; 139 145 ammus.IgnoresCollisionWith(ammus); 146 ammus.IgnoresCollisionResponse = true; 140 147 ammus.Tag = "9mm"; 141 ammus.Mass = 0. 05;142 AddCollisionHandler(ammus, AmmusTuhoutuu);148 ammus.Mass = 0.1; 149 //AddCollisionHandler(ammus, AmmusTuhoutuu); 143 150 Add(ammus); 144 151 145 Vector vauhti = new Vector( 100, 0);152 Vector vauhti = new Vector(-70, 0); 146 153 ammus.Hit(vauhti); 147 154 } 155 void Pelaaja2Ammu(PlatformCharacter pelaaja) 156 { 157 ammus = new PhysicsObject(8, 8, Shape.Circle); 158 ammus.X = pelaaja2.X + 80; 159 ammus.Y = pelaaja2.Y + 73; 160 ammus.Color = Color.Black; 161 ammus.IgnoresGravity = true; 162 ammus.IgnoresCollisionWith(ammus); 163 ammus.IgnoresCollisionResponse = true; 164 ammus.Tag = "9mm"; 165 ammus.Mass = 0.1; 166 //AddCollisionHandler(ammus, AmmusTuhoutuu); 167 Add(ammus); 168 169 Vector vauhti = new Vector(70, 0); 170 ammus.Hit(vauhti); 171 172 } 148 173 void AmmusTuhoutuu(PhysicsObject ammus, PhysicsObject kohde) 149 174 { 150 if(ammus.Body == taso.Body)151 {152 ammus.Destroy();153 154 }175 Explosion ammusrajahdys = new Explosion(25); 176 ammusrajahdys.Position = ammus.Position; 177 Add(ammusrajahdys); 178 ammus.Destroy(); 179 155 180 } 156 181 void Liikuta(PlatformCharacter hahmo, double nopeus) … … 186 211 void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 187 212 { 188 pelaaja1 = new PlatformCharacter( 183, 284.5);213 pelaaja1 = new PlatformCharacter(244, 284.5); 189 214 pelaaja1.Position = paikka; 190 215 pelaaja1.Mass = 3.0; 191 216 AddCollisionHandler(pelaaja1, "taso", TuplaHyppy); 217 AddCollisionHandler(pelaaja1, "alareuna", Pelaaja1Kuolee); 192 218 pelaaja1.MaintainMomentum = true; 193 219 pelaaja1.Tag = "pelaaja1"; … … 199 225 void LisaaToinenPelaaja(Vector paikka, double leveys, double korkeus) 200 226 { 201 pelaaja2 = new PlatformCharacter( 183, 284.5);227 pelaaja2 = new PlatformCharacter(244, 284.5); 202 228 pelaaja2.Position = paikka; 203 229 pelaaja2.Mass = 3.0; 204 230 AddCollisionHandler(pelaaja2, "taso", TuplaHyppy); 231 AddCollisionHandler(pelaaja2, "alareuna", Pelaaja2Kuolee); 205 232 pelaaja2.MaintainMomentum = true; 206 233 pelaaja2.Tag = "pelaaja2"; 207 pelaaja2.Image = pelaaja 1kuva;234 pelaaja2.Image = pelaaja2kuva; 208 235 Add(pelaaja2); 209 236 … … 227 254 228 255 } 256 void Pelaaja1Kuolee(PhysicsObject pelaaja, PhysicsObject pohja) 257 { 258 pelaaja.Destroy(); 259 Pelaaja2Voittaa(); 260 Timer.SingleShot(2, StopAll); 261 } 262 void Pelaaja2Kuolee(PhysicsObject pelaaja, PhysicsObject pohja) 263 { 264 pelaaja.Destroy(); 265 Pelaaja1Voittaa(); 266 Timer.SingleShot(2, StopAll); 267 } 268 void Pelaaja1Voittaa() 269 { 270 MultiSelectWindow voittoikkuna = new MultiSelectWindow("Sininen voittaa", "Uudestaan", "Poistu"); 271 voittoikkuna.AddItemHandler(0, delegate 272 { 273 AloitaPeli(kenttanro); 274 }); 275 voittoikkuna.AddItemHandler(1, delegate 276 { 277 alkuvalikkoKayty = false; 278 Begin(); 279 }); 280 voittoikkuna.Color = Color.BloodRed; 281 voittoikkuna.Shape = Shape.Octagon; 282 Add(voittoikkuna); 283 } 284 void Pelaaja2Voittaa() 285 { 286 287 } 229 288 } -
2017/27/EinoS/FireFight_Demo/FireFight_Demo/FireFight_Demo/FireFight_Demo.csproj.Debug.cachefile
r8891 r8910 1 1 Content\1.xnb 2 2 Content\PlayerPrototype.xnb 3 Content\IdleBO1.xnb 4 Content\IdleRO1.xnb -
2017/27/EinoS/FireFight_Demo/FireFight_Demo/FireFight_Demo/obj/x86/Debug/ContentPipeline-{3BA35D07-BDD1-435A-9851-B5DBFA346F1D}.xml
r8906 r8910 9 9 <Options>None</Options> 10 10 <Output>C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\1.xnb</Output> 11 <Time>2017-07-05T1 0:07:32.3709378+03:00</Time>11 <Time>2017-07-05T11:12:00.7513209+03:00</Time> 12 12 </Item> 13 13 <Item> … … 19 19 <Output>C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\PlayerPrototype.xnb</Output> 20 20 <Time>2017-07-05T09:31:15.4993094+03:00</Time> 21 </Item> 22 <Item> 23 <Source>IdleBO1.png</Source> 24 <Name>IdleBO1</Name> 25 <Importer>TextureImporter</Importer> 26 <Processor>TextureProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\IdleBO1.xnb</Output> 29 <Time>2017-07-05T09:31:15.1514834+03:00</Time> 30 </Item> 31 <Item> 32 <Source>IdleRO1.png</Source> 33 <Name>IdleRO1</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\IdleRO1.xnb</Output> 38 <Time>2017-07-05T09:31:16.6987094+03:00</Time> 21 39 </Item> 22 40 <BuildSuccessful>true</BuildSuccessful> -
2017/27/EinoS/FireFight_Demo/FireFight_Demo/FireFight_Demo/obj/x86/Debug/FireFight_Demo.csproj.FileListAbsolute.txt
r8891 r8910 9 9 C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\1.xnb 10 10 C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\PlayerPrototype.xnb 11 C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\IdleBO1.xnb 12 C:\MyTemp\EinoS\FireFight_Demo\FireFight_Demo\FireFight_Demo\bin\x86\Debug\Content\IdleRO1.xnb -
2017/27/EinoS/FireFight_Demo/FireFight_Demo/FireFight_Demo/obj/x86/Debug/cachefile-{3BA35D07-BDD1-435A-9851-B5DBFA346F1D}-targetpath.txt
r8891 r8910 1 1 Content\1.xnb 2 2 Content\PlayerPrototype.xnb 3 Content\IdleBO1.xnb 4 Content\IdleRO1.xnb -
2017/27/EinoS/FireFight_Demo/FireFight_Demo/FireFight_DemoContent/1.txt
r8906 r8910 21 21 ........................................ 22 22 ........................................ 23 ........................................ 24 ........................................ 25 ........................................ -
2017/27/EinoS/FireFight_Demo/FireFight_Demo/FireFight_DemoContent/FireFight_DemoContent.contentproj
r8891 r8910 59 59 </Compile> 60 60 </ItemGroup> 61 <ItemGroup> 62 <Compile Include="IdleBO1.png"> 63 <Name>IdleBO1</Name> 64 <Importer>TextureImporter</Importer> 65 <Processor>TextureProcessor</Processor> 66 </Compile> 67 <Compile Include="IdleRO1.png"> 68 <Name>IdleRO1</Name> 69 <Importer>TextureImporter</Importer> 70 <Processor>TextureProcessor</Processor> 71 </Compile> 72 </ItemGroup> 61 73 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 62 74 <!-- 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.