Exemplo n.º 1
0
        private void JumpAnimationWaitTimer_Tick(object sender, EventArgs e)
        {
            if (CheckBirdCollisionWithPipes() && !dead)
            {
                GameOver();
            }

            if (CheckBirdCollisionWithCoin() && !gotCoin)
            {
                gotCoin = true;
                this.Controls.Remove(coin);
                Score++;
                Score_Label.Text = "Score: " + Score.ToString();
                // I should also play a sound, but we will implement it later.
            }

            if (miliseconds < 140)
            {
                miliseconds += JumpAnimationWaitTimer.Interval;
            }
            else
            {
                JumpAnimationWaitTimer.Stop();
                GravityTimer.Start();
                FlappyBirdSprite.Image = frame3;
            }
        }
Exemplo n.º 2
0
        public FlappyBirdForm()
        {
            InitializeComponent();

            this.Select();

            frame1 = Image.FromFile(@"C:\Users\Soumya\Desktop\Repositories\FlappyBird\Sprites\FB_0.png");
            frame2 = Image.FromFile(@"C:\Users\Soumya\Desktop\Repositories\FlappyBird\Sprites\FB_1.png");
            frame3 = Image.FromFile(@"C:\Users\Soumya\Desktop\Repositories\FlappyBird\Sprites\FB_2.png");
            GravityTimer.Start();

            PipeTimer.DoWork += new DoWorkEventHandler(PipeTimer_Work);
            SpawnPipes();
        }