private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { RightTimer.Stop(); LeftTimer.Stop(); JumpTimer.Stop(); PhysicTimer.Stop(); }
private void JumpTimer_Tick(object sender, EventArgs e) { if (CheckBirdCollisionWithPipes() && !dead) { GameOver(); } if (miliseconds == 50) { FlappyBirdSprite.Image = frame1; } 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 < 100) { miliseconds += JumpTimer.Interval; Point p = FlappyBirdSprite.Location; p.Y += jumpSpeed; FlappyBirdSprite.Location = p; } else { JumpTimer.Stop(); JumpAnimationWaitTimer.Start(); FlappyBirdSprite.Image = frame2; } }