public void Init() { bird = new Player(200, 200); wall1 = new TheWall(550, -200, true); wall2 = new TheWall(550, 300); timer1.Start(); }
private void CreateNewWall() { if (wall1.x < bird.x - 400) { Random r = new Random(); int y1; int u; y1 = r.Next(-200, -100); u = r.Next(450, 600); wall1 = new TheWall(450, y1, true); wall2 = new TheWall(450, y1 + u); bird.score++; this.Text = "Flappy Bird Score: " + bird.score; } }
private bool Collide(Player player, TheWall wall) { PointF delta = new PointF(); delta.X = (bird.x + bird.size / 2) - (wall.x + wall.sizeX / 2); delta.Y = (bird.y + bird.size / 2) - (wall.y + wall.sizeY / 2); if (Math.Abs(delta.X) <= bird.size / 2 + wall.sizeX / 2) { if (Math.Abs(delta.Y) <= bird.size / 2 + wall.sizeY / 2) { return(true); } } return(false); }