- Timestamp:
- 2015-06-25 15:02:09 (7 years ago)
- Location:
- 2015/26/SanteriP
- Files:
-
- 19 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/26/SanteriP/gunmayhem/gunmayhem/gunmayhem/gunmayhem.cs
r6266 r6378 9 9 public class gunmayhem : PhysicsGame 10 10 { 11 const double nopeus = 2 00;11 const double nopeus = 250; 12 12 const double hyppyNopeus = 800; 13 13 const int RUUDUN_KOKO = 40; 14 14 15 PlatformCharacter pelaaja1;16 PlatformCharacter pelaaja2;15 PlatformCharacter2 pelaaja1; 16 PlatformCharacter2 pelaaja2; 17 17 IntMeter pisteLaskuri1; 18 18 IntMeter pisteLaskuri2; … … 26 26 Image tahtiKuva = LoadImage("tahti"); 27 27 Image ruohokuva = LoadImage("ruoho"); 28 Image pommikuva = LoadImage(" pommi");28 Image pommikuva = LoadImage("tramppa"); 29 29 Image pilvikuva = LoadImage("pilvi"); 30 Image tiilikuva = LoadImage("tiili3"); 31 Image arkkukuva = LoadImage("arkku"); 30 32 SoundEffect maaliAani = LoadSoundEffect("maali"); 33 SoundEffect aseaani = LoadSoundEffect("aseaani"); 34 SoundEffect pomppuaani = LoadSoundEffect("pomppuaani"); 35 SoundEffect kranaattiaani = LoadSoundEffect("kranaattiaani"); 31 36 32 37 public override void Begin() … … 41 46 pisteLaskuri2 = LuoPistelaskuri(Screen.Left + 100); 42 47 43 Camera.Follow(pelaaja1, pelaaja2);48 Camera.Follow(pelaaja1, pelaaja2); 44 49 Camera.ZoomFactor = 1.2; 45 50 Camera.StayInLevel = true; … … 73 78 kentta.SetTileMethod('"', Lisaapohja); 74 79 kentta.SetTileMethod('/', lisaapilvi); 80 kentta.SetTileMethod('¤', Lisaaarkku); 75 81 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 76 Level.CreateBorders();77 82 Level.Background.CreateGradient(Color.Gray, Color.Blue); 78 83 } … … 82 87 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 83 88 taso.Position = paikka; 84 taso.Image = ruohokuva;89 taso.Image = tiilikuva; 85 90 Add(taso); 86 91 } … … 88 93 void lisaapilvi(Vector paikka, double leveys, double korkeus) 89 94 { 90 PhysicsObject pilvi = PhysicsObject.CreateStaticObject(leveys *4, korkeus);95 PhysicsObject pilvi = PhysicsObject.CreateStaticObject(leveys * 4, korkeus); 91 96 pilvi.Position = paikka; 92 97 pilvi.Image = pilvikuva; … … 98 103 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 99 104 taso.Position = paikka; 100 taso.IsVisible =false;105 taso.IsVisible = false; 101 106 taso.Tag = "pohja"; 102 107 Add(taso); … … 121 126 Add(tahti); 122 127 } 123 void Tiputapommi(PlatformCharacter kuka)128 void Tiputapommi(PlatformCharacter2 kuka) 124 129 { 125 130 PhysicsObject pommi = new PhysicsObject(LoadImage("pommi")); 126 pommi.Position = kuka.Position;127 131 Add(pommi); 132 133 if (kuka.FacingDirection == Direction.Right) 134 { 135 pommi.Position = kuka.Position + Vector.FromLengthAndAngle(10, Angle.FromDegrees(0)); 136 pommi.Hit(Vector.FromLengthAndAngle(700, Angle.FromDegrees(45))); 137 } 138 else 139 { 140 pommi.Position = kuka.Position + Vector.FromLengthAndAngle(10, Angle.FromDegrees(180)); 141 pommi.Hit(Vector.FromLengthAndAngle(700, Angle.FromDegrees(135))); 142 } 128 143 129 144 Timer ajastin = new Timer(); … … 132 147 { 133 148 Explosion räjähdys = new Explosion(10); 134 räjähdys.Force = 5000;135 räjähdys.Speed = 4000;149 räjähdys.Force = 3000; 150 räjähdys.Speed = 2000; 136 151 räjähdys.Position = pommi.Position; 137 152 Add(räjähdys); 138 153 räjähdys.Sound = kranaattiaani; 139 154 pommi.Destroy(); 140 155 }; … … 142 157 } 143 158 144 PlatformCharacter LisaaPelaaja(Vector paikka, double leveys, double korkeus,Image kuva)145 { 146 PlatformCharacter pelaaja = new PlatformCharacter(pelaajanKuva.Width * 1.4, pelaajanKuva.Height * 1.4);159 PlatformCharacter2 LisaaPelaaja(Vector paikka, double leveys, double korkeus, Image kuva) 160 { 161 PlatformCharacter2 pelaaja = new PlatformCharacter2(pelaajanKuva.Width * 1.4, pelaajanKuva.Height * 1.4); 147 162 pelaaja.Position = paikka; 148 163 pelaaja.Mass = 4.0; … … 162 177 } 163 178 164 void AmmuAseella(PlatformCharacter pelaaja)179 void AmmuAseella(PlatformCharacter2 pelaaja) 165 180 { 166 181 PhysicsObject ammus = pelaaja.Weapon.Shoot(); … … 168 183 if (ammus != null) 169 184 { 185 aseaani.Play(); 170 186 //ammus.Size *= 3; 171 187 //ammus.Image = ... … … 180 196 if (kohde.Tag.Equals("pelaaja")) 181 197 { 182 kohde.Velocity = ammus.Velocity*7; 198 //kohde.Velocity = ammus.Velocity*20; 199 kohde.Velocity = ammus.Velocity * 1; 183 200 } 184 201 } … … 210 227 Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 211 228 Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 212 Keyboard.Listen(Key. R, ButtonState.Down, AmmuAseella, "Ammu", pelaaja1);229 Keyboard.Listen(Key.LeftShift, ButtonState.Down, AmmuAseella, "Ammu", pelaaja1); 213 230 Keyboard.Listen(Key.S, ButtonState.Pressed, Tiputapommi, "Tiputa pommi", pelaaja1); 214 231 … … 222 239 } 223 240 224 void Liikuta(PlatformCharacter hahmo, double nopeus) 225 { 226 hahmo.Walk(nopeus); 227 } 228 229 void Hyppaa(PlatformCharacter hahmo, double nopeus) 241 void Liikuta(PlatformCharacter2 hahmo, double nopeus) 242 { 243 //hahmo.Walk(nopeus); 244 hahmo.Walk(new Vector(nopeus, 0).Angle.MainDirection); 245 } 246 247 void Hyppaa(PlatformCharacter2 hahmo, double nopeus) 230 248 { 231 249 hahmo.Jump(nopeus); … … 241 259 void Tormaapommiin(PhysicsObject hahmo, PhysicsObject pommi) 242 260 { 243 Explosion räjähdys = new Explosion(2 50);261 Explosion räjähdys = new Explosion(230); 244 262 räjähdys.Position = pommi.Position + new Vector(0, 10); 263 räjähdys.Sound = null; 245 264 Add(räjähdys); 265 pomppuaani.Play(); 246 266 } 247 267 … … 251 271 pelaaja2.Position = alkupaikka2; 252 272 253 if (hahmo == pelaaja1) 254 { 273 if (hahmo == pelaaja2 && hahmo.Tag.Equals("pelaaja")) 274 { 275 hahmo.Tag = "pelaaja_ei_pisteita"; 255 276 pisteLaskuri2.Value += 1; 256 } 257 if (hahmo == pelaaja2) 258 { 259 pisteLaskuri1 .Value += 1; 260 } 277 Timer.SingleShot(1, delegate { hahmo.Tag = "pelaaja"; }); 278 } 279 if (hahmo == pelaaja1 && hahmo.Tag.Equals("pelaaja")) 280 { 281 hahmo.Tag = "pelaaja_ei_pisteita"; 282 pisteLaskuri1.Value += 1; 283 Timer.SingleShot(1, delegate { hahmo.Tag = "pelaaja"; }); 284 } 285 286 287 288 289 } 290 291 void Lisaaarkku(Vector paikka, double leveys, double korkeus) 292 { 293 PhysicsObject arkku = PhysicsObject.CreateStaticObject(leveys, korkeus); 294 arkku.Position = paikka; 295 arkku.Image = arkkukuva; 296 Add(arkku); 297 arkku.Tag = "arkku"; 261 298 } 262 299 } -
2015/26/SanteriP/gunmayhem/gunmayhem/gunmayhem/gunmayhem.csproj.Debug.cachefile
r6266 r6378 9 9 Content\ase.xnb 10 10 Content\pilvi.xnb 11 Content\tiili.xnb 12 Content\tiili3.xnb 13 Content\tramppa.xnb 14 Content\aseaani.xnb 15 Content\pomppuaani.xnb 16 Content\kranaattiaani.xnb 17 Content\arkku.xnb -
2015/26/SanteriP/gunmayhem/gunmayhem/gunmayhem/obj/x86/Debug/ContentPipeline-{B5D35D2A-3E3E-40F5-A3F8-C04AAA7ACEBD}.xml
r6266 r6378 54 54 <Options>None</Options> 55 55 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\kentta1.xnb</Output> 56 <Time>2015-06-2 4T14:37:18.4439146+03:00</Time>56 <Time>2015-06-25T15:00:42.5510751+03:00</Time> 57 57 </Item> 58 58 <Item> … … 91 91 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\pilvi.xnb</Output> 92 92 <Time>2015-06-24T13:08:48.5621146+03:00</Time> 93 </Item> 94 <Item> 95 <Source>tiili.jpg</Source> 96 <Name>tiili</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 <Options>None</Options> 100 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\tiili.xnb</Output> 101 <Time>2015-06-25T10:08:58.3882613+03:00</Time> 102 </Item> 103 <Item> 104 <Source>tiili3.png</Source> 105 <Name>tiili3</Name> 106 <Importer>TextureImporter</Importer> 107 <Processor>TextureProcessor</Processor> 108 <Options>None</Options> 109 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\tiili3.xnb</Output> 110 <Time>2015-06-25T10:16:58.8344613+03:00</Time> 111 </Item> 112 <Item> 113 <Source>tramppa.png</Source> 114 <Name>tramppa</Name> 115 <Importer>TextureImporter</Importer> 116 <Processor>TextureProcessor</Processor> 117 <Options>None</Options> 118 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\tramppa.xnb</Output> 119 <Time>2015-06-25T10:31:07.8913613+03:00</Time> 120 </Item> 121 <Item> 122 <Source>aseaani.wav</Source> 123 <Name>aseaani</Name> 124 <Importer>WavImporter</Importer> 125 <Processor>SoundEffectProcessor</Processor> 126 <Options>None</Options> 127 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\aseaani.xnb</Output> 128 <Time>2015-06-25T11:10:22.8253613+03:00</Time> 129 </Item> 130 <Item> 131 <Source>pomppuaani.wav</Source> 132 <Name>pomppuaani</Name> 133 <Importer>WavImporter</Importer> 134 <Processor>SoundEffectProcessor</Processor> 135 <Options>None</Options> 136 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\pomppuaani.xnb</Output> 137 <Time>2015-06-25T11:15:07.1888613+03:00</Time> 138 </Item> 139 <Item> 140 <Source>kranaattiaani.wav</Source> 141 <Name>kranaattiaani</Name> 142 <Importer>WavImporter</Importer> 143 <Processor>SoundEffectProcessor</Processor> 144 <Options>None</Options> 145 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\kranaattiaani.xnb</Output> 146 <Time>2015-06-25T11:24:20.1238613+03:00</Time> 147 </Item> 148 <Item> 149 <Source>arkku.png</Source> 150 <Name>arkku</Name> 151 <Importer>TextureImporter</Importer> 152 <Processor>TextureProcessor</Processor> 153 <Options>None</Options> 154 <Output>C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\arkku.xnb</Output> 155 <Time>2015-06-25T14:40:52.2736751+03:00</Time> 93 156 </Item> 94 157 <BuildSuccessful>true</BuildSuccessful> -
2015/26/SanteriP/gunmayhem/gunmayhem/gunmayhem/obj/x86/Debug/cachefile-{B5D35D2A-3E3E-40F5-A3F8-C04AAA7ACEBD}-targetpath.txt
r6266 r6378 9 9 Content\ase.xnb 10 10 Content\pilvi.xnb 11 Content\tiili.xnb 12 Content\tiili3.xnb 13 Content\tramppa.xnb 14 Content\aseaani.xnb 15 Content\pomppuaani.xnb 16 Content\kranaattiaani.xnb 17 Content\arkku.xnb -
2015/26/SanteriP/gunmayhem/gunmayhem/gunmayhem/obj/x86/Debug/gunmayhem.csproj.FileListAbsolute.txt
r6266 r6378 17 17 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\ase.xnb 18 18 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\pilvi.xnb 19 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\tiili.xnb 20 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\tiili3.xnb 21 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\tramppa.xnb 22 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\aseaani.xnb 23 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\pomppuaani.xnb 24 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\kranaattiaani.xnb 25 C:\MyTemp\SanteriP\gunmayhem\gunmayhem\gunmayhem\bin\x86\Debug\Content\arkku.xnb -
2015/26/SanteriP/gunmayhem/gunmayhem/gunmayhemContent/gunmayhemContent.contentproj
r6266 r6378 109 109 </Compile> 110 110 </ItemGroup> 111 <ItemGroup> 112 <Compile Include="tiili.jpg"> 113 <Name>tiili</Name> 114 <Importer>TextureImporter</Importer> 115 <Processor>TextureProcessor</Processor> 116 </Compile> 117 </ItemGroup> 118 <ItemGroup> 119 <Compile Include="tiili3.png"> 120 <Name>tiili3</Name> 121 <Importer>TextureImporter</Importer> 122 <Processor>TextureProcessor</Processor> 123 </Compile> 124 </ItemGroup> 125 <ItemGroup> 126 <Compile Include="tramppa.png"> 127 <Name>tramppa</Name> 128 <Importer>TextureImporter</Importer> 129 <Processor>TextureProcessor</Processor> 130 </Compile> 131 </ItemGroup> 132 <ItemGroup> 133 <Compile Include="aseaani.wav"> 134 <Name>aseaani</Name> 135 <Importer>WavImporter</Importer> 136 <Processor>SoundEffectProcessor</Processor> 137 </Compile> 138 </ItemGroup> 139 <ItemGroup> 140 <Compile Include="pomppuaani.wav"> 141 <Name>pomppuaani</Name> 142 <Importer>WavImporter</Importer> 143 <Processor>SoundEffectProcessor</Processor> 144 </Compile> 145 </ItemGroup> 146 <ItemGroup> 147 <Compile Include="kranaattiaani.wav"> 148 <Name>kranaattiaani</Name> 149 <Importer>WavImporter</Importer> 150 <Processor>SoundEffectProcessor</Processor> 151 </Compile> 152 </ItemGroup> 153 <ItemGroup> 154 <Compile Include="arkku.png"> 155 <Name>arkku</Name> 156 <Importer>TextureImporter</Importer> 157 <Processor>TextureProcessor</Processor> 158 </Compile> 159 </ItemGroup> 111 160 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 112 161 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/26/SanteriP/gunmayhem/gunmayhem/gunmayhemContent/kentta1.txt
r6266 r6378 1 2 3 4 5 6 / / / / 7 8 9 / / / 10 11 12 ### ### 13 14 ######............................###### 15 16 ##########%## ##%########## 17 18 E N 19 #########% %######### 1 ..................................................................... 2 "..................................................................." 3 "..................................................................." 4 "..................................................................." 5 "..................................................................." 6 "....................../......../........./............/............" 7 "..................................................................." 8 "..................................................................." 9 "........................./........./........./....................." 10 "..................................................................." 11 "..................................................................." 12 "...........................###......###............................" 13 "..................%.............................%.................." 14 "...............#######......................#######................" 15 "..................................................................." 16 "....................N...%................%........................." 17 "................############..........############................." 18 "..................................................................." 19 "..........................................E........................" 20 "......................#########%...%#########......................" 21 "..................................................................." 22 "..................................................................." 23 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 24 "....... 20 25 21 26 22 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""23 24
Note: See TracChangeset
for help on using the changeset viewer.