- Timestamp:
- 2012-06-07 22:04:45 (11 years ago)
- Location:
- 2012/23/RamiP/YAG2DSSBase/YAG2DSS
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKEngine/MusicPlayer.cs
r2811 r2854 116 116 Track StartingMusic = new Track("YAG2DSS"); 117 117 StartingMusic.FileName = "YAG2DSS"; 118 StartingMusic.VolumeModifier = 1.0;118 StartingMusic.VolumeModifier = 0.85; 119 119 120 120 Tracklist.Add(StartingMusic); -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKEngine/SoundPlayer.cs
r2811 r2854 86 86 public void PlaySound(int soundId) 87 87 { 88 if ( soundId > -1)88 if (ALTKConstants.bSoundEnabled) 89 89 { 90 soundEffect = ALTKHandler.Loader.loadSound(Soundlist[soundId].FileName); 90 if (soundId > -1) 91 { 92 soundEffect = ALTKHandler.Loader.loadSound(Soundlist[soundId].FileName); 93 } 94 else 95 { 96 if (soundEffectInstance != null) 97 soundEffectInstance.Stop(true); 98 return; 99 } 100 101 soundEffectInstance = soundEffect.CreateInstance(); 102 soundEffectInstance.Volume = Convert.ToSingle(Soundlist[soundId].VolumeModifier); 103 104 soundEffectInstance.Play(); 91 105 } 92 else93 {94 if (soundEffectInstance != null)95 soundEffectInstance.Stop(true);96 return;97 }98 99 soundEffectInstance = soundEffect.CreateInstance();100 soundEffectInstance.Volume = Convert.ToSingle(Soundlist[soundId].VolumeModifier);101 102 if (ALTKConstants.bSoundEnabled)103 soundEffectInstance.Play();104 106 } 105 107 … … 134 136 MinionGun.VolumeModifier = 1.0; 135 137 138 Sound AsteroidExplosion = new Sound("ASTEROIDEXPLOSION"); 139 AsteroidExplosion.FileName = "AsteroidExplosion"; 140 AsteroidExplosion.VolumeModifier = 1.0; 141 142 Sound MinionProjHit = new Sound("MINIONPROJHITPLAYER"); 143 MinionProjHit.FileName = "MinionProjHit"; 144 MinionProjHit.VolumeModifier = 1.0; 145 146 Sound PlayerCollision = new Sound("PLAYERCOLLISION"); 147 PlayerCollision.FileName = "PlayerCollision"; 148 PlayerCollision.VolumeModifier = 0.6; 149 136 150 Soundlist.Add(PlayerGun); 137 151 Soundlist.Add(ShipEngine); 138 152 Soundlist.Add(Wormhole); 139 153 Soundlist.Add(MinionGun); 154 Soundlist.Add(AsteroidExplosion); 155 Soundlist.Add(MinionProjHit); // id 5 156 Soundlist.Add(PlayerCollision); 140 157 141 158 base.Initialize(); -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKEngine/StaticAnimHandler.cs
r2841 r2854 39 39 40 40 return -1; 41 } 42 43 /// <summary> 44 /// Removes all static animation instances that currently exist. 45 /// </summary> 46 public void ClearAnims() 47 { 48 AnimInstances.Clear(); 41 49 } 42 50 -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKHandler.cs
r2848 r2854 80 80 ScoreDisplayers.Add(CreateScoreDisplayer(new Vector2(ALTKConstants.WindowWidth - 105.0f, 5.0f))); 81 81 ScoreDisplayers.Add(CreateScoreDisplayer(new Vector2(5.0f, 5.0f))); 82 ScoreDisplayers.Add(CreateScoreDisplayer(new Vector2((ALTKConstants.WindowWidth / 2.0f) - 50.0f, 5.0f))); 83 ScoreDisplayers[2].Color = Color.Gold; 82 84 Game.Components.Add(ScoreDisplayers[0]); 83 85 Game.Components.Add(ScoreDisplayers[1]); 86 Game.Components.Add(ScoreDisplayers[2]); 84 87 85 88 ScoreRatioDisplayers.Add(CreateScoreRatioDisplayer(new Vector2(ALTKConstants.WindowWidth - 145.0f, 5.0f))); -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/YAG2DSS.cs
r2848 r2854 55 55 56 56 57 double Pelaajan1Kerroin = 1. 5;58 double Pelaajan2Kerroin = 1. 5;57 double Pelaajan1Kerroin = 1.0; 58 double Pelaajan2Kerroin = 1.0; 59 59 60 60 public override void Begin() … … 486 486 { 487 487 kohde.Mass = (Math.Abs((kohde.Left - kohde.Right) * (kohde.Top - kohde.Bottom))) / 20; 488 kohde.Size = kohde.Size * 0. 84;488 kohde.Size = kohde.Size * 0.7; 489 489 490 490 AsteroidHitEffect(PelaajanAmmus.Position); … … 586 586 AsteroidHitEffect(asteroidi.Position); 587 587 asteroidi.Mass = (Math.Abs((asteroidi.Left - asteroidi.Right) * (asteroidi.Top - asteroidi.Bottom))) / 20; 588 asteroidi.Size = asteroidi.Size * 0. 86;588 asteroidi.Size = asteroidi.Size * 0.7; 589 589 LisaaPisteita(0, Convert.ToInt32((1 / asteroidi.Mass) * 5 * Pelaajan1Kerroin)); 590 if (asteroidi.Mass < 20)590 if (asteroidi.Mass < 40) 591 591 { 592 592 TuhoaAsteroidiEfekti(asteroidi.Position); … … 600 600 AsteroidHitEffect(asteroidi.Position); 601 601 asteroidi.Mass = (Math.Abs((asteroidi.Left - asteroidi.Right) * (asteroidi.Top - asteroidi.Bottom))) / 20; 602 asteroidi.Size = asteroidi.Size * 0. 86;602 asteroidi.Size = asteroidi.Size * 0.7; 603 603 LisaaPisteita(1, Convert.ToInt32((1 / asteroidi.Mass) * 5 * Pelaajan2Kerroin)); 604 if (asteroidi.Mass < 20)604 if (asteroidi.Mass < 40) 605 605 { 606 606 TuhoaAsteroidiEfekti(asteroidi.Position); … … 614 614 { 615 615 ALTKHandler.HealthBars[0].Value = Convert.ToInt32(Convert.ToDouble(ALTKHandler.HealthBars[0].Value) * (1 - ((asteroidi.Mass / 360.0)))); 616 ALTKHandler.SoundPlayer.PlaySound(6); 616 617 PelaajanTuhoaja(); 617 618 } … … 619 620 { 620 621 ALTKHandler.HealthBars[1].Value = Convert.ToInt32(Convert.ToDouble(ALTKHandler.HealthBars[1].Value) * (1 - ((asteroidi.Mass / 360.0)))); 622 ALTKHandler.SoundPlayer.PlaySound(6); 621 623 PelaajanTuhoaja(); 622 624 } … … 632 634 ALTKHandler.StaticAnimHandler.AddStaticAnim(19, 633 635 ALTKHandler.AdjustJypeliVectorToXna(position.X, position.Y)); 636 ALTKHandler.SoundPlayer.PlaySound(4); 634 637 } 635 638 … … 640 643 ALTKHandler.StaticAnimHandler.AddStaticAnim(20, 641 644 ALTKHandler.AdjustJypeliVectorToXna(paikka.X, paikka.Y)); 645 //ALTKHandler.SoundPlayer.PlaySound(4); 642 646 } 643 647 … … 765 769 766 770 ALTKHandler.StaticAnimHandler.AddStaticAnim(16, ALTKHandler.AdjustJypeliVectorToXna(x, y)); 771 ALTKHandler.SoundPlayer.PlaySound(2); 767 772 768 773 Timer.SingleShot(2, LuoMadonreika); … … 785 790 madonreika.AngularVelocity = 1; 786 791 LuoMinioni(Madonreika.Count - 1); 787 788 ALTKHandler.SoundPlayer.PlaySound(2);789 792 } 790 793 … … 895 898 ALTKHandler.HealthBars[0].Value = ALTKHandler.HealthBars[0].Value - 17; 896 899 PlayerHitES.AddEffect(kohde.Position, 150); 900 ALTKHandler.SoundPlayer.PlaySound(6); 897 901 PelaajanTuhoaja(); 898 902 } … … 901 905 ALTKHandler.HealthBars[1].Value = ALTKHandler.HealthBars[1].Value - 17; 902 906 PlayerHitES.AddEffect(kohde.Position, 150); 907 ALTKHandler.SoundPlayer.PlaySound(6); 903 908 PelaajanTuhoaja(); 904 909 } … … 968 973 ALTKHandler.HealthBars[0].Value = ALTKHandler.HealthBars[0].Value - 10 ; 969 974 PlayerHitES.AddEffect(kohde.Position, 150); 975 ALTKHandler.SoundPlayer.PlaySound(5); 970 976 PelaajanTuhoaja(); 971 977 } … … 974 980 ALTKHandler.HealthBars[1].Value = ALTKHandler.HealthBars[1].Value - 10; 975 981 PlayerHitES.AddEffect(kohde.Position, 150); 982 ALTKHandler.SoundPlayer.PlaySound(5); 976 983 PelaajanTuhoaja(); 977 984 } … … 1000 1007 { 1001 1008 if (pelaajaID == 0) 1009 { 1002 1010 Pelaajan1Pisteet = Pelaajan1Pisteet + pistemaara; 1003 1011 1012 if (Pelaajan1Pisteet > 999) 1013 ALTKHandler.ScoreDisplayers[0].Color = Microsoft.Xna.Framework.Color.Red; 1014 } 1015 1016 1004 1017 if (pelaajaID == 1) 1018 { 1005 1019 Pelaajan2Pisteet = Pelaajan2Pisteet + pistemaara; 1020 1021 if (Pelaajan2Pisteet > 999) 1022 ALTKHandler.ScoreDisplayers[1].Color = Microsoft.Xna.Framework.Color.Red; 1023 } 1006 1024 } 1007 1025 … … 1067 1085 } 1068 1086 1069 void PowerUps(PhysicsObject PowerUp, PhysicsObject kohde) 1087 void PowerUpCollisionHandler(PhysicsObject Powerup, PhysicsObject kohde) 1088 { 1089 int powUp = (int)Powerup.Tag; 1090 int pelaaja = (int)kohde.Tag; 1091 1092 if (powUp == 200) 1093 { 1094 if (pelaaja == 11) 1095 { 1096 if (ALTKHandler.HealthBars[0].Value < 80) 1097 { 1098 ALTKHandler.HealthBars[0].Value = Convert.ToInt32(ALTKHandler.HealthBars[0].Value + 20); 1099 Powerup.Destroy(); 1100 } 1101 else 1102 { 1103 ALTKHandler.HealthBars[0].Value = 100; 1104 } 1105 Powerup.Destroy(); 1106 } 1107 else if (pelaaja == 22) 1108 { 1109 if (ALTKHandler.HealthBars[1].Value < 80) 1110 { 1111 ALTKHandler.HealthBars[1].Value = Convert.ToInt32(ALTKHandler.HealthBars[1].Value + 20); 1112 } 1113 else 1114 { 1115 ALTKHandler.HealthBars[1].Value = 100; 1116 } 1117 Powerup.Destroy(); 1118 } 1119 } 1120 else if (powUp == 201) 1121 { 1122 if (pelaaja == 11) 1123 { 1124 Konekivaari1.Start(200); 1125 Powerup.Destroy(); 1126 } 1127 else if (pelaaja == 12) 1128 { 1129 Konekivaari1.Start(200); 1130 Powerup.Destroy(); 1131 } 1132 } 1133 else if (powUp == 202) 1134 { 1135 if (pelaaja == 11) 1136 { 1137 Triplefire1.Start(50); 1138 Powerup.Destroy(); 1139 } 1140 else if (pelaaja == 22) 1141 { 1142 Triplefire2.Start(50); 1143 Powerup.Destroy(); 1144 } 1145 } 1146 else if (powUp == 203) 1147 { 1148 if (pelaaja == 11) 1149 { 1150 ALTKHandler.HealthBars[0].Value = 100; 1151 } 1152 else if (pelaaja == 22) 1153 { 1154 ALTKHandler.HealthBars[1].Value = 100; 1155 } 1156 } 1157 } 1158 1159 void PowerUps(double position) 1070 1160 { 1071 1161 int arvo = RandomGen.NextInt(10); 1072 int pelaaja = (int)kohde.Tag;1162 //int pelaaja = (int)pelaajaID].Tag; 1073 1163 1074 1164 if (arvo == 1) 1075 1165 { 1076 1166 //Energiaboosti 1077 PhysicsObject Energia10 = PhysicsObject.CreateStaticObject (25, 25, Shape.Hexagon); 1078 Energia10.Color = Color.Green; 1167 PhysicsObject Energia10 = PhysicsObject.CreateStaticObject (25, 25); 1079 1168 Energia10.CollisionIgnoreGroup = 5; 1169 Energia10.Tag = 200; 1170 AddCollisionHandler(Energia10, PowerUpCollisionHandler); 1080 1171 Add(Energia10); 1081 if (pelaaja == 11) 1082 { 1083 if (ALTKHandler.HealthBars[0].Value < 80) 1084 { 1085 ALTKHandler.HealthBars[0].Value = Convert.ToInt32(ALTKHandler.HealthBars[0].Value + 20); 1086 Energia10.Destroy(); 1087 } 1088 else 1089 { 1090 ALTKHandler.HealthBars[0].Value = 100; 1091 } 1092 Energia10.Destroy(); 1093 } 1094 else if (pelaaja == 22) 1095 { 1096 if (ALTKHandler.HealthBars[1].Value < 80) 1097 { 1098 ALTKHandler.HealthBars[1].Value = Convert.ToInt32(ALTKHandler.HealthBars[1].Value + 20); 1099 } 1100 else 1101 { 1102 ALTKHandler.HealthBars[1].Value = 100; 1103 } 1104 Energia10.Destroy(); 1105 } 1106 1172 1107 1173 } 1108 1174 else if (arvo == 3) … … 1111 1177 PhysicsObject Konekivaari = PhysicsObject.CreateStaticObject(25, 25); 1112 1178 Konekivaari.Color = Color.Blue; 1113 Add(Konekivaari); 1114 1115 if (pelaaja == 11) 1116 { 1117 Konekivaari1.Start(200); 1118 Konekivaari.Destroy(); 1119 } 1120 else if (pelaaja == 12) 1121 { 1122 Konekivaari1.Start(200); 1123 Konekivaari.Destroy(); 1124 } 1125 1179 Konekivaari.Tag = 201; 1180 AddCollisionHandler(Konekivaari, PowerUpCollisionHandler); 1181 Add(Konekivaari); 1126 1182 } 1127 1183 else if (arvo == 4) … … 1130 1186 PhysicsObject TripleFire = PhysicsObject.CreateStaticObject(25, 25, Shape.Triangle); 1131 1187 TripleFire.Color = Color.Red; 1132 Add(TripleFire); 1133 1134 if (pelaaja == 11) 1135 { 1136 Triplefire1.Start(50); 1137 TripleFire.Destroy(); 1138 } 1139 else if (pelaaja == 22) 1140 { 1141 Triplefire2.Start(50); 1142 TripleFire.Destroy(); 1143 } 1188 TripleFire.Tag = 3; 1189 AddCollisionHandler(TripleFire, PowerUpCollisionHandler); 1190 Add(TripleFire); 1144 1191 } 1145 1192 else if (arvo == 5) 1146 1193 { 1147 1194 //Full restore 1195 PhysicsObject FullRestore = PhysicsObject.CreateStaticObject(25, 25); 1196 FullRestore.Tag = 204; 1197 AddCollisionHandler(FullRestore, PowerUpCollisionHandler); 1198 Add(FullRestore); 1148 1199 } 1149 1200 else … … 1160 1211 Madonreika.Clear(); 1161 1212 Begin(); 1213 ALTKHandler.StaticAnimHandler.ClearAnims(); 1214 AddInitialAnims(); 1162 1215 ALTKHandler.HealthBars[0].Value = 100; 1163 1216 ALTKHandler.HealthBars[1].Value = 100; 1217 1218 Pelaajan1Pisteet = 0; 1219 Pelaajan1Kerroin = 1.0; 1220 1221 Pelaajan2Pisteet = 0; 1222 Pelaajan2Kerroin = 1.0; 1164 1223 } 1165 1224 … … 1184 1243 ALTKHandler.ScoreDisplayers[0].Value = Pelaajan1Pisteet; 1185 1244 ALTKHandler.ScoreDisplayers[1].Value = Pelaajan2Pisteet; 1245 ALTKHandler.ScoreDisplayers[2].Value = Pelaajan1Pisteet + Pelaajan2Pisteet; 1186 1246 1187 1247 ALTKHandler.ScoreRatioDisplayers[0].Value = Pelaajan1Kerroin; … … 1241 1301 this.Components.Add(altkHandler); 1242 1302 1303 AddInitialAnims(); 1304 } 1305 1306 private void AddInitialAnims() 1307 { 1243 1308 ALTKHandler.StaticAnimHandler.AddStaticAnim("STARS_1", new Microsoft.Xna.Framework.Vector2(0, 0)); 1244 1309 ALTKHandler.StaticAnimHandler.AddStaticAnim("STARS_2", new Microsoft.Xna.Framework.Vector2(0, 0)); … … 1253 1318 ALTKHandler.StaticAnimHandler.AddStaticAnim("STARSMOKE_RED", new Microsoft.Xna.Framework.Vector2(-350, -200)); 1254 1319 ALTKHandler.StaticAnimHandler.AddStaticAnim("STARSMOKE_WHITE", new Microsoft.Xna.Framework.Vector2(-300, 250)); 1255 1256 1320 } 1257 1321 -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSSContent/YAG2DSSContent.contentproj
r2841 r2854 283 283 </None> 284 284 </ItemGroup> 285 <ItemGroup> 286 <None Include="Sounds\AsteroidExplosion.wav"> 287 <Name>AsteroidExplosion</Name> 288 <Importer>WavImporter</Importer> 289 <Processor>SoundEffectProcessor</Processor> 290 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 291 </None> 292 <None Include="Sounds\MinionProjHit.wav"> 293 <Name>MinionProjHit</Name> 294 <Importer>WavImporter</Importer> 295 <Processor>SoundEffectProcessor</Processor> 296 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 297 </None> 298 <None Include="Sounds\PlayerCollision.wav"> 299 <Name>PlayerCollision</Name> 300 <Importer>WavImporter</Importer> 301 <Processor>SoundEffectProcessor</Processor> 302 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 303 </None> 304 </ItemGroup> 285 305 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 286 306 <!-- 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.