コード例 #1
0
        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 + 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
                        {
                            //ctrlGame.GameOver(c1, c2, c3);

                            timer.Stop();

                            //MessageBox.Show("GAME OVER");
                            //return;

                            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
                        {
                            //ctrlGame.GameOver(c1, c2, c3);

                            timer.Stop();

                            //MessageBox.Show("GAME OVER");
                            //return;

                            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
                        {
                            //ctrlGame.GameOver(c1, c2, c3);

                            timer.Stop();

                            //MessageBox.Show("GAME OVER");
                            //return;

                            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
                        {
                            //ctrlGame.GameOver(c1, c2, c3);

                            timer.Stop();

                            //MessageBox.Show("GAME OVER");
                            //return;

                            SoundHit();
                            SoundGameOver();

                            isAlive = false;
                        }
                    }
                }
            }

            // outside form and bird die
            else
            {
                Y_Bird += 4;

                rocket.Move_Fire(this);

                //gift.picBoxGift.Visible = false;
                gift.gift_Flash_Appearance = false;

                if (isAlive)
                {
                    timer.Stop();


                    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;
            }
        }
コード例 #2
0
ファイル: setPswd.cs プロジェクト: danielleFrenklakh/p2p
 public setPswd(Form frm)
 {
     _frm = frm;
     InitializeComponent();
 }