private void Down(ref BrickFactory brickFactory, Label Score_label, Label gameOver, Timer timer, Image i, Panel p, Image i_next, Panel p_next) { if (brickFactory.IsDown()) { brickFactory.Y++; } else { if (brickFactory.Y == 0) { timer.Stop(); gameOver.Visible = true; return; } for (int y = 0; y < 4; y++) { for (int x = 0; x < 4; x++) { if (brickFactory.Brick._Brick[y, x] == 1) { brickFactory.BackGround[brickFactory.Y + y, brickFactory.X + x].N = brickFactory.Brick._Brick[y, x]; brickFactory.BackGround[brickFactory.Y + y, brickFactory.X + x].Color = brickFactory.Brick.Color; } } } Score_label.Text = brickFactory.CalculateScore().ToString(); brickFactory.init(1); timer.Start(); } Draw(i, i_next, p, p_next, ref brickFactory); }
/// <summary> /// 开始游戏 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { label3.Visible = false; label4.Visible = false; brickFactory1 = new BrickFactory(); label_1P_Score.Text = brickFactory1.Score.ToString(); label_1P_Level.Text = brickFactory1.Level.ToString(); brickFactory1.init(0); brickFactory2 = new BrickFactory(); label_2P_Score.Text = brickFactory2.Score.ToString(); label_2P_Level.Text = brickFactory2.Level.ToString(); brickFactory2.init(0); timer1.Interval = Constant.interval; timer2.Interval = Constant.interval; timer1.Start(); timer2.Start(); this.Focus(); }