Changeset 3032
- Timestamp:
- 2012-06-14 15:09:00 (11 years ago)
- Location:
- 2012/24/TeemuT/Horde
- Files:
-
- 33 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/24/TeemuT/Horde/Horde/Horde/Horde.cs
r3000 r3032 7 7 using Jypeli.Widgets; 8 8 9 class Hahmo : PhysicsObject 10 { 11 public int Elamat = 3; 12 13 public Hahmo(double leveys, double korkeus) 14 : base(leveys, korkeus) 15 { 16 } 17 } 18 9 19 public class Horde : PhysicsGame 10 20 { 11 PhysicsObjectpelaaja1;12 13 PhysicsObjectpelaaja2;21 Hahmo pelaaja1; 22 23 Hahmo pelaaja2; 14 24 Weapon ase1; 15 25 Weapon ase2; 16 Image lattia = LoadImage("");26 //Image lattia = LoadImage(""); 17 27 18 28 public override void Begin() … … 20 30 // TODO: Kirjoita ohjelmakoodisi tähän 21 31 LuoAlkuVAlikko(); 22 LuoKentta(); 23 Camera.Zoom(1.5); 24 Camera.Follow(pelaaja1, pelaaja2); 32 MediaPlayer.Play("troll song"); 25 33 26 IsFullScreen = true;27 LuoAse();28 LuoAse2();29 30 31 int i = 0;32 33 while (i < 10)34 {35 36 37 PhysicsObject zomboli = new PhysicsObject(10, 10);38 zomboli.Shape = Shape.Circle;39 zomboli.Color = Color.Red;40 zomboli.Restitution = 0.1;41 zomboli.X = RandomGen.NextDouble(-500, 500);42 43 44 TagFollowerBrain zomboilnAivot = new TagFollowerBrain("pelaaja", 1000);45 zomboli.Brain = zomboilnAivot;46 zomboilnAivot.TargetFollowDistance = 300;47 Add(zomboli);48 i++;49 50 }51 52 53 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");54 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli");55 LisaaOhjaimet();56 34 } 57 35 … … 61 39 void LuoKentta() 62 40 { 63 Level.BackgroundColor = Color.DarkGray; 41 Level.BackgroundColor = Color.Black; 42 Level.Background.Image = LoadImage("smile"); 64 43 Level.Background.FitToLevel(); 65 44 TileMap kentta1 = TileMap.FromFile("kenttä1.txt"); … … 76 55 seina.Shape = Shape.Rectangle; 77 56 seina.Color = Color.Gray; 78 Image SeinanKuva = LoadImage("kiviseinä"); 79 seina.Image = SeinanKuva; 57 //Image SeinanKuva = LoadImage("kiviseinä"); 58 //seina.Image = SeinanKuva; 59 seina.Image = LoadImage("Troll_face"); 80 60 Add(seina); 81 61 … … 84 64 void LuoPelaaja1(Vector paikka, double leveys, double korkeus) 85 65 { 86 pelaaja1 = new PhysicsObject(10, 10);66 pelaaja1 = new Hahmo(10, 10); 87 67 pelaaja1.Shape = Shape.Circle; 68 pelaaja1.Elamat = 3; 88 69 pelaaja1.Color = Color.Beige; 70 pelaaja1.Image = LoadImage("lolface"); 89 71 pelaaja1.Restitution = 0.1; 90 72 pelaaja1.Tag = "pelaaja"; 91 73 AddCollisionHandler<Hahmo, Hahmo>(pelaaja1, "Vihollinen", VihollinenOsuu1); 92 74 Add(pelaaja1); 93 75 … … 96 78 void LuoPelaaja2(Vector paikka, double leveys, double korkeus) 97 79 { 98 pelaaja2 = new PhysicsObject(10, 10); 80 pelaaja2 = new Hahmo(10, 10); 81 pelaaja2.Elamat = 3; 99 82 pelaaja2.Shape = Shape.Circle; 100 83 pelaaja2.Color = Color.Wheat; 84 pelaaja2.Image = LoadImage("me-gusta22222"); 101 85 pelaaja2.Restitution = 0.1; 102 86 pelaaja2.X = 10; 103 87 pelaaja2.Tag = "pelaaja"; 104 88 AddCollisionHandler<Hahmo, Hahmo>(pelaaja2, "Vihollinen", VihollinenOsuu2); 105 89 Add(pelaaja2); 106 90 } … … 109 93 { 110 94 ControllerOne.ListenAnalog(AnalogControl.LeftStick, 0.1, LiikutaPelaajaa, "Liikuta pelaajaa tattia pyörittämällä.", pelaaja1); 111 ControllerOne.ListenAnalog(AnalogControl.RightTrigger, 0.1, AmmuAseella, "Käytä oikeaa liipasinta ampumiseen.", ase1);112 //ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, KäännäPelaajaa, "Käytä oikeaa tattia hahmon kääntämiseen", pelaaja1);95 ControllerOne.ListenAnalog(AnalogControl.RightTrigger, 0.1, AmmuAseella, "Käytä oikeaa liipasinta ampumiseen.", pelaaja1, ase1); 96 ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, KäännäPelaajaa, "Käytä oikeaa tattia hahmon kääntämiseen", pelaaja1); 113 97 ControllerTwo.ListenAnalog(AnalogControl.LeftStick, 0.1, LiikutaPelaajaa2, "Liikuta pelaajaa tattia pyörittämällä.", pelaaja2); 114 ControllerTwo.ListenAnalog(AnalogControl.RightTrigger, 0.1, AmmuAseella, "Käytä oikeaa liipasinta ampumiseen.", ase2); 115 // ControllerTwo.ListenAnalog(AnalogControl.RightStick, 0.1, KäännäPelaajaa2, "Käytä oikeaa tattia hahmon kääntämiseen", pelaaja2); 116 117 } 118 98 ControllerTwo.ListenAnalog(AnalogControl.RightTrigger, 0.1, AmmuAseella, "Käytä oikeaa liipasinta ampumiseen.", pelaaja2, ase2); 99 ControllerTwo.ListenAnalog(AnalogControl.RightStick, 0.1, KäännäPelaajaa, "Käytä oikeaa tattia hahmon kääntämiseen", pelaaja2); 100 101 //Timer tutkiOnkoStickIdlena = new Timer(); 102 //tutkiOnkoStickIdlena.Interval = 0.1; 103 //tutkiOnkoStickIdlena.Start(); 104 //tutkiOnkoStickIdlena.Timeout += delegate 105 //{ 106 //}; 107 } 119 108 120 109 void LiikutaPelaajaa(AnalogState tatinTila, PhysicsObject pelaaja) 121 110 { 122 111 Vector tatinAsento = tatinTila.StateVector; 123 pelaaja1.Hit(0.3 * tatinAsento); 124 125 } 126 127 128 112 //pelaaja1.Hit(0.3 * tatinAsento); 113 pelaaja1.Velocity = tatinAsento * 50; 114 } 129 115 130 116 void LiikutaPelaajaa2(AnalogState tatinTila, PhysicsObject pelaaja) 131 117 { 132 118 Vector tatinAsento = tatinTila.StateVector; 133 pelaaja2.Hit(0.3 * tatinAsento); 119 //pelaaja2.Hit(0.3 * tatinAsento); 120 pelaaja2.Velocity = tatinAsento * 50; 134 121 } 135 122 … … 141 128 ase1.Ammo.Value = 1000000000; 142 129 ase1.ProjectileCollision = LuotiOsuu; 130 ase1.X = 10; 131 ase1.Tag = "ase"; 143 132 pelaaja1.Add(ase1); 144 133 } … … 148 137 { 149 138 ammus.Destroy(); 150 Explosion rajahdys = new Explosion(1); 151 rajahdys.Force = 10; 152 rajahdys.Position = ammus.Position; 139 Explosion rajahdys = new Explosion(50); 140 rajahdys.Image = LoadImage("RAGEFACE1"); 141 rajahdys.Force = 0.1; 142 rajahdys.Position = ammus.Position; 153 143 Add(rajahdys); 154 144 } 155 145 156 void AmmuAseella(AnalogState LiipaisimenTila, Weapon ase) 146 void OsuttiinViholliseen(PhysicsObject ammus, Hahmo kohde) 147 { 148 kohde.Elamat--; 149 if (kohde.Elamat < 1) kohde.Destroy(); 150 } 151 152 153 void VihollinenOsuu1(Hahmo Vihollinen, Hahmo pelaaja) 154 { 155 pelaaja1.Elamat--; 156 if (pelaaja1.Elamat < 1) pelaaja1.Destroy(); 157 } 158 159 void VihollinenOsuu2(Hahmo Vihollinen, Hahmo pelaaja) 160 { 161 pelaaja2.Elamat--; 162 if (pelaaja2.Elamat < 1) pelaaja2.Destroy(); 163 164 } 165 166 void AmmuAseella(AnalogState LiipaisimenTila, PhysicsObject pelaaja, Weapon ase) 157 167 { 158 168 double LiipaisimenAsento = LiipaisimenTila.State; 159 ase.Shoot(); 160 169 PhysicsObject ammus = ase.Shoot(); 170 if (ammus != null) 171 { 172 ammus.Position = pelaaja.Position + Vector.FromLengthAndAngle(20, pelaaja.Angle); 173 AddCollisionHandler<PhysicsObject, Hahmo>(ammus, "Vihollinen", OsuttiinViholliseen); 174 } 161 175 } 162 176 … … 166 180 ase2.Ammo.Value = 1000000000; 167 181 ase2.ProjectileCollision = LuotiOsuu; 182 ase2.X = 10; 183 ase2.Tag = "ase"; 168 184 pelaaja2.Add(ase2); 169 185 } … … 186 202 { 187 203 case 0: 188 //AloitaPeli();204 AloitaPeli(); 189 205 break; 190 206 case 1: … … 200 216 201 217 202 void KäännäPelaajaa(AnalogState tatinTila )218 void KäännäPelaajaa(AnalogState tatinTila, PhysicsObject pelaaja) 203 219 { 204 220 Vector tatinAsento = tatinTila.StateVector; 221 pelaaja.Angle = tatinAsento.Angle; 205 222 206 223 } 207 224 208 void KäännäPelaajaa2(AnalogState tatinTila) 209 { 210 Vector tatinAsento = tatinTila.StateVector; 211 212 } 213 225 void LuotiOsuuViholliseen(PhysicsObject Luoti, PhysicsObject zomboli) 226 { 227 AddCollisionHandler( Luoti, zomboli, CollisionHandler.DestroyObject); 228 ase1.ProjectileCollision = CollisionHandler.DestroyTarget; 229 } 230 231 void AloitaPeli() 232 { 233 LuoKentta(); 234 Camera.Zoom(1.5); 235 Camera.Follow(pelaaja1, pelaaja2); 236 237 IsFullScreen = true; 238 LuoAse(); 239 LuoAse2(); 240 241 242 int i = 0; 243 244 while (i < 100) 245 { 246 247 248 Hahmo zomboli = new Hahmo(10, 10); 249 zomboli.Shape = Shape.Circle; 250 zomboli.Color = Color.Red; 251 zomboli.Image = LoadImage("foreveralone12"); 252 zomboli.Restitution = 0.1; 253 zomboli.Elamat = 3; 254 zomboli.Tag = "Vihollinen"; 255 zomboli.X = RandomGen.NextDouble(-750, 750); 256 zomboli.Y = RandomGen.NextDouble(-500, 500); 257 258 259 TagFollowerBrain zomboilnAivot = new TagFollowerBrain("pelaaja", 2000); 260 zomboli.Brain = zomboilnAivot; 261 zomboilnAivot.TargetFollowDistance = 150; 262 Add(zomboli); 263 i++; 264 265 } 266 267 268 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 269 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 270 LisaaOhjaimet(); 271 // LuotiOsuuViholliseen(); 272 273 } 214 274 215 275 } -
2012/24/TeemuT/Horde/Horde/Horde/Horde.csproj
r2950 r3032 62 62 </PropertyGroup> 63 63 <ItemGroup> 64 <Reference Include="Jypeli4"> 64 <Reference Include="Jypeli, Version=5.0.0.0, Culture=neutral, processorArchitecture=x86"> 65 <SpecificVersion>False</SpecificVersion> 66 <HintPath>..\..\..\..\..\Program Files (x86)\Jypeli\lib\x86\Jypeli.dll</HintPath> 65 67 </Reference> 66 68 <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> -
2012/24/TeemuT/Horde/Horde/Horde/Horde.csproj.Debug.cachefile
r3000 r3032 3 3 Content\kiviseinÀ.xnb 4 4 Content\splat.xnb 5 Content\beige_laatta.xnb 5 Content\Troll_face.xnb 6 Content\lolface.xnb 7 Content\foreveralone.xnb 8 Content\smile.xnb 9 Content\me-gusta22222.xnb 10 Content\RAGEFACE1.xnb 11 Content\foreveralone12.xnb 12 Content\troll song.xnb 13 Content\troll song.wma 6 14 Content\seina.png 7 15 kenttÀ1.txt -
2012/24/TeemuT/Horde/Horde/Horde/obj/x86/Debug/ContentPipeline-{C7CE1857-DA82-43CC-B006-78024AC1E058}.xml
r3000 r3032 38 38 <Time>2012-06-13T12:16:13.7075716+03:00</Time> 39 39 </Item> 40 <Item> 41 <Source>Troll_face.png</Source> 42 <Name>Troll_face</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\Troll_face.xnb</Output> 47 <Time>2012-06-14T12:49:30.9725899+03:00</Time> 48 </Item> 49 <Item> 50 <Source>lolface.png</Source> 51 <Name>lolface</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\lolface.xnb</Output> 56 <Time>2012-06-14T13:00:12.6382899+03:00</Time> 57 </Item> 58 <Item> 59 <Source>foreveralone.png</Source> 60 <Name>foreveralone</Name> 61 <Importer>TextureImporter</Importer> 62 <Processor>TextureProcessor</Processor> 63 <Options>None</Options> 64 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\foreveralone.xnb</Output> 65 <Time>2012-06-14T13:10:50.9058899+03:00</Time> 66 </Item> 67 <Item> 68 <Source>smile.png</Source> 69 <Name>smile</Name> 70 <Importer>TextureImporter</Importer> 71 <Processor>TextureProcessor</Processor> 72 <Options>None</Options> 73 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\smile.xnb</Output> 74 <Time>2012-06-14T13:16:56.6649899+03:00</Time> 75 </Item> 76 <Item> 77 <Source>me-gusta22222.png</Source> 78 <Name>me-gusta22222</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 <Options>None</Options> 82 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\me-gusta22222.xnb</Output> 83 <Time>2012-06-14T13:27:44.7483899+03:00</Time> 84 </Item> 85 <Item> 86 <Source>RAGEFACE1.png</Source> 87 <Name>RAGEFACE1</Name> 88 <Importer>TextureImporter</Importer> 89 <Processor>TextureProcessor</Processor> 90 <Options>None</Options> 91 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\RAGEFACE1.xnb</Output> 92 <Time>2012-06-14T13:40:38.3722109+03:00</Time> 93 </Item> 94 <Item> 95 <Source>foreveralone12.png</Source> 96 <Name>foreveralone12</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 <Options>None</Options> 100 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\foreveralone12.xnb</Output> 101 <Time>2012-06-14T13:50:31.61724+03:00</Time> 102 </Item> 103 <Item> 104 <Source>troll song.mp3</Source> 105 <Name>troll song</Name> 106 <Importer>Mp3Importer</Importer> 107 <Processor>SongProcessor</Processor> 108 <Options>None</Options> 109 <Output>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\troll song.xnb</Output> 110 <Extra>c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\troll song.wma</Extra> 111 <Time>2012-06-14T14:35:47.4495237+03:00</Time> 112 </Item> 40 113 <BuildSuccessful>true</BuildSuccessful> 41 114 <Settings> … … 53 126 <Assembly> 54 127 <Key>C:\Program Files (x86)\Jypeli\lib\ContentExtensions\TextFileContentExtension.dll</Key> 55 <Value>2012-0 4-23T14:23:36+03:00</Value>128 <Value>2012-06-13T10:59:54+03:00</Value> 56 129 </Assembly> 57 130 <Assembly> -
2012/24/TeemuT/Horde/Horde/Horde/obj/x86/Debug/Horde.csproj.FileListAbsolute.txt
r3000 r3032 1 1 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Horde.exe 2 2 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Horde.pdb 3 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Jypeli4.dll4 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Jypeli4.xml5 3 c:\MyTemp\TeemuT\Horde\Horde\Horde\obj\x86\Debug\ResolveAssemblyReference.cache 6 4 c:\MyTemp\TeemuT\Horde\Horde\Horde\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt … … 13 11 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\kiviseinÀ.xnb 14 12 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\splat.xnb 13 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Jypeli.dll 14 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Jypeli.xml 15 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\Troll_face.xnb 16 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\lolface.xnb 17 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\foreveralone.xnb 18 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\smile.xnb 19 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\me-gusta22222.xnb 20 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\RAGEFACE1.xnb 21 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\foreveralone12.xnb 22 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\troll song.xnb 23 c:\MyTemp\TeemuT\Horde\Horde\Horde\bin\x86\Debug\Content\troll song.wma -
2012/24/TeemuT/Horde/Horde/Horde/obj/x86/Debug/cachefile-{C7CE1857-DA82-43CC-B006-78024AC1E058}-targetpath.txt
r3000 r3032 3 3 Content\kiviseinÀ.xnb 4 4 Content\splat.xnb 5 Content\Troll_face.xnb 6 Content\lolface.xnb 7 Content\foreveralone.xnb 8 Content\smile.xnb 9 Content\me-gusta22222.xnb 10 Content\RAGEFACE1.xnb 11 Content\foreveralone12.xnb 12 Content\troll song.xnb 13 Content\troll song.wma 5 14 Content\seina.png -
2012/24/TeemuT/Horde/Horde/HordeContent/HordeContent.contentproj
r3000 r3032 73 73 </Compile> 74 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="Troll_face.png"> 77 <Name>Troll_face</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 82 <ItemGroup> 83 <Compile Include="lolface.png"> 84 <Name>lolface</Name> 85 <Importer>TextureImporter</Importer> 86 <Processor>TextureProcessor</Processor> 87 </Compile> 88 </ItemGroup> 89 <ItemGroup> 90 <Compile Include="foreveralone.png"> 91 <Name>foreveralone</Name> 92 <Importer>TextureImporter</Importer> 93 <Processor>TextureProcessor</Processor> 94 </Compile> 95 </ItemGroup> 96 <ItemGroup> 97 <Compile Include="smile.png"> 98 <Name>smile</Name> 99 <Importer>TextureImporter</Importer> 100 <Processor>TextureProcessor</Processor> 101 </Compile> 102 </ItemGroup> 103 <ItemGroup> 104 <Compile Include="me-gusta22222.png"> 105 <Name>me-gusta22222</Name> 106 <Importer>TextureImporter</Importer> 107 <Processor>TextureProcessor</Processor> 108 </Compile> 109 </ItemGroup> 110 <ItemGroup> 111 <Compile Include="RAGEFACE1.png"> 112 <Name>RAGEFACE1</Name> 113 <Importer>TextureImporter</Importer> 114 <Processor>TextureProcessor</Processor> 115 </Compile> 116 </ItemGroup> 117 <ItemGroup> 118 <Compile Include="foreveralone12.png"> 119 <Name>foreveralone12</Name> 120 <Importer>TextureImporter</Importer> 121 <Processor>TextureProcessor</Processor> 122 </Compile> 123 </ItemGroup> 124 <ItemGroup> 125 <Compile Include="troll song.mp3"> 126 <Name>troll song</Name> 127 <Importer>Mp3Importer</Importer> 128 <Processor>SongProcessor</Processor> 129 </Compile> 130 </ItemGroup> 75 131 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 76 132 <!-- 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.