public void Impact_Bird_pipe(Form form, Pipe pipe, Rocket rocket, Gift gift, LifeSpan lifeSpan, Timer timer, Timer timer2, CtrlGame ctg, Control ga) { // inside form if (Y_Bird >= 0 && Y_Bird + this.recBird.Height <= form.Height) { Y_Bird += 3; rocket.Move_Fire(this); gift.Appear_Thunder(this); if (gift.count_Flash >= 95) { isGetGift = false; gift.count_Flash = 0; gift.soundThunder.controls.stop(); recBird.Width = 34; recBird.Height = 24; timer2.Stop(); } if (X_Bird + this.recBird.Width >= pipe.X_pipePairs1 && X_Bird <= pipe.X_pipePairs1 + pipe.recPipe.Width) { if (Y_Bird <= 250 + pipe.Y_pipeAbove1) { if ((isAlive && isGetGift) || !pipe.pipe_Above1_Appearance) { } // is alive and DIE else { timer.Stop(); ctg.GameOver(ga, pipe); SoundHit(); SoundGameOver(); isAlive = false; } } else if (Y_Bird + this.recBird.Height >= pipe.Y_pipeBottom1) { if ((isAlive && isGetGift) || !pipe.pipe_Bottom1_Appearance) { } //// is alive and DIE else { timer.Stop(); //ctg.GameOver(c2, c3, c4, c5, c6); ctg.GameOver(ga, pipe); SoundHit(); SoundGameOver(); isAlive = false; } } } if (X_Bird + this.recBird.Width >= pipe.X_pipePairs2 && X_Bird <= pipe.X_pipePairs2 + pipe.recPipe.Width) { if (Y_Bird <= 250 + pipe.Y_pipeAbove2) { if ((isAlive && isGetGift) || !pipe.pipe_Above2_Appearance) { } //// is alive and DIE else { timer.Stop(); //ctg.GameOver(c2, c3, c4, c5, c6); ctg.GameOver(ga, pipe); SoundHit(); SoundGameOver(); isAlive = false; } } else if (Y_Bird + this.recBird.Height >= pipe.Y_pipeBottom2) { if ((isAlive && isGetGift) || !pipe.pipe_Bottom2_Appearance) { } //// is alive and DIE else { timer.Stop(); //ctg.GameOver(c2, c3, c4, c5, c6); ctg.GameOver(ga, pipe); SoundHit(); SoundGameOver(); isAlive = false; } } } } // outside form and bird die else { Y_Bird += 4; rocket.Move_Fire(this); gift.gift_Flash_Appearance = false; if (isAlive) { timer.Stop(); //ctg.GameOver(c2, c3, c4, c5, c6); ctg.GameOver(ga, pipe); SoundHit(); SoundGameOver(); isAlive = false; } } //// set image for bird if (isAlive) { birdPicDraw = Draw2D_Bird(); } if (!isAlive) { recBird.Width = 24; recBird.Height = 34; if (index_bird == 1) { birdPicDraw = yebird_die; } else if (index_bird == 2) { birdPicDraw = blbird_die; } else { birdPicDraw = rebird_die; } } if (isGetGift && isAlive) { recBird.Width = 50; recBird.Height = 25; birdPicDraw = flash_bird; } }
// that isnt useful #region //public void Bird_Animator(Timer bird_Timer) //{ // bird_Timer.Interval = 70; // //bird_Timer.Tick += new EventHandler(bird_Timer); // bird_Timer.Start(); //} //public void Bird_Timer_Tick(Control c) //{ // if (Y_Bird + birdPicture.Height <= c.Height && Y_Bird >= 0) // { // Y_Bird += 10; // if (X_Bird + birdPicture.Width >= pipe.X_pipePairs1 && X_Bird + birdPicture.Width <= pipe.X_pipePairs1 + 52) // { // if (Y_Bird <= 250 + pipe.Y_pipeAbove1 || Y_Bird + birdPicture.Height >= pipe.Y_pipeBottom1) // { // return; // } // } // if (X_Bird + birdPicture.Width >= pipe.X_pipePairs2 && X_Bird + birdPicture.Width <= pipe.X_pipePairs2 + 52) // { // if (Y_Bird <= 250 + pipe.Y_pipeAbove2 || Y_Bird + birdPicture.Height >= pipe.Y_pipeBottom2) // { // return; // } // } // } // else // { // Y_Bird += 10; // } //} #endregion public void Impact_Bird_pipe(Form form, Pipe pipe, Rocket rocket, Gift gift, LifeSpan lifeSpan, Timer timer, Timer timer2) { // inside form if (Y_Bird >= 0 && Y_Bird + picBoxBird.Height <= form.Height) { Y_Bird += 7; picBoxBird.Location = new Point(X_Bird, Y_Bird); rocket.Move_Fire(this); gift.Appear_Thunder(this); if (gift.count_Flash >= 95) { isGetGift = false; gift.count_Flash = 0; gift.soundThunder.controls.stop(); timer2.Stop(); } if (X_Bird + picBoxBird.Width >= pipe.X_pipePairs1 && X_Bird + picBoxBird.Width <= pipe.X_pipePairs1 + 52) { if (Y_Bird <= 250 + pipe.Y_pipeAbove1) { if ((isAlive && isGetGift) || pipe.picBoxPipeAbove1.Visible == false) { } // is alive and DIE else { //ctrlGame.GameOver(c1, c2, c3); timer.Stop(); //MessageBox.Show("GAME OVER"); //return; SoundHit(); SoundGameOver(); isAlive = false; } } if (Y_Bird + picBoxBird.Height >= pipe.Y_pipeBottom1) { if ((isAlive && isGetGift) || pipe.picBoxPipeBottom1.Visible == false) { } // is alive and DIE else { //ctrlGame.GameOver(c1, c2, c3); timer.Stop(); //MessageBox.Show("GAME OVER"); //return; SoundHit(); SoundGameOver(); isAlive = false; } } } if (X_Bird + picBoxBird.Width >= pipe.X_pipePairs2 && X_Bird + picBoxBird.Width <= pipe.X_pipePairs2 + 52) { if (Y_Bird <= 250 + pipe.Y_pipeAbove2) { if ((isAlive && isGetGift) || pipe.picBoxPipeAbove2.Visible == false) { } // is alive and DIE else { //ctrlGame.GameOver(c1, c2, c3); timer.Stop(); //MessageBox.Show("GAME OVER"); //return; SoundHit(); SoundGameOver(); isAlive = false; } } if (Y_Bird + picBoxBird.Height >= pipe.Y_pipeBottom2) { if ((isAlive && isGetGift) || pipe.picBoxPipeBottom2.Visible == false) { } // is alive and DIE else { //ctrlGame.GameOver(c1, c2, c3); timer.Stop(); //MessageBox.Show("GAME OVER"); //return; SoundHit(); SoundGameOver(); isAlive = false; } } } } // outside form and bird die else { Y_Bird += 7; picBoxBird.Location = new Point(X_Bird, Y_Bird); rocket.Move_Fire(this); gift.picBoxGift.Visible = false; if (isAlive) { //ctrlGame.GameOver(c1, c2, c3); timer.Stop(); //MessageBox.Show("GAME OVER"); //return; SoundHit(); SoundGameOver(); isAlive = false; } } // set image for bird if (isAlive) { picBoxBird.Image = Draw2D_Bird(); } if (!isAlive) { picBoxBird.Size = new Size(24, 34); if (index_bird == 1) { picBoxBird.Image = yebird_die; } else if (index_bird == 2) { picBoxBird.Image = blbird_die; } else { picBoxBird.Image = rebird_die; } } if (isGetGift && isAlive) { picBoxBird.Size = new Size(50, 25); picBoxBird.Image = flash_bird; } }