- Timestamp:
- 2012-06-08 13:25:50 (11 years ago)
- Location:
- 2012/23/RamiP/YAG2DSSBase/YAG2DSS
- Files:
-
- 13 added
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKEngine/Cursor.cs
r2768 r2883 181 181 public override void Draw(GameTime gameTime) 182 182 { 183 //MouseState ms = Mouse.GetState(); 183 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); 184 spriteBatch.Draw(cursorTexture, new Rectangle(SecPosX, SecPosY, 32, 32), Color.White); 185 spriteBatch.End(); 184 186 185 //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); 186 ////spriteBatch.Draw(cursorTexture, new Rectangle(ms.X, ms.Y, 32, 32), Color.White); 187 //spriteBatch.End(); 188 189 //base.Draw(gameTime); 190 //spriteBatch.End(); 187 base.Draw(gameTime); 191 188 } 192 189 } -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKEngine/MusicPlayer.cs
r2854 r2883 52 52 public List<Track> Tracklist = new List<Track>(); 53 53 54 SoundEffect soundEffect;55 SoundEffectInstance soundEffectInstance;54 public SoundEffect soundEffect; 55 public SoundEffectInstance soundEffectInstance; 56 56 57 57 public MusicPlayer(Game game) … … 114 114 // TODO: Add your initialization code here 115 115 116 Track StartingMusic = new Track("YAG2DSS"); 117 StartingMusic.FileName = "YAG2DSS"; 118 StartingMusic.VolumeModifier = 0.85; 116 Track StartingMusic = new Track("INTRO"); 117 StartingMusic.FileName = "Intro"; 118 StartingMusic.VolumeModifier = 0.425; 119 120 Track LoopMusic = new Track("LOOP"); 121 LoopMusic.FileName = "Loop"; 122 LoopMusic.VolumeModifier = 0.425; 119 123 120 124 Tracklist.Add(StartingMusic); 125 Tracklist.Add(LoopMusic); 121 126 122 127 base.Initialize(); -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKEngine/SoundPlayer.cs
r2854 r2883 52 52 public List<Sound> Soundlist = new List<Sound>(); 53 53 54 SoundEffect soundEffect;55 SoundEffectInstance soundEffectInstance;54 public SoundEffect soundEffect; 55 public SoundEffectInstance soundEffectInstance; 56 56 57 57 public SoundPlayer(Game game) … … 122 122 Sound PlayerGun = new Sound("PLAYERGUN"); 123 123 PlayerGun.FileName = "PlayerGun"; 124 PlayerGun.VolumeModifier = 0. 5;124 PlayerGun.VolumeModifier = 0.25; 125 125 126 126 Sound ShipEngine = new Sound("SHIPENGINE"); 127 127 ShipEngine.FileName = "ShipEngine"; 128 ShipEngine.VolumeModifier = 1.0;128 ShipEngine.VolumeModifier = 0.5; 129 129 130 130 Sound Wormhole = new Sound("WORMHOLE"); 131 131 Wormhole.FileName = "Wormhole"; 132 Wormhole.VolumeModifier = 1.0;132 Wormhole.VolumeModifier = 0.5; 133 133 134 134 Sound MinionGun = new Sound("MINIONGUN"); 135 135 MinionGun.FileName = "MinionGun"; 136 MinionGun.VolumeModifier = 1.0;136 MinionGun.VolumeModifier = 0.5; 137 137 138 138 Sound AsteroidExplosion = new Sound("ASTEROIDEXPLOSION"); 139 139 AsteroidExplosion.FileName = "AsteroidExplosion"; 140 AsteroidExplosion.VolumeModifier = 1.0;140 AsteroidExplosion.VolumeModifier = 0.5; 141 141 142 142 Sound MinionProjHit = new Sound("MINIONPROJHITPLAYER"); 143 143 MinionProjHit.FileName = "MinionProjHit"; 144 MinionProjHit.VolumeModifier = 1.0;144 MinionProjHit.VolumeModifier = 0.5; 145 145 146 146 Sound PlayerCollision = new Sound("PLAYERCOLLISION"); 147 147 PlayerCollision.FileName = "PlayerCollision"; 148 PlayerCollision.VolumeModifier = 0.6; 148 PlayerCollision.VolumeModifier = 0.5; 149 150 Sound PlayerExplosion = new Sound("PLAYEREXPLOSION"); 151 PlayerExplosion.FileName = "PlayerExplosion"; 152 PlayerExplosion.VolumeModifier = 1.0; 153 154 Sound WormholeExplosion = new Sound("WormholeExplosion"); 155 WormholeExplosion.FileName = "WormholeExplosion"; 156 WormholeExplosion.VolumeModifier = 0.5; 157 158 Sound WormholeHit = new Sound("WormholeHit"); 159 WormholeHit.FileName = "WormholeHit"; 160 WormholeHit.VolumeModifier = 0.3; 161 162 Sound MinionExplosion = new Sound("MinionExplosion"); 163 MinionExplosion.FileName = "MinionExplosion"; 164 MinionExplosion.VolumeModifier = 0.5; 165 166 Sound PowerupPicked = new Sound("PowerupPicked"); 167 PowerupPicked.FileName = "PowerupPicked"; 168 PowerupPicked.VolumeModifier = 0.5; 149 169 150 170 Soundlist.Add(PlayerGun); … … 155 175 Soundlist.Add(MinionProjHit); // id 5 156 176 Soundlist.Add(PlayerCollision); 177 Soundlist.Add(PlayerExplosion); 178 Soundlist.Add(WormholeExplosion); 179 Soundlist.Add(WormholeHit); 180 Soundlist.Add(MinionExplosion); // id 10 181 Soundlist.Add(PowerupPicked); 157 182 158 183 base.Initialize(); -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/ALTKHandler.cs
r2854 r2883 24 24 } 25 25 26 public static GUI.Dialogs.ExitWindow ExitWindow; 27 public static GUI.Dialogs.GameSettingsWindow GameSettingsWindow; 28 26 29 public static Loader Loader; 27 30 public static Cursor Cursor; 28 31 public static StaticAnimHandler StaticAnimHandler; 29 public static GUI.Dialogs.ExitWindow ExitWindow;30 32 public static GUI.AMessageDisplay MessageDisplay; 31 33 public static List<GUI.ALineBar> HealthBars = new List<GUI.ALineBar>(); … … 43 45 // TODO: Add your initialization code here 44 46 47 GameSettings.SetInitialSettings(); 48 45 49 base.Initialize(); 46 50 … … 54 58 Cursor = new Cursor(Game); 55 59 Cursor.Initialize(); 56 Cursor.Visible = false;60 //Cursor.Visible = false; 57 61 Game.Components.Add(Cursor); 58 62 … … 62 66 ExitWindow.Enabled = false; 63 67 Game.Components.Add(ExitWindow); 68 69 GameSettingsWindow = new GUI.Dialogs.GameSettingsWindow(Game); 70 GameSettingsWindow.Initialize(); 71 GameSettingsWindow.Visible = true; 72 GameSettingsWindow.Enabled = true; 73 Game.Components.Add(GameSettingsWindow); 64 74 65 75 MessageDisplay = new GUI.AMessageDisplay(Game); … … 93 103 MusicPlayer = new Audio.MusicPlayer(Game); 94 104 MusicPlayer.Initialize(); 95 MusicPlayer.LoadTrack(" YAG2DSS", true);105 MusicPlayer.LoadTrack("INTRO", false); 96 106 97 107 SoundPlayer = new Audio.SoundPlayer(Game); -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/GUI/AChoiceButton.cs
r2768 r2883 19 19 20 20 // A multichoice button which allows you to switch the button's item by clicking on it. 21 public class ACho oseButton : DrawableGameComponent21 public class AChoiceButton : DrawableGameComponent 22 22 { 23 23 TimeSpan elapsedTime = TimeSpan.Zero; … … 57 57 public int NumItems; 58 58 public int CurrentIndex; 59 public string[] Items = new string[100]; 60 public bool[] ForbiddenItems = new bool[100]; 59 public List<string> Items = new List<string>(); 61 60 62 61 public event ChangedEventHandler Changed; … … 66 65 public int MaximumAllowedIndex = 33; 67 66 68 public ACho oseButton(Game game)67 public AChoiceButton(Game game) 69 68 : base(game) 70 69 { … … 92 91 public override void Update(GameTime gameTime) 93 92 { 94 int mpX = Cursor. PosX;95 int mpY = Cursor. PosY;96 97 if (mpX > this.PositionX - (this.Width * .25)&&98 mpX < this.PositionX + (this.Width / 2)&&99 mpY > this.PositionY - (this.Height * .25)&&100 mpY < this.PositionY + (this.Height / 2)&&93 int mpX = Cursor.SecPosX; 94 int mpY = Cursor.SecPosY; 95 96 if (mpX > this.PositionX && 97 mpX < this.PositionX + this.Width && 98 mpY > this.PositionY && 99 mpY < this.PositionY + this.Height && 101 100 Locked == false) 102 101 { … … 123 122 if (NextItem == NumItems) 124 123 { 125 if (ForbiddenItems[0] == false) 126 { 127 CurrentIndex = 0; 128 OnChanged(EventArgs.Empty); 129 HasChanged = true; 130 } 131 break; 132 } 133 else if (ForbiddenItems[NextItem] == true) 134 { 135 NextItem = NextItem + 1; 124 CurrentIndex = 0; 125 OnChanged(EventArgs.Empty); 126 HasChanged = true; 127 break; 136 128 } 137 129 else … … 155 147 if (NextItem == -1) 156 148 { 157 if ( ForbiddenItems[NumItems - 1] == false &&(MaximumAllowedIndex == 0 | MaximumAllowedIndex > NumItems - 1))149 if ((MaximumAllowedIndex == 0 | MaximumAllowedIndex > NumItems - 1)) 158 150 { 159 151 CurrentIndex = NumItems - 1; … … 162 154 } 163 155 break; 164 }165 else if (ForbiddenItems[NextItem] == true)166 {167 NextItem = NextItem - 1;168 156 } 169 157 else … … 189 177 } 190 178 179 public void Update(GameTime gameTime, int baseY, int baseX) 180 { 181 int mpX = Cursor.SecPosX; 182 int mpY = Cursor.SecPosY; 183 184 if (mpX > this.PositionX + baseX && 185 mpX < this.PositionX + this.Width + baseX && 186 mpY > this.PositionY + baseY && 187 mpY < this.PositionY + this.Height + baseY && 188 Locked == false) 189 { 190 this.TextColorCurrent = TextColorPressed; 191 if (Cursor.SecLeftClicked) 192 { 193 if (CurrentIndex == 1) 194 CurrentIndex = 0; 195 else 196 CurrentIndex = 1; 197 } 198 } 199 else 200 { 201 this.TextColorCurrent = TextColor; 202 Pressed = false; 203 } 204 } 205 191 206 public override void Draw(GameTime gameTime) 192 207 { … … 201 216 spriteBatch.End(); 202 217 } 218 219 public void Draw(GameTime gameTime, int baseX, int baseY) 220 { 221 spriteBatch.Begin(); 222 Vector2 pos = new Vector2(PositionX + baseX, PositionY + baseY); 223 if (Texture != null) 224 { 225 spriteBatch.Draw(Texture, pos, Color.White); 226 } 227 spriteBatch.DrawString(spriteFont, Items[CurrentIndex], new Vector2(pos.X + 1, pos.Y + 1), Color.Black); 228 spriteBatch.DrawString(spriteFont, Items[CurrentIndex], pos, TextColorCurrent); 229 spriteBatch.End(); 230 } 203 231 } 204 232 -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/GUI/ATextBox.cs
r2811 r2883 28 28 SpriteBatch spriteBatch; 29 29 SpriteFont spriteFont; 30 public bool UseListBoxFont = true;31 32 public int SelectedItemIndex = -1;33 30 34 31 public int Width = 200; … … 53 50 public bool MousePressed = false; 54 51 55 public int Spacing;56 57 52 public bool Selected = false; 58 53 public bool EnterPressed = false; … … 142 137 if (spriteFont.MeasureString(Text + " ").X > Width) 143 138 { 144 EnterPressed = true;139 Text = Text.Remove(Text.Length - 1); 145 140 } 146 141 } -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/GUI/Dialogs/ExitWindow.cs
r2817 r2883 191 191 // TODO: Add your update code here 192 192 193 bool cursorOnChoice = false;194 195 193 if (Cursor.SecPosX > sizePos.X && Cursor.SecPosY > sizePos.Y && 196 194 Cursor.SecPosX < sizePos.X + sizePos.Width && Cursor.SecPosY < sizePos.Y + sizePos.Height) … … 204 202 mousePosY = Cursor.SecPosY; 205 203 206 if (Cursor.SecLeftPressed && System.Windows.Forms.Form.ActiveForm != null && cursorOnChoice == false)204 if (Cursor.SecLeftPressed && System.Windows.Forms.Form.ActiveForm != null) 207 205 { 208 206 if (MousePressed == true) -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/Properties/AssemblyInfo.cs
r2768 r2883 8 8 [assembly: AssemblyTitle("YAG2DSS")] 9 9 [assembly: AssemblyProduct("YAG2DSS")] 10 [assembly: AssemblyDescription(" ")]10 [assembly: AssemblyDescription("Yet Another Generic 2D Space Shooter")] 11 11 [assembly: AssemblyCompany("")] 12 [assembly: AssemblyCopyright("Copyright © 2012")]12 [assembly: AssemblyCopyright("Copyright © Rampastring & Tetraedri 2012")] 13 13 [assembly: AssemblyTrademark("")] 14 14 [assembly: AssemblyCulture("")] -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/YAG2DSS.cs
r2854 r2883 54 54 int Pelaajan2Pisteet = 0; 55 55 56 56 public bool Initialized = false; 57 public static bool SettingsConfirmed = false; 58 57 59 double Pelaajan1Kerroin = 1.0; 58 60 double Pelaajan2Kerroin = 1.0; … … 60 62 public override void Begin() 61 63 { 62 #region Cursor handling 64 if (!Initialized) 65 { 66 SetWindowSize(1024, 768, true); 67 68 KeyboardEventInput.Initialize(this.Window); 69 70 #region Cursor handling 71 CreateCursor(); 72 73 Initialized = true; 74 #endregion 75 } 76 77 Level.BackgroundColor = Color.Black; 78 79 Camera.ZoomToLevel(); 80 81 if (SettingsConfirmed) 82 { 83 LuoKentta(); 84 AsetaNappaimet(); 85 LuoAjastin(); 86 //LuoMadonreika(); 87 //PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 88 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ShowExit, "Lopeta peli"); 89 Explotions(); 90 } 91 } 92 93 public void CreateCursor() 94 { 63 95 Kursori = new GameObject(32, 32); 64 96 Kursori.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "cursor.png")); … … 67 99 Mouse.ListenMovement(0.1, handler, ""); 68 100 Add(Kursori); 69 #endregion70 LuoKentta();71 AsetaNappaimet();72 LuoAjastin();73 //LuoMadonreika();74 //PhoneBackButton.Listen(ConfirmExit, "Lopeta peli");75 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ShowExit, "Lopeta peli");76 Explotions();77 101 } 78 102 … … 258 282 alaReuna.CollisionIgnoreGroup = 3; 259 283 260 Level.BackgroundColor = Color.Black;261 262 Camera.ZoomToLevel();263 264 284 LuoPelaaja(300); 265 285 Pelaaja[0].Tag = 11; … … 322 342 323 343 Vaikeuttaja = new Timer(); 324 Vaikeuttaja.Interval = 5.0;344 Vaikeuttaja.Interval = 6.0; 325 345 Vaikeuttaja.Timeout += new Action(Vaikeuttaja_Timeout); 326 346 Vaikeuttaja.Start(); … … 341 361 Triplefire1 = new Timer(); 342 362 Triplefire1.Interval = 0.2; 363 Triplefire1.Timeout += new Action(Triplefire1_Timeout); 364 365 Triplefire2 = new Timer(); 366 Triplefire2.Interval = 0.2; 367 Triplefire2.Timeout += new Action(Triplefire2_Timeout); 368 369 } 370 371 void Triplefire2_Timeout() 372 { 373 if (Keyboard.GetKeyState(Key.LeftShift) == ButtonState.Down) 374 { 375 LuoPelaajanAmmus(1, Angle.FromDegrees(Pelaaja[1].Angle.Degrees + 20)); 376 LuoPelaajanAmmus(1, Angle.FromDegrees(Pelaaja[1].Angle.Degrees - 20)); 377 } 378 } 379 380 void Triplefire1_Timeout() 381 { 382 if (Keyboard.GetKeyState(Key.RightShift) == ButtonState.Down) 383 { 384 LuoPelaajanAmmus(0, Angle.FromDegrees(Pelaaja[0].Angle.Degrees + 20)); 385 LuoPelaajanAmmus(0, Angle.FromDegrees(Pelaaja[0].Angle.Degrees - 20)); 386 387 } 343 388 } 344 389 … … 346 391 { 347 392 if (Keyboard.GetKeyState(Key.RightShift) == ButtonState.Down) 348 LuoPelaajanAmmus(0 );393 LuoPelaajanAmmus(0, Pelaaja[0].Angle); 349 394 } 350 395 … … 353 398 { 354 399 if (Keyboard.GetKeyState(Key.LeftShift) == ButtonState.Down) 355 LuoPelaajanAmmus(1 );400 LuoPelaajanAmmus(1, Pelaaja[1].Angle); 356 401 } 357 402 … … 362 407 Asteroidiajastin.Interval = Asteroidiajastin.Interval * 0.9; 363 408 MinioninAmmus.Interval = MinioninAmmus.Interval * 0.95; 364 Vaikeuttaja.Interval = Vaikeuttaja.Interval * 1.2 ;409 Vaikeuttaja.Interval = Vaikeuttaja.Interval * 1.25; 365 410 } 366 411 … … 386 431 } 387 432 388 void LuoPelaajanAmmus(int pelaajaID )433 void LuoPelaajanAmmus(int pelaajaID, Angle angle) 389 434 { 390 435 if (Pelaaja[pelaajaID].IsDestroyed) … … 396 441 PelaajanAmmus.Shape = Shape.Rectangle; 397 442 398 PelaajanAmmus.Angle = Pelaaja[pelaajaID].Angle;443 PelaajanAmmus.Angle = angle; 399 444 PelaajanAmmus.Width = 12; 400 445 PelaajanAmmus.Height = 3; 401 446 PelaajanAmmus.Position = Pelaaja[pelaajaID].Position; 402 447 403 Vector jotain = Vector.FromLengthAndAngle(25.0, Pelaaja[pelaajaID].Angle);448 Vector jotain = Vector.FromLengthAndAngle(25.0, angle); 404 449 PelaajanAmmus.Position = PelaajanAmmus.Position + jotain; 405 450 PelaajanAmmus.Mass = 1; … … 441 486 ALTKHandler.StaticAnimHandler.AddStaticAnim(17, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 442 487 ALTKHandler.StaticAnimHandler.AddStaticAnim(18, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 488 ALTKHandler.SoundPlayer.PlaySound(10); 443 489 kohde.Destroy(); 444 490 if (ammuksenTagi == 1) … … 457 503 WormholeExplosionES.AddEffect(PelaajanAmmus.Position, 150); 458 504 WormholeExplosionES2.AddEffect(PelaajanAmmus.Position, 5); 505 ALTKHandler.SoundPlayer.PlaySound(9); 459 506 460 507 if (ammuksenTagi == 1) … … 473 520 ALTKHandler.StaticAnimHandler.AddStaticAnim(15, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 474 521 kohde.Destroy(); 522 ALTKHandler.SoundPlayer.PlaySound(8); 523 CreatePowerUp(kohde.Position); 524 475 525 if (ammuksenTagi == 1) 476 526 { … … 494 544 LisaaPisteita(0, Convert.ToInt32((1 / kohde.Mass) * 5 * Pelaajan1Kerroin)); 495 545 496 if (kohde.Mass < (Math.Abs((kohde.Left - kohde.Right) * (kohde.Top - kohde.Bottom))) / 20)546 if (kohde.Mass < 40.0) 497 547 { 498 548 TuhoaAsteroidiEfekti(kohde.Position); 549 kohde.Destroy(); 499 550 LisaaKerrointa(0, 0.5); 500 551 } … … 504 555 LisaaPisteita(1, Convert.ToInt32((1 / kohde.Mass) * 5 * Pelaajan2Kerroin)); 505 556 506 if (kohde.Mass < (Math.Abs((kohde.Left - kohde.Right) * (kohde.Top - kohde.Bottom))) / 20)557 if (kohde.Mass < 40.0) 507 558 { 508 559 TuhoaAsteroidiEfekti(kohde.Position); 560 kohde.Destroy(); 509 561 LisaaKerrointa(1, 0.5); 510 562 } … … 548 600 ALTKHandler.StaticAnimHandler.AddStaticAnim(17, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 549 601 ALTKHandler.StaticAnimHandler.AddStaticAnim(18, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 602 ALTKHandler.SoundPlayer.PlaySound(10); 550 603 551 604 PlayerHitES.AddEffect(kohde.Position, 150); … … 562 615 ALTKHandler.StaticAnimHandler.AddStaticAnim(17, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 563 616 ALTKHandler.StaticAnimHandler.AddStaticAnim(18, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 617 ALTKHandler.SoundPlayer.PlaySound(10); 564 618 565 619 PlayerHitES.AddEffect(kohde.Position, 150); … … 701 755 void AjaLuoPelaajan1Ammus() 702 756 { 703 LuoPelaajanAmmus(0 );757 LuoPelaajanAmmus(0, Pelaaja[0].Angle); 704 758 } 705 759 706 760 void AjaLuoPelaajan2Ammus() 707 761 { 708 LuoPelaajanAmmus(1 );762 LuoPelaajanAmmus(1, Pelaaja[1].Angle); 709 763 } 710 764 … … 840 894 PhysicsObject asteroidi = new PhysicsObject (RandomGen.NextDouble (10, 60), RandomGen.NextDouble(10, 60)); 841 895 asteroidi.Shape = Shape.Circle; 896 asteroidi.Color = new Color(96, 96, 96); 842 897 asteroidi.X = x; 843 898 asteroidi.Y = y; … … 861 916 void LuoMinioni(int madonreikaID) 862 917 { 918 if (!GameSettings.MinionsEnabled) 919 return; 920 863 921 PhysicsObject minioni = new PhysicsObject(20, 20); 864 922 … … 888 946 if (tagi == 1) 889 947 { 948 madonreika.MaxVelocity = madonreika.MaxVelocity - 1.0; 949 950 WormholeExplosionES.AddEffect(kohde.Position, 150); 951 WormholeExplosionES2.AddEffect(kohde.Position, 5); 952 ALTKHandler.SoundPlayer.PlaySound(9); 953 890 954 LisaaPisteita(0, Convert.ToInt32 ( 2 * Pelaajan1Kerroin)); 891 } 892 if (tagi == 2) 893 { 955 956 if (kohde.MaxVelocity < 1) 957 { 958 WormholeExplosionES.AddEffect(madonreika.Position, 500); 959 WormholeExplosionES2.AddEffect(madonreika.Position, 150); 960 ALTKHandler.StaticAnimHandler.AddStaticAnim(15, ALTKHandler.AdjustJypeliVectorToXna(madonreika.X, madonreika.Y)); 961 kohde.Destroy(); 962 ALTKHandler.SoundPlayer.PlaySound(8); 963 CreatePowerUp(kohde.Position); 964 965 LisaaPisteita(0, Convert.ToInt32(13 * Pelaajan1Kerroin)); 966 } 967 } 968 else if (tagi == 2) 969 { 970 madonreika.MaxVelocity = madonreika.MaxVelocity - 1.0; 971 972 WormholeExplosionES.AddEffect(kohde.Position, 150); 973 WormholeExplosionES2.AddEffect(kohde.Position, 5); 974 ALTKHandler.SoundPlayer.PlaySound(9); 975 894 976 LisaaPisteita(1, Convert.ToInt32 ( 2 * Pelaajan2Kerroin)); 895 } 896 if (tagi == 11) 977 978 if (kohde.MaxVelocity < 1) 979 { 980 WormholeExplosionES.AddEffect(kohde.Position, 500); 981 WormholeExplosionES2.AddEffect(kohde.Position, 150); 982 ALTKHandler.StaticAnimHandler.AddStaticAnim(15, ALTKHandler.AdjustJypeliVectorToXna(kohde.X, kohde.Y)); 983 kohde.Destroy(); 984 ALTKHandler.SoundPlayer.PlaySound(8); 985 CreatePowerUp(kohde.Position); 986 987 LisaaPisteita(1, Convert.ToInt32(13 * Pelaajan1Kerroin)); 988 } 989 } 990 else if (tagi == 11) 897 991 { 898 992 ALTKHandler.HealthBars[0].Value = ALTKHandler.HealthBars[0].Value - 17; … … 931 1025 Vector b = Vector.FromLengthAndAngle(250.0, Minioni[minioniID].Angle); 932 1026 minioninAmmus.Hit(b); 933 ALTKHandler.SoundPlayer.PlaySound(3);1027 //ALTKHandler.SoundPlayer.PlaySound(3); 934 1028 } 935 1029 … … 946 1040 947 1041 Pelaaja[0].Destroy(); 1042 1043 ALTKHandler.SoundPlayer.PlaySound(7); // BOOOOOOOOOOOOOMMMMMM 1044 ALTKHandler.MessageDisplay.AddItem(GameSettings.PlayerNames[0] + " tuhoutui!"); 1045 1046 if (Pelaaja[1].IsDestroyed || !GameSettings.MinionsEnabled) 1047 { 1048 ALTKHandler.MessageDisplay.AddItem("Paina F11 aloittaaksesi uuden pelin."); 1049 } 948 1050 } 949 1051 … … 958 1060 959 1061 Pelaaja[1].Destroy(); 1062 1063 ALTKHandler.SoundPlayer.PlaySound(7); // BOOOOOOOOOOOOOMMMMMM 1064 ALTKHandler.MessageDisplay.AddItem(GameSettings.PlayerNames[1] + " tuhoutui!"); 1065 1066 if (Pelaaja[0].IsDestroyed || !GameSettings.MinionsEnabled) 1067 { 1068 ALTKHandler.MessageDisplay.AddItem("Paina F11 aloittaaksesi uuden pelin."); 1069 } 960 1070 } 961 1071 … … 1034 1144 void AsetaNappaimet() 1035 1145 { 1036 Keyboard.Listen(Key.Up, ButtonState.Down, AlkuKiihdytys, null, Pelaaja[0]);1037 Keyboard.Listen(Key.Up, ButtonState.Down, Kiihdyta, null, Pelaaja[0]);1038 Keyboard.Listen(Key.Down, ButtonState.Down, Hidasta, null, Pelaaja[0]);1039 Keyboard.Listen(Key.Left, ButtonState.Down, kaannaVasemmalle, null, Pelaaja[0]);1040 Keyboard.Listen(Key.Right, ButtonState.Down, kaannaOikealle, null, Pelaaja[0]);1041 Keyboard.Listen(Key.RightShift, ButtonState.Pressed, LuoPelaajanAmmus, null, 0);1146 Keyboard.Listen(Key.Up, ButtonState.Down, AlkuKiihdytys, String.Empty, Pelaaja[0]); 1147 Keyboard.Listen(Key.Up, ButtonState.Down, Kiihdyta, String.Empty, Pelaaja[0]); 1148 Keyboard.Listen(Key.Down, ButtonState.Down, Hidasta, String.Empty, Pelaaja[0]); 1149 Keyboard.Listen(Key.Left, ButtonState.Down, kaannaVasemmalle, String.Empty, Pelaaja[0]); 1150 Keyboard.Listen(Key.Right, ButtonState.Down, kaannaOikealle, String.Empty, Pelaaja[0]); 1151 Keyboard.Listen(Key.RightShift, ButtonState.Pressed, AjaLuoPelaajan1Ammus, String.Empty); 1042 1152 1043 Keyboard.Listen(Key.W, ButtonState.Down, AlkuKiihdytys, null, Pelaaja[1]);1044 Keyboard.Listen(Key.W, ButtonState.Down, Kiihdyta, null, Pelaaja[1]);1045 Keyboard.Listen(Key.S, ButtonState.Down, Hidasta, null, Pelaaja[1]);1046 Keyboard.Listen(Key.A, ButtonState.Down, kaannaVasemmalle, null, Pelaaja[1]);1047 Keyboard.Listen(Key.D, ButtonState.Down, kaannaOikealle, null, Pelaaja[1]);1048 Keyboard.Listen(Key.LeftShift, ButtonState.Pressed, LuoPelaajanAmmus, null, 1);1049 1050 Keyboard.Listen(Key.F11, ButtonState.Pressed, Reset, null);1153 Keyboard.Listen(Key.W, ButtonState.Down, AlkuKiihdytys, String.Empty, Pelaaja[1]); 1154 Keyboard.Listen(Key.W, ButtonState.Down, Kiihdyta, String.Empty, Pelaaja[1]); 1155 Keyboard.Listen(Key.S, ButtonState.Down, Hidasta, String.Empty, Pelaaja[1]); 1156 Keyboard.Listen(Key.A, ButtonState.Down, kaannaVasemmalle, String.Empty, Pelaaja[1]); 1157 Keyboard.Listen(Key.D, ButtonState.Down, kaannaOikealle, String.Empty, Pelaaja[1]); 1158 Keyboard.Listen(Key.LeftShift, ButtonState.Pressed, AjaLuoPelaajan2Ammus, String.Empty); 1159 1160 Keyboard.Listen(Key.F11, ButtonState.Pressed, Reset, String.Empty); 1051 1161 } 1052 1162 … … 1097 1207 { 1098 1208 ALTKHandler.HealthBars[0].Value = Convert.ToInt32(ALTKHandler.HealthBars[0].Value + 20); 1099 Powerup.Destroy();1100 1209 } 1101 1210 else … … 1104 1213 } 1105 1214 Powerup.Destroy(); 1106 } 1107 else if (pelaaja == 22) 1215 ALTKHandler.SoundPlayer.PlaySound(11); 1216 } 1217 else if (pelaaja == 12) 1108 1218 { 1109 1219 if (ALTKHandler.HealthBars[1].Value < 80) … … 1116 1226 } 1117 1227 Powerup.Destroy(); 1228 ALTKHandler.SoundPlayer.PlaySound(11); 1118 1229 } 1119 1230 } … … 1124 1235 Konekivaari1.Start(200); 1125 1236 Powerup.Destroy(); 1237 ALTKHandler.SoundPlayer.PlaySound(11); 1126 1238 } 1127 1239 else if (pelaaja == 12) 1128 1240 { 1129 Konekivaari 1.Start(200);1241 Konekivaari2.Start(200); 1130 1242 Powerup.Destroy(); 1243 ALTKHandler.SoundPlayer.PlaySound(11); 1131 1244 } 1132 1245 } … … 1137 1250 Triplefire1.Start(50); 1138 1251 Powerup.Destroy(); 1139 } 1140 else if (pelaaja == 22) 1252 ALTKHandler.SoundPlayer.PlaySound(11); 1253 } 1254 else if (pelaaja == 12) 1141 1255 { 1142 1256 Triplefire2.Start(50); 1143 1257 Powerup.Destroy(); 1258 ALTKHandler.SoundPlayer.PlaySound(11); 1144 1259 } 1145 1260 } … … 1149 1264 { 1150 1265 ALTKHandler.HealthBars[0].Value = 100; 1151 } 1152 else if (pelaaja == 22) 1266 Powerup.Destroy(); 1267 ALTKHandler.SoundPlayer.PlaySound(11); 1268 } 1269 else if (pelaaja == 12) 1153 1270 { 1154 1271 ALTKHandler.HealthBars[1].Value = 100; 1155 } 1156 } 1157 } 1158 1159 void PowerUps(double position) 1160 { 1161 int arvo = RandomGen.NextInt(10); 1272 Powerup.Destroy(); 1273 ALTKHandler.SoundPlayer.PlaySound(11); 1274 } 1275 } 1276 } 1277 1278 void CreatePowerUp(Vector position) 1279 { 1280 int arvo = RandomGen.NextInt(20); 1162 1281 //int pelaaja = (int)pelaajaID].Tag; 1163 1282 1164 if (arvo == 1) 1283 int tagi = 0; 1284 1285 PhysicsObject powerup = PhysicsObject.CreateStaticObject(25.0, 25.0); 1286 1287 if (arvo == 1 || arvo == 2) 1165 1288 { 1166 1289 //Energiaboosti 1167 PhysicsObject Energia10 = PhysicsObject.CreateStaticObject (25, 25); 1168 Energia10.CollisionIgnoreGroup = 5; 1169 Energia10.Tag = 200; 1170 AddCollisionHandler(Energia10, PowerUpCollisionHandler); 1171 Add(Energia10); 1172 1173 } 1174 else if (arvo == 3) 1290 tagi = 200; 1291 powerup.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "powerup_health.png")); 1292 } 1293 else if (arvo == 3 || arvo == 4) 1175 1294 { 1176 1295 //Konekivääri 1177 PhysicsObject Konekivaari = PhysicsObject.CreateStaticObject(25, 25); 1178 Konekivaari.Color = Color.Blue; 1179 Konekivaari.Tag = 201; 1180 AddCollisionHandler(Konekivaari, PowerUpCollisionHandler); 1181 Add(Konekivaari); 1182 } 1183 else if (arvo == 4) 1296 tagi = 201; 1297 powerup.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "powerup_chaingun.png")); 1298 } 1299 else if (arvo == 5 || arvo == 6 ) 1184 1300 { 1185 1301 //Triplefire 1186 PhysicsObject TripleFire = PhysicsObject.CreateStaticObject(25, 25, Shape.Triangle); 1187 TripleFire.Color = Color.Red; 1188 TripleFire.Tag = 3; 1189 AddCollisionHandler(TripleFire, PowerUpCollisionHandler); 1190 Add(TripleFire); 1191 } 1192 else if (arvo == 5) 1302 tagi = 202; 1303 powerup.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "powerup_triplefire.png")); 1304 } 1305 else if (arvo == 7) 1193 1306 { 1194 1307 //Full restore 1195 PhysicsObject FullRestore = PhysicsObject.CreateStaticObject(25, 25); 1196 FullRestore.Tag = 204; 1197 AddCollisionHandler(FullRestore, PowerUpCollisionHandler); 1198 Add(FullRestore); 1308 tagi = 203; 1309 powerup.Image = Image.FromStream(File.OpenRead(ALTKConstants.TexturePath + "powerup_fullrestore.png")); 1199 1310 } 1200 1311 else 1201 1312 { 1202 } 1313 return; 1314 } 1315 1316 powerup.CollisionIgnoreGroup = 5; 1317 powerup.Position = position; 1318 powerup.Tag = tagi; 1319 AddCollisionHandler(powerup, PowerUpCollisionHandler); 1320 Add(powerup); 1203 1321 } 1204 1322 … … 1210 1328 Pelaaja.Clear(); 1211 1329 Madonreika.Clear(); 1212 Begin();1213 1330 ALTKHandler.StaticAnimHandler.ClearAnims(); 1214 1331 AddInitialAnims(); … … 1221 1338 Pelaajan2Pisteet = 0; 1222 1339 Pelaajan2Kerroin = 1.0; 1340 1341 ALTKHandler.ScoreDisplayers[0].Color = Microsoft.Xna.Framework.Color.Purple; 1342 ALTKHandler.ScoreDisplayers[1].Color = Microsoft.Xna.Framework.Color.Purple; 1343 1344 CreateCursor(); 1345 SettingsConfirmed = false; 1346 ALTKHandler.GameSettingsWindow.Enabled = true; 1347 ALTKHandler.GameSettingsWindow.Visible = true; 1348 ALTKHandler.Cursor.Visible = true; 1223 1349 } 1224 1350 … … 1240 1366 { 1241 1367 base.Update(gameTime); 1368 1369 if (ALTKHandler.MusicPlayer.soundEffectInstance.State == Microsoft.Xna.Framework.Audio.SoundState.Stopped) 1370 { 1371 ALTKHandler.MusicPlayer.LoadTrack("LOOP", true); 1372 } 1242 1373 1243 1374 ALTKHandler.ScoreDisplayers[0].Value = Pelaajan1Pisteet; … … 1318 1449 ALTKHandler.StaticAnimHandler.AddStaticAnim("STARSMOKE_RED", new Microsoft.Xna.Framework.Vector2(-350, -200)); 1319 1450 ALTKHandler.StaticAnimHandler.AddStaticAnim("STARSMOKE_WHITE", new Microsoft.Xna.Framework.Vector2(-300, 250)); 1451 1452 ALTKHandler.MusicPlayer.StopPlaying(); 1453 ALTKHandler.MusicPlayer.LoadTrack("INTRO", false); 1320 1454 } 1321 1455 … … 1323 1457 { 1324 1458 //this.StopAll(); 1325 if (!ALTKHandler.ExitWindow.Enabled )1459 if (!ALTKHandler.ExitWindow.Enabled && !ALTKHandler.GameSettingsWindow.Enabled) 1326 1460 { 1327 1461 ALTKHandler.ExitWindow.Enabled = true; 1328 1462 ALTKHandler.ExitWindow.Visible = true; 1329 1463 1330 Kursori.IsVisible = true;1464 ALTKHandler.Cursor.Visible = true; 1331 1465 } 1332 1466 } -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSS/YAG2DSS.csproj
r2848 r2883 118 118 <Compile Include="ALTKEngine\Cursor.cs" /> 119 119 <Compile Include="ALTKEngine\GameHandler.cs" /> 120 <Compile Include="ALTKEngine\GameSettings.cs" /> 120 121 <Compile Include="ALTKEngine\KeyboardEventInput.cs" /> 121 122 <Compile Include="ALTKEngine\Loader.cs" /> … … 135 136 <Compile Include="GUI\AUIButton.cs" /> 136 137 <Compile Include="GUI\Dialogs\ExitWindow.cs" /> 138 <Compile Include="GUI\Dialogs\GameSettingsWindow.cs" /> 137 139 <Compile Include="Ohjelma.cs" /> 138 140 <Compile Include="YAG2DSS.cs" /> -
2012/23/RamiP/YAG2DSSBase/YAG2DSS/YAG2DSSContent/YAG2DSSContent.contentproj
r2854 r2883 148 148 </ItemGroup> 149 149 <ItemGroup> 150 <None Include="Music\Yag2Dss.wav">151 <Name>Yag2Dss</Name>152 <Importer>WavImporter</Importer>153 <Processor>SoundEffectProcessor</Processor>154 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>155 </None>156 </ItemGroup>157 <ItemGroup>158 150 <None Include="Sounds\MinionGun.wav"> 159 151 <Name>MinionGun</Name> … … 298 290 <None Include="Sounds\PlayerCollision.wav"> 299 291 <Name>PlayerCollision</Name> 292 <Importer>WavImporter</Importer> 293 <Processor>SoundEffectProcessor</Processor> 294 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 295 </None> 296 </ItemGroup> 297 <ItemGroup> 298 <None Include="Textures\powerup_chaingun.png"> 299 <Name>powerup_chaingun</Name> 300 <Importer>TextureImporter</Importer> 301 <Processor>TextureProcessor</Processor> 302 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 303 </None> 304 <None Include="Textures\powerup_fullrestore.png"> 305 <Name>powerup_fullrestore</Name> 306 <Importer>TextureImporter</Importer> 307 <Processor>TextureProcessor</Processor> 308 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 309 </None> 310 <None Include="Textures\powerup_health.png"> 311 <Name>powerup_health</Name> 312 <Importer>TextureImporter</Importer> 313 <Processor>TextureProcessor</Processor> 314 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 315 </None> 316 <None Include="Textures\powerup_triplefire.png"> 317 <Name>powerup_triplefire</Name> 318 <Importer>TextureImporter</Importer> 319 <Processor>TextureProcessor</Processor> 320 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 321 </None> 322 </ItemGroup> 323 <ItemGroup> 324 <None Include="Sounds\PlayerExplosion.wav"> 325 <Name>PlayerExplosion</Name> 326 <Importer>WavImporter</Importer> 327 <Processor>SoundEffectProcessor</Processor> 328 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 329 </None> 330 </ItemGroup> 331 <ItemGroup> 332 <None Include="Sounds\WormholeHit.wav"> 333 <Name>WormholeHit</Name> 334 <Importer>WavImporter</Importer> 335 <Processor>SoundEffectProcessor</Processor> 336 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 337 </None> 338 <None Include="Sounds\WormholeExplosion.wav"> 339 <Name>WormholeExplosion</Name> 340 <Importer>WavImporter</Importer> 341 <Processor>SoundEffectProcessor</Processor> 342 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 343 </None> 344 <None Include="Sounds\MinionExplosion.wav"> 345 <Name>MinionExplosion</Name> 346 <Importer>WavImporter</Importer> 347 <Processor>SoundEffectProcessor</Processor> 348 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 349 </None> 350 <None Include="Sounds\PowerupPicked.wav"> 351 <Name>PowerupPicked</Name> 352 <Importer>WavImporter</Importer> 353 <Processor>SoundEffectProcessor</Processor> 354 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 355 </None> 356 </ItemGroup> 357 <ItemGroup> 358 <None Include="Music\Intro.wav"> 359 <Name>Intro</Name> 360 <Importer>WavImporter</Importer> 361 <Processor>SoundEffectProcessor</Processor> 362 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 363 </None> 364 <None Include="Music\Loop.wav"> 365 <Name>Loop</Name> 300 366 <Importer>WavImporter</Importer> 301 367 <Processor>SoundEffectProcessor</Processor>
Note: See TracChangeset
for help on using the changeset viewer.