- Timestamp:
- 2015-07-01 14:55:38 (8 years ago)
- Location:
- 2015/27/VilleHy/Tasohyppelypeli2/Tasohyppelypeli2
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/VilleHy/Tasohyppelypeli2/Tasohyppelypeli2/Tasohyppelypeli2/Tasohyppelypeli2.cs
r6652 r6684 17 17 Image pelaajan1Kuva = LoadImage("pelaaja"); 18 18 Image pelaajan2Kuva = LoadImage("pelaaja2"); 19 Image[] vihukuvat = LoadImages("pahis", "pahis2", "pahis3", "pahis4", "pahis5", "pahis6"); 19 20 AssaultRifle pelaajan1ase; 21 AssaultRifle pelaajan2ase; 20 22 21 23 … … 33 35 Camera.ZoomFactor = 1.2; 34 36 Camera.StayInLevel = true; 37 38 Timer ajastin = new Timer(); 39 ajastin.Interval = 5; 40 ajastin.Timeout += luovihu; 41 ajastin.Start(); 35 42 } 36 43 … … 70 77 pelaajan1ase = new AssaultRifle(leveys * 0.3, korkeus * 0.2); 71 78 pelaaja1.Weapon = pelaajan1ase; 79 AddCollisionHandler(pelaaja1,"ammus", delegate(PhysicsObject a, PhysicsObject b) 80 { 81 pelaaja1.Weapon.Destroy(); 82 a.Destroy(); 83 }); 72 84 } 73 85 void LisaaPelaaja2(Vector paikka, double leveys, double korkeus) … … 78 90 pelaaja2.Image = pelaajan2Kuva; 79 91 Add(pelaaja2); 92 93 pelaajan2ase = new AssaultRifle(leveys * 0.3, korkeus * 0.2); 94 pelaaja2.Weapon = pelaajan2ase; 80 95 } 81 96 void LisaaNappaimet() … … 87 102 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 88 103 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 104 105 Keyboard.Listen(Key.RightControl, ButtonState.Down, Ampuu, "pelaaja ampuu", pelaaja1); 106 Keyboard.Listen(Key.Q, ButtonState.Down, Ampuu, "pelaaja ampuu", pelaaja2); 89 107 90 108 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); … … 108 126 hahmo.Jump(nopeus); 109 127 } 128 void Ampuu(PlatformCharacter hahmo) 129 { 130 PhysicsObject ammus = hahmo.Weapon.Shoot(); 131 if (ammus != null) 132 { 133 134 ammus.Tag = "ammus"; 135 AddCollisionHandler(ammus, delegate(PhysicsObject a, PhysicsObject b) 136 { 137 a.Destroy(); 138 }); 139 140 141 } 142 } 143 void luovihu() 144 { 145 PlatformCharacter vihu = new PlatformCharacter(RUUDUN_KOKO, RUUDUN_KOKO); 146 vihu.X = RandomGen.NextDouble(Level.Left, Level.Right); 147 vihu.Y = RandomGen.NextDouble(Level.Bottom, Level.Top); 148 vihu.Mass = 4.0; 149 vihu.Image = RandomGen.SelectOne(vihukuvat); 150 Add(vihu); 151 } 152 110 153 } -
2015/27/VilleHy/Tasohyppelypeli2/Tasohyppelypeli2/Tasohyppelypeli2/Tasohyppelypeli2.csproj.Debug.cachefile
r6652 r6684 1 1 Content\maali.xnb 2 Content\tahti.xnb3 2 Content\pelaaja.xnb 4 3 Content\kentta1.xnb 5 4 Content\pelaaja2.xnb 5 Content\pahis.xnb 6 Content\pahis2.xnb 7 Content\pahis3.xnb 8 Content\pahis4.xnb 9 Content\pahis5.xnb 10 Content\pahis6.xnb -
2015/27/VilleHy/Tasohyppelypeli2/Tasohyppelypeli2/Tasohyppelypeli2Content/Tasohyppelypeli2Content.contentproj
r6652 r6684 71 71 </Compile> 72 72 </ItemGroup> 73 <ItemGroup> 74 <Compile Include="pahis.png"> 75 <Name>pahis</Name> 76 <Importer>TextureImporter</Importer> 77 <Processor>TextureProcessor</Processor> 78 </Compile> 79 <Compile Include="pahis2.png"> 80 <Name>pahis2</Name> 81 <Importer>TextureImporter</Importer> 82 <Processor>TextureProcessor</Processor> 83 </Compile> 84 <Compile Include="pahis3.png"> 85 <Name>pahis3</Name> 86 <Importer>TextureImporter</Importer> 87 <Processor>TextureProcessor</Processor> 88 </Compile> 89 <Compile Include="pahis4.png"> 90 <Name>pahis4</Name> 91 <Importer>TextureImporter</Importer> 92 <Processor>TextureProcessor</Processor> 93 </Compile> 94 <Compile Include="pahis5.png"> 95 <Name>pahis5</Name> 96 <Importer>TextureImporter</Importer> 97 <Processor>TextureProcessor</Processor> 98 </Compile> 99 <Compile Include="pahis6.png"> 100 <Name>pahis6</Name> 101 <Importer>TextureImporter</Importer> 102 <Processor>TextureProcessor</Processor> 103 </Compile> 104 </ItemGroup> 73 105 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 74 106 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/27/VilleHy/Tasohyppelypeli2/Tasohyppelypeli2/Tasohyppelypeli2Content/kentta1.txt
r6652 r6684 1 1 2 ## ## ## ## ## ## ## ## ## ## ## ## ###2 ## ## ## ## ## ## ## ## ## ## ## ## # 3 3 4 4 5 ## ## ## ## ## ## ## ## ## ## ## ## ## #5 ## ## ## ## ## ## ## ## ## ## ## ## ## 6 6 7 7 8 ## ## ## ## ## ## ## ## ## ## ## ## ## ##8 ## ## ## ## ## ## ## ## ## ## ## ## ## # 9 9 10 11 ## ## ## ## ## ## ## ## ## ## ## ## ## ## # 10 # ## ## ## ## ## ## ## ## ## ## ## ## ## # 12 11 13 12 14 ## ## ## ## ## ## ## ## ## ## ## ## ## ####13 # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 15 14 16 15 N K 17 ################################################# 16 ##########################################################
Note: See TracChangeset
for help on using the changeset viewer.