Made a Flappy Bird type game. There are 2 pipes, 1 on top, 1 on bottom. I have applied a random function to change the height of the pipes. When the height changes, it changes from the bottom. So my code worked for the top pipe, but doesn't work for the bottom pipe because it goes into the ground, or above the ground. How to fix it? (PipeBottom and PipeTop are the pictureboxes)
Bird.Top += gravity;
PipeBottom.Left -= pipespeed;
PipeTop.Left -= pipespeed;
scoreBox.Text = "Score: " + score;
Random r = new Random();
int j = r.Next(-100, 100);
if (PipeBottom.Left < -100)
{
PipeBottom.Left = 800;
PipeTop.Height -= j;
score++;
}
if (PipeTop.Left < -100)
{
PipeTop.Left = 800;
PipeTop.Height += j;
score++;
}