Changeset 6691
- Timestamp:
- 2015-07-01 15:01:31 (8 years ago)
- Location:
- 2015/27/PietuR
- Files:
-
- 54 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/PietuR/SoHaG/SoHaG/SoHaG/SoHaG.cs
r6604 r6691 9 9 public class SoHaG : PhysicsGame 10 10 { 11 //Korjaa sirut 12 //TODO Lisää avain 13 //TODO Lisää valikko 14 //TODO Lisää kenttiä 15 11 16 int Kenttia = 3; 17 12 18 13 19 Image SeinanKuva = LoadImage("Seina1"); … … 21 27 Image LattianKuva = LoadImage("Lattia"); 22 28 Image LaatanKuva = LoadImage("Lattialaatta"); 29 Image Vihun1Kuva = LoadImage("Greed"); 30 Image Vihun2Kuva = LoadImage("Hope"); 31 Image Sirunkuva = LoadImage("Shard"); 32 Image TaskuvalonKuva = LoadImage("Taskulampunvalo"); 33 SoundEffect Reversed = LoadSoundEffect("Reversed"); 34 SoundEffect Sinister = LoadSoundEffect("Sinister"); 35 SoundEffect Button = LoadSoundEffect("Button"); 36 SoundEffect GhostKid = LoadSoundEffect("Ghost Kid"); 37 SoundEffect Scream = LoadSoundEffect("Scream"); 38 23 39 24 40 PhysicsObject Tyyppi1; … … 29 45 List<Vector> Spawnit = new List<Vector>(); 30 46 List<Vector> VihuSpawnit = new List<Vector>(); 47 List<Vector> SiruSpawnit = new List<Vector>(); 48 49 List<SoundEffect> soitettu = new List<SoundEffect>(); 31 50 32 51 public override void Begin() … … 39 58 Tyyppi4 = Luotyyppi(Tyypin4Kuva); 40 59 41 LuoVihu(); 42 LuoVihu(); 43 LuoVihu(); 44 45 Timer näkyvyysAjastin = new Timer(); 46 näkyvyysAjastin.Interval = 0.05; 47 näkyvyysAjastin.Timeout += delegate 48 { 49 Tarkistanakyvyys(Tyyppi1); 50 Tarkistanakyvyys(Tyyppi2); 51 Tarkistanakyvyys(Tyyppi3); 52 Tarkistanakyvyys(Tyyppi4); 53 }; 54 näkyvyysAjastin.Start(); 60 Camera.Follow(Tyyppi1, Tyyppi2, Tyyppi3, Tyyppi4); 61 62 LuoShadow(); 63 LuoShadow(); 64 LuoShadow(); 65 LuoHope(); 66 67 MediaPlayer.Play(RandomGen.SelectOne("Day of Chaos", "Echoes of Time", "Evening of Chaos", "Night of Chaos", "Penumbra")); 68 GhostKid.Play(); 69 70 71 //Timer näkyvyysAjastin = new Timer(); 72 //näkyvyysAjastin.Interval = 0.05; 73 //näkyvyysAjastin.Timeout += delegate 74 //{ 75 // Tarkistanakyvyys(Tyyppi1); 76 // Tarkistanakyvyys(Tyyppi2); 77 // Tarkistanakyvyys(Tyyppi3); 78 // Tarkistanakyvyys(Tyyppi4); 79 //}; 80 //näkyvyysAjastin.Start(); 55 81 56 82 Keyboard.Listen(Key.Up, ButtonState.Down, Liikuta, "Liikuttaa pelaajaa1", Tyyppi1, Direction.Up); … … 80 106 { 81 107 Tyyppi.Push(Suunta.GetVector()*3000); 82 Tyyppi.Angle = Tyyppi.Velocity.Angle +Angle.FromDegrees(90);108 Tyyppi.Angle = Tyyppi.Velocity.Angle; 83 109 } 84 110 … … 93 119 Ruudut.SetTileMethod(Color.FromHexCode("7F0000"), LuoSeina2); 94 120 Ruudut.SetTileMethod(Color.FromHexCode("FF6A00"), LuoNappula); 121 Ruudut.SetTileMethod(Color.FromHexCode("00FFFF"), LuoSirunpaikka); 95 122 Ruudut.SetTileMethod(Color.Red, LuoVihunpaikka); 96 123 Ruudut.Execute(20, 20); … … 103 130 Pimeys.Color = new Color(0, 0, 0, 210); 104 131 Add(Pimeys, 2); 132 105 133 } 106 134 … … 110 138 Seina.Position = Paikka; 111 139 Seina.Image = SeinanKuva; 140 Seina.CollisionIgnoreGroup = 1; 112 141 Add(Seina); 113 142 } … … 117 146 Seina2.Position = Paikka; 118 147 Seina2.Image = Seinan2Kuva; 148 Seina2.CollisionIgnoreGroup = 1; 119 149 Add(Seina2); 120 150 } 121 void LuoVihu() 122 { 123 PhysicsObject Vihu = new PhysicsObject(319 * 0.1, 218 * 0.1); 151 void LuoSiru() 152 { 153 PhysicsObject Siru = new PhysicsObject(20, 20); 154 Siru.Image = Sirunkuva; 155 Siru.Shape = Shape.Circle; 156 Add(Siru); 157 158 AddCollisionHandler(Siru, "Tyyppi", delegate(PhysicsObject N, PhysicsObject T) 159 { 160 Siru.Destroy(); 161 }); 162 163 } 164 165 void LuoVihu(Image kuva, double speed, bool liikkuuPimeassa, SoundEffect aani) 166 { 167 PhysicsObject Vihu = new PhysicsObject(218 * 0.21, 319 * 0.1); 124 168 Vihu.LinearDamping = 0.5; 125 169 Vihu.AngularDamping = 0.7; 126 Vihu.Image = Tyypin4Kuva;170 Vihu.Image = kuva; 127 171 Vihu.Shape = Shape.Circle; 128 172 Vector Paikka = RandomGen.SelectOne<Vector>(VihuSpawnit); … … 130 174 Vihu.Position = Paikka; 131 175 Vihu.Tag = "Vihu"; 176 Vihu.CollisionIgnoreGroup = 1; 177 178 RandomMoverBrain satunnaisAivot = new RandomMoverBrain(speed); 179 satunnaisAivot.TurnWhileMoving = true; 180 181 FollowerBrain seuraajanAivot = new FollowerBrain(Tyyppi1, Tyyppi2, Tyyppi3, Tyyppi4); 182 seuraajanAivot.Speed = speed; 183 seuraajanAivot.TurnWhileMoving = true; 184 seuraajanAivot.DistanceFar = 600; 185 seuraajanAivot.FarBrain = satunnaisAivot; 186 187 Vihu.Brain = seuraajanAivot; 188 189 Timer päivitysAjastin = new Timer(); 190 päivitysAjastin.Interval = 0.05; 191 päivitysAjastin.Timeout += delegate 192 { 193 Tarkistanakyvyys(Vihu); 194 195 if (liikkuuPimeassa) 196 { 197 if (Vihu.IsVisible) 198 { 199 Vihu.Brain = null; 200 SoitaAani(aani); 201 } 202 else 203 { 204 Vihu.Brain = seuraajanAivot; 205 } 206 } 207 else 208 { 209 if (Vihu.IsVisible) 210 { 211 Vihu.Brain = seuraajanAivot; 212 SoitaAani(aani); 213 } 214 else 215 { 216 Vihu.Brain = null; 217 } 218 } 219 }; 220 päivitysAjastin.Start(); 221 132 222 Add(Vihu); 223 } 224 225 void SoitaAani(SoundEffect aani) 226 { 227 if (!soitettu.Contains(aani)) 228 { 229 soitettu.Add(aani); 230 aani.Play(); 231 Timer.SingleShot(4, delegate { soitettu.Remove(aani); }); 232 } 233 } 234 235 void LuoShadow() 236 { 237 LuoVihu(Vihun1Kuva, 100, true, Sinister); 238 } 239 void LuoHope() 240 { 241 LuoVihu(Vihun2Kuva, 500, false, Reversed); 133 242 } 134 243 void LuoNappula(Vector Paikka, double leveys, double korkeus) … … 137 246 Nappula.Position = Paikka; 138 247 Nappula.Image = NappulanKuva; 248 Nappula.CollisionIgnoreGroup = 1; 139 249 Add(Nappula); 140 250 141 DoubleMeter Energia = new DoubleMeter(1 00, 0, 100);251 DoubleMeter Energia = new DoubleMeter(1, 0, 100); 142 252 ProgressBar Energiapalkki = new ProgressBar(20, 5); 143 253 Energiapalkki.Y = 20; … … 162 272 { 163 273 Energia.Value = Energia.MaxValue; 274 Button.Play(); 164 275 Valo.IsVisible = true; 165 276 }); 277 278 166 279 } 167 280 PhysicsObject Luotyyppi(Image Kuva) 168 281 { 169 PhysicsObject Tyyppi = new PhysicsObject( 319 * 0.1, 218* 0.1);282 PhysicsObject Tyyppi = new PhysicsObject(218 * 0.1, 319 * 0.1); 170 283 Tyyppi.LinearDamping = 0.5; 171 284 Tyyppi.AngularDamping = 0.7; … … 176 289 Tyyppi.Position = Paikka; 177 290 Tyyppi.Tag = "Tyyppi"; 178 Add(Tyyppi); 291 Add(Tyyppi, 3); 292 293 GameObject Valo = new GameObject(300, 300); 294 //Valo.Position = Paikka; 295 Valo.Tag = "valo"; 296 Valo.Image = TaskuvalonKuva; 297 Valo.X = 25; 298 Valo.Y = 5; 299 Tyyppi.Add(Valo); 300 301 AddCollisionHandler(Tyyppi, "Vihu", delegate(PhysicsObject N, PhysicsObject T) 302 { 303 Tyyppi.Destroy(); 304 Scream.Play(); 305 }); 179 306 180 307 return Tyyppi; … … 184 311 Spawnit.Add(Paikka); 185 312 } 313 314 void LuoSirunpaikka(Vector Paikka, double leveys, double korkeus) 315 { 316 SiruSpawnit.Add(Paikka); 317 } 318 186 319 void LuoVihunpaikka(Vector Paikka, double leveys, double korkeus) 187 320 { 188 321 VihuSpawnit.Add(Paikka); 322 VihuSpawnit.Add(Paikka); 189 323 } 190 324 … … 192 326 { 193 327 bool piilossa = true; 328 329 // Kentässä olevat valot. 194 330 foreach (var valo in GetObjectsWithTag("valo")) 195 331 { … … 201 337 } 202 338 339 PhysicsObject[] pelaajat = { Tyyppi1, Tyyppi2, Tyyppi3, Tyyppi4 }; 340 double lampunPituus = 300 * 0.5; 341 double lampunKulma = 45; 342 343 // Pelaajan taskulamppu. 344 foreach (var pelaaja in pelaajat) 345 { 346 if (pelaaja.IsDestroyed) 347 continue; 348 349 Angle kulma = (Olio.Position - pelaaja.Position).Angle; 350 if (Math.Abs(kulma.Degrees - pelaaja.Angle.Degrees) < lampunKulma && Vector.Distance(pelaaja.Position, Olio.Position) < lampunPituus) 351 { 352 piilossa = false; 353 } 354 } 355 203 356 Olio.IsVisible = !piilossa; 204 357 } -
2015/27/PietuR/SoHaG/SoHaG/SoHaG/SoHaG.csproj.Debug.cachefile
r6604 r6691 1 Content\KenttÀ1.xnb 2 Content\Seina1.xnb 1 3 Content\Tyyppi1.xnb 2 4 Content\Tyyppi1KÀvely1.xnb … … 11 13 Content\Tyyppi4KÀvely1.xnb 12 14 Content\Tyyppi4KÀvely2.xnb 13 Content\KenttÀ1.xnb14 Content\Seina1.xnb15 15 Content\Nappula.xnb 16 16 Content\Seina2.xnb … … 20 20 Content\Lattia.xnb 21 21 Content\Lattialaatta.xnb 22 Content\Greed.xnb 23 Content\Hope.xnb 24 Content\Taskulampunvalo.xnb 25 Content\Day of Chaos.xnb 26 Content\Echoes of Time.xnb 27 Content\Evening of Chaos.xnb 28 Content\Night of Chaos.xnb 29 Content\Penumbra.xnb 30 Content\Remmende_auto.xnb 31 Content\Reversed.xnb 32 Content\Sinister.xnb 33 Content\Ghost Kid.xnb 34 Content\What Child is this.xnb 35 Content\Fucked up.xnb 36 Content\Scream.xnb 37 Content\Button.xnb 38 Content\Shard.xnb 39 Content\Day of Chaos.wma 40 Content\Echoes of Time.wma 41 Content\Evening of Chaos.wma 42 Content\Night of Chaos.wma 43 Content\Penumbra.wma 44 Content\What Child is this.wma -
2015/27/PietuR/SoHaG/SoHaG/SoHaG/obj/x86/Debug/SoHaG.csproj.FileListAbsolute.txt
r6604 r6691 28 28 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Lattia.xnb 29 29 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Lattialaatta.xnb 30 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Greed.xnb 31 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Hope.xnb 32 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Taskulampunvalo.xnb 33 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Day of Chaos.xnb 34 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Echoes of Time.xnb 35 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Evening of Chaos.xnb 36 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Night of Chaos.xnb 37 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Penumbra.xnb 38 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Day of Chaos.wma 39 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Echoes of Time.wma 40 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Evening of Chaos.wma 41 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Night of Chaos.wma 42 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Penumbra.wma 43 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Remmende_auto.xnb 44 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Reversed.xnb 45 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Sinister.xnb 46 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Ghost Kid.xnb 47 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\What Child is this.xnb 48 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\What Child is this.wma 49 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Fucked up.xnb 50 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Scream.xnb 51 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Button.xnb 52 C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Shard.xnb -
2015/27/PietuR/SoHaG/SoHaG/SoHaG/obj/x86/Debug/cachefile-{4BEC25C0-5414-4199-9B12-AD80EDADF21A}-targetpath.txt
r6604 r6691 1 Content\KenttÀ1.xnb 2 Content\Seina1.xnb 1 3 Content\Tyyppi1.xnb 2 4 Content\Tyyppi1KÀvely1.xnb … … 11 13 Content\Tyyppi4KÀvely1.xnb 12 14 Content\Tyyppi4KÀvely2.xnb 13 Content\KenttÀ1.xnb14 Content\Seina1.xnb15 15 Content\Nappula.xnb 16 16 Content\Seina2.xnb … … 20 20 Content\Lattia.xnb 21 21 Content\Lattialaatta.xnb 22 Content\Greed.xnb 23 Content\Hope.xnb 24 Content\Taskulampunvalo.xnb 25 Content\Day of Chaos.xnb 26 Content\Day of Chaos.wma 27 Content\Echoes of Time.xnb 28 Content\Echoes of Time.wma 29 Content\Evening of Chaos.xnb 30 Content\Evening of Chaos.wma 31 Content\Night of Chaos.xnb 32 Content\Night of Chaos.wma 33 Content\Penumbra.xnb 34 Content\Penumbra.wma 35 Content\Remmende_auto.xnb 36 Content\Reversed.xnb 37 Content\Sinister.xnb 38 Content\Ghost Kid.xnb 39 Content\What Child is this.xnb 40 Content\What Child is this.wma 41 Content\Fucked up.xnb 42 Content\Scream.xnb 43 Content\Button.xnb 44 Content\Shard.xnb -
2015/27/PietuR/SoHaG/SoHaG/SoHaGContent/SoHaGContent.contentproj
r6604 r6691 168 168 </Compile> 169 169 </ItemGroup> 170 <ItemGroup> 171 <Compile Include="Greed.png"> 172 <Name>Greed</Name> 173 <Importer>TextureImporter</Importer> 174 <Processor>TextureProcessor</Processor> 175 </Compile> 176 <Compile Include="Hope.png"> 177 <Name>Hope</Name> 178 <Importer>TextureImporter</Importer> 179 <Processor>TextureProcessor</Processor> 180 </Compile> 181 </ItemGroup> 182 <ItemGroup> 183 <Compile Include="Taskulampunvalo.png"> 184 <Name>Taskulampunvalo</Name> 185 <Importer>TextureImporter</Importer> 186 <Processor>TextureProcessor</Processor> 187 </Compile> 188 </ItemGroup> 189 <ItemGroup> 190 <Compile Include="Day of Chaos.mp3"> 191 <Name>Day of Chaos</Name> 192 <Importer>Mp3Importer</Importer> 193 <Processor>SongProcessor</Processor> 194 </Compile> 195 <Compile Include="Echoes of Time.mp3"> 196 <Name>Echoes of Time</Name> 197 <Importer>Mp3Importer</Importer> 198 <Processor>SongProcessor</Processor> 199 </Compile> 200 <Compile Include="Evening of Chaos.mp3"> 201 <Name>Evening of Chaos</Name> 202 <Importer>Mp3Importer</Importer> 203 <Processor>SongProcessor</Processor> 204 </Compile> 205 <Compile Include="Night of Chaos.mp3"> 206 <Name>Night of Chaos</Name> 207 <Importer>Mp3Importer</Importer> 208 <Processor>SongProcessor</Processor> 209 </Compile> 210 <Compile Include="Penumbra.mp3"> 211 <Name>Penumbra</Name> 212 <Importer>Mp3Importer</Importer> 213 <Processor>SongProcessor</Processor> 214 </Compile> 215 </ItemGroup> 216 <ItemGroup> 217 <Compile Include="Remmende_auto.wav"> 218 <Name>Remmende_auto</Name> 219 <Importer>WavImporter</Importer> 220 <Processor>SoundEffectProcessor</Processor> 221 </Compile> 222 <Compile Include="Reversed.wav"> 223 <Name>Reversed</Name> 224 <Importer>WavImporter</Importer> 225 <Processor>SoundEffectProcessor</Processor> 226 </Compile> 227 <Compile Include="Sinister.wav"> 228 <Name>Sinister</Name> 229 <Importer>WavImporter</Importer> 230 <Processor>SoundEffectProcessor</Processor> 231 </Compile> 232 </ItemGroup> 233 <ItemGroup> 234 <Compile Include="Ghost Kid.wav"> 235 <Name>Ghost Kid</Name> 236 <Importer>WavImporter</Importer> 237 <Processor>SoundEffectProcessor</Processor> 238 </Compile> 239 </ItemGroup> 240 <ItemGroup> 241 <Compile Include="What Child is this.mp3"> 242 <Name>What Child is this</Name> 243 <Importer>Mp3Importer</Importer> 244 <Processor>SongProcessor</Processor> 245 </Compile> 246 </ItemGroup> 247 <ItemGroup> 248 <Compile Include="Fucked up.wav"> 249 <Name>Fucked up</Name> 250 <Importer>WavImporter</Importer> 251 <Processor>SoundEffectProcessor</Processor> 252 </Compile> 253 </ItemGroup> 254 <ItemGroup> 255 <Compile Include="Scream.wav"> 256 <Name>Scream</Name> 257 <Importer>WavImporter</Importer> 258 <Processor>SoundEffectProcessor</Processor> 259 </Compile> 260 </ItemGroup> 261 <ItemGroup> 262 <Compile Include="Button.wav"> 263 <Name>Button</Name> 264 <Importer>WavImporter</Importer> 265 <Processor>SoundEffectProcessor</Processor> 266 </Compile> 267 </ItemGroup> 268 <ItemGroup> 269 <Compile Include="Shard.png"> 270 <Name>Shard</Name> 271 <Importer>TextureImporter</Importer> 272 <Processor>TextureProcessor</Processor> 273 </Compile> 274 </ItemGroup> 170 275 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 171 276 <!-- 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.