private void timer1_Tick(object sender, EventArgs e) // the main progress of the game { if (pause == false) { Time = Time + (int)Math.Pow(2, Level); } if (g.GameOver()) { End(); MessageBox.Show("Game Over!"); } else if (Restart == false && Time >= Time_Step) { Time = 0; if (block.CanMove(g.graph, "down")) { block.MoveAndDraw(block.x + 1, block.y, g.graph); ShowGraph(); Show_Next_Block(); } else if (g.GameOver()) { End(); MessageBox.Show("Game Over!"); } else { g.Remove_Line(); g.Reset_color(); Bonus_label.Text = "Bonus " + Convert.ToString(Bonus); block = nextblock; block.x = 0; if (block.CanDraw(g.graph) == true && Restart == false) { block.Draw(g.graph); nextblock = creater.CreateBlocks(0, 0, InitialDirection); ShowGraph(); Show_Next_Block(); } else { block.Draw(g.graph); ShowGraph(); End(); MessageBox.Show("Game Over!"); } } } }
public override BlockType Rotated() { BlockCreater creater = new BlockCreater(); Block block = new Block(); string nextDirection = this.NextDierction(this.direction); block = creater.CreateBlocks(TypeNumber, BlockList[0].color, nextDirection); block.SetPoint(this.x, this.y); block.direction = nextDirection; return((BlockType)block); } // change the dirction of a block, set new bolck to replace it