private void Down2() { if (!mObject2.MoveDown()) { labelScore.Text = "SCORE:\n" + game.Score.ToString(); labelLevel.Text = "LEVEL: " + game.Level.ToString(); if (game.GameOver) { FinishForm f3 = new FinishForm(game.Score.ToString(), newGame); f3.ShowDialog(); } mObject2.Object = new TetrisObject(listOfObjects[GetRandomNumber()]); ShowNextObject(); } }
private void Down() { if (!mObject.MoveDown()) { labelScore.Text = "Score: " + game.Score.ToString(); labelLevel.Text = "Level: " + game.Level.ToString(); goldenPts.Text = "Golden: " + mObject.goldenPoints.ToString(); if (game.GameOver) { FinishForm f3 = new FinishForm(game.Score.ToString(), newGame); f3.ShowDialog(); } else { // addObstacles is true if the checBox 'Add obsticles' was checked // if addObstacles is true, then check if the black field has already been added at this level if (addObstacles && (game.Level % 2 == 0)) { if (!blackFieldAdded) { findNewColoredField(Color.Black); } } else { blackFieldAdded = false; } // addGoldenPoints is true if the checkBox 'Add golden points' was checked // if addGoldenPoints is true, pick a random time interval to add next golden field if (addGoldenPoints) { if (goldenPosition.Item1 != 0) { /*if (tField[goldenPosition.Item1, goldenPosition.Item2] != Color.Yellow) * tField[goldenPosition.Item1, goldenPosition.Item2] = Color.Green; * else * tField[goldenPosition.Item1, goldenPosition.Item2] = Color.Gray;*/ if (tField[goldenPosition.Item1, goldenPosition.Item2] == Color.Gold) { tField[goldenPosition.Item1, goldenPosition.Item2] = Color.DarkBlue; } goldenPosition = new Tuple <int, int>(0, 0); } if (goldenPointsInterval == 0) { Tuple <int, int> temp = findNewColoredField(Color.Gold); //findNewColoredField(Color.Gold); goldenPosition = new Tuple <int, int>(temp.Item1, temp.Item2); goldenPointsInterval = rnd.Next(15, 30); } else { goldenPointsInterval -= 1; } } goldenPts.Text = "Golden: " + mObject.goldenPoints.ToString(); mObject.Object = new TetrisObject(listOfObjects[GetRandomNumber()]); ShowNextObject(); } } }