Changeset 6745 for 2015/27/EemilI/infected - Copy
- Timestamp:
- 2015-07-02 14:03:26 (8 years ago)
- Location:
- 2015/27/EemilI/infected - Copy
- Files:
-
- 8 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/EemilI/infected - Copy
-
Property
svn:ignore
set to
infected.suo
-
Property
svn:ignore
set to
-
2015/27/EemilI/infected - Copy/infected/infected
-
Property
svn:global-ignores
set to
bin
obj
-
Property
svn:ignore
set to
bin
-
Property
svn:global-ignores
set to
-
2015/27/EemilI/infected - Copy/infected/infected/infected.cs
r6686 r6745 13 13 Image seinakuva = LoadImage("seina"); 14 14 Image zombikuva = LoadImage("zombi"); 15 15 Image valikkokuva = LoadImage("valikkokuva"); 16 Image asekuva = LoadImage("ak47"); 17 Image pistoolikuva = LoadImage("JuanDeag"); 18 19 AssaultRifle ase; 20 16 21 List<Vector> spawnipaikat = new List<Vector>(); 22 List<Label> valikonKohdat; 17 23 18 24 public override void Begin() 19 25 { 20 LuoKentta(); 21 kontrollit(); 22 LuoAikaLaskuri(); 23 //LuoZombi(); 24 MessageDisplay.Add("SELVIÄ MAHDOLLISIMMAN PITKÄÄN"); 25 MessageDisplay.MessageTime = new TimeSpan(0, 0, 10); 26 MessageDisplay.TextColor = Color.White; 27 IsFullScreen = true; 26 27 Valikko(); 28 //IsFullScreen = true; 29 SmoothTextures = true; 30 MediaPlayer.Play("Volatile Reaction"); 28 31 } 29 32 void LuoHahmo(Vector paikka, double leveys, double korkeus) … … 34 37 mies.LinearDamping = 0.1; 35 38 Add(mies); 36 37 } 39 AddCollisionHandler(mies, "zombi", PelaajaKuolee); 40 mies.CollisionIgnoreGroup = 3; 41 42 ase = new AssaultRifle(1, 1); 43 ase.InfiniteAmmo = true; 44 mies.Add(ase); 45 VaihdaAse("ak47"); 46 } 47 48 38 49 void LuoKentta() 39 50 { … … 42 53 mappi.SetTileMethod(Color.Black, LuoTaso); 43 54 mappi.SetTileMethod(Color.Red, LuoHahmo); 55 mappi.SetTileMethod(Color.FromHexCode("7F0000"), LuoTurvaSeina); 44 56 mappi.Execute(40, 40); 45 46 for (int i = 0; i < 6; i++) 57 LuoPisteLaskuri(); 58 59 for (int i = 0; i < 15; i++) 47 60 { 48 61 LuoUusiZombi(); … … 75 88 Mouse.ListenMovement(0.0, Tahtays, null); 76 89 Mouse.IsCursorVisible = true; 90 Mouse.Listen(MouseButton.Left, ButtonState.Down, Ampuminen, null); 91 77 92 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "InfoIkkuna"); 78 93 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); … … 106 121 { 107 122 Timer aikaLaskuri = new Timer(); 108 123 109 124 110 125 aikaLaskuri.Interval = 4; … … 123 138 { 124 139 PhysicsObject zombi = new PhysicsObject(40, 40); 140 zombi.Tag = "zombi"; 125 141 zombi.Position = paikka; 126 142 zombi.Image = zombikuva; 127 128 143 Add(zombi); 129 144 145 FollowerBrain seuraajanAivot = new FollowerBrain(mies); 146 seuraajanAivot.Speed = 100; 147 seuraajanAivot.DistanceFar = 5000000; 148 zombi.Brain = seuraajanAivot; 149 seuraajanAivot.TurnWhileMoving = true; 130 150 } 131 151 void LuoUusiZombi() … … 133 153 int indeksi = RandomGen.NextInt(0, spawnipaikat.Count - 1); 134 154 Vector paikka = spawnipaikat[indeksi]; 135 FollowerBrain seuraajanAivot = new FollowerBrain(mies);136 seuraajanAivot.Speed = 1500;137 seuraajanAivot.DistanceFar = 500;138 seuraajanAivot.TargetClose += mitaTapahtuuKunOllaanLahella;139 155 LuoZombi(paikka); 140 156 … … 143 159 { 144 160 spawnipaikat.Add(paikka); 145 146 } 147 void mitaTapahtuuKunOllaanLahella() 148 { 161 162 } 163 164 void Valikko() 165 { 166 ClearAll(); 167 Mouse.IsCursorVisible = true; 168 169 170 valikonKohdat = new List<Label>(); 171 172 Label kohta1 = new Label("Aloita uusi peli"); 173 kohta1.Position = new Vector(0, 40); 174 valikonKohdat.Add(kohta1); 175 176 177 178 Label kohta2 = new Label("Poistu"); 179 kohta2.Position = new Vector(0, -40); 180 valikonKohdat.Add(kohta2); 181 182 Level.Background.Color = Color.Black; 183 Level.Background.Image = valikkokuva; 184 Camera.Zoom (1.75); 185 186 foreach (Label valikonKohta in valikonKohdat) 187 { 188 Add(valikonKohta); 189 } 190 191 192 Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, AloitaPeli, null); 193 194 Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, Exit, null); 195 196 Mouse.ListenMovement(1.0, ValikossaLiikkuminen, null); 197 198 } 199 void AloitaPeli() 200 { 201 ClearAll(); 202 LuoKentta(); 203 204 kontrollit(); 205 LuoAikaLaskuri(); 206 207 MessageDisplay.MessageTime = new TimeSpan(0, 0, 10); 208 MessageDisplay.TextColor = Color.White; 209 210 211 } 212 213 214 void ValikossaLiikkuminen(AnalogState hiirenTila) 215 { 216 foreach (Label kohta in valikonKohdat) 217 { 218 if (Mouse.IsCursorOn(kohta)) 219 { 220 kohta.TextColor = Color.Red; 221 } 222 else 223 { 224 kohta.TextColor = Color.Blue; 225 } 226 227 } 228 } 229 void PelaajaKuolee(PhysicsObject mies, PhysicsObject zombi) 230 { 231 ase.InfiniteAmmo = false; 232 ase.Ammo.Value = 0; 233 ase.Destroy(); 149 234 mies.Destroy(); 150 } 235 Timer.SingleShot(1, Valikko); 236 } 237 IntMeter pistelaskuri; 238 void LuoPisteLaskuri() 239 { 240 pistelaskuri = new IntMeter(0); 241 242 Label pisteNaytto = new Label(); 243 pisteNaytto.X = Screen.Left + 75; 244 pisteNaytto.Y = Screen.Top - 75; 245 pisteNaytto.TextColor = Color.White; 246 pisteNaytto.Color = Color.Black; 247 248 pisteNaytto.BindTo(pistelaskuri); 249 Add(pisteNaytto); 250 251 pisteNaytto.IntFormatString = "Rahaa: {0:D4}$"; 252 } 253 void Ampuminen() 254 { 255 PhysicsObject ammus = ase.Shoot(); 256 if (ammus != null) 257 258 { 259 AddCollisionHandler(ammus, AmmusOsuu); 260 ammus.CollisionIgnoreGroup = 3; 261 MediaPlayer.Play("ak aani"); 262 263 } 264 265 266 } 267 void VaihdaAse(String aseenNimi) 268 { 269 switch (aseenNimi) 270 { 271 case "ak47": 272 ase.Image = asekuva; 273 ase.FireRate = 5; 274 275 break; 276 case "pistooli": 277 ase.Image = pistoolikuva; 278 ase.FireRate = 2; 279 break; 280 case "haulikko": 281 282 break; 283 default: 284 break; 285 } 286 ase.Tag = aseenNimi; 287 288 } 289 void AmmusOsuu(PhysicsObject a, PhysicsObject b) 290 { 291 if (b.Tag == "zombi") 292 { 293 switch (ase.Tag.ToString()) 294 { 295 case "ak47": 296 if (RandomGen.NextInt(0, 100) > 70) 297 { 298 b.Destroy(); 299 } 300 301 break; 302 default: 303 break; 304 } 305 306 307 } 308 a.Destroy(); 309 } 310 void LuoTurvaSeina(Vector paikka, double leveys, double korkeus) 311 { 312 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 313 taso.Position = paikka; 314 taso.IsVisible = false; 315 316 taso.CollisionIgnoreGroup = 3; 317 Level.Background.Color = Color.Black; 318 Add(taso); 319 } 320 151 321 } -
2015/27/EemilI/infected - Copy/infected/infected/infected.csproj.Debug.cachefile
r6671 r6745 5 5 Content\seina.xnb 6 6 Content\mieskuva.xnb 7 Content\Ghost Story.xnb 8 Content\Volatile Reaction.xnb 9 Content\valikkokuva.xnb 10 Content\ak47.xnb 11 Content\ak aani.xnb 12 Content\JuanDeag.xnb 13 Content\m9 aani.xnb 14 Content\hale.xnb 15 Content\Ghost Story.wma 16 Content\Volatile Reaction.wma 17 Content\ak aani.wma 18 Content\m9 aani.wma 19 Content\hale.wma -
2015/27/EemilI/infected - Copy/infected/infectedContent/infectedContent.contentproj
r6671 r6745 87 87 </Compile> 88 88 </ItemGroup> 89 <ItemGroup> 90 <Compile Include="Ghost Story.mp3"> 91 <Name>Ghost Story</Name> 92 <Importer>Mp3Importer</Importer> 93 <Processor>SongProcessor</Processor> 94 </Compile> 95 </ItemGroup> 96 <ItemGroup> 97 <Compile Include="Volatile Reaction.mp3"> 98 <Name>Volatile Reaction</Name> 99 <Importer>Mp3Importer</Importer> 100 <Processor>SongProcessor</Processor> 101 </Compile> 102 </ItemGroup> 103 <ItemGroup> 104 <Compile Include="valikkokuva.png"> 105 <Name>valikkokuva</Name> 106 <Importer>TextureImporter</Importer> 107 <Processor>TextureProcessor</Processor> 108 </Compile> 109 </ItemGroup> 110 <ItemGroup> 111 <Compile Include="ak47.png"> 112 <Name>ak47</Name> 113 <Importer>TextureImporter</Importer> 114 <Processor>TextureProcessor</Processor> 115 </Compile> 116 </ItemGroup> 117 <ItemGroup> 118 <Compile Include="ak aani.mp3"> 119 <Name>ak aani</Name> 120 <Importer>Mp3Importer</Importer> 121 <Processor>SongProcessor</Processor> 122 </Compile> 123 </ItemGroup> 124 <ItemGroup> 125 <Compile Include="m9 aani.mp3"> 126 <Name>m9 aani</Name> 127 <Importer>Mp3Importer</Importer> 128 <Processor>SongProcessor</Processor> 129 </Compile> 130 </ItemGroup> 131 <ItemGroup> 132 <Compile Include="hale.mp3"> 133 <Name>hale</Name> 134 <Importer>Mp3Importer</Importer> 135 <Processor>SongProcessor</Processor> 136 </Compile> 137 </ItemGroup> 138 <ItemGroup> 139 <Compile Include="JuanDeag.png"> 140 <Name>JuanDeag</Name> 141 <Importer>TextureImporter</Importer> 142 <Processor>TextureProcessor</Processor> 143 </Compile> 144 </ItemGroup> 89 145 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 90 146 <!-- 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.