public void CurrTetraminoMoveDown() { MediaElement player2 = new MediaElement(); Point Position = currTetramino.getCurrPosition(); Point[] Shape = currTetramino.getCurrShape(); movedown = true; currTetraminoErase(); foreach (Point S in Shape) { if (((int)(S.Y + Position.Y) + 2 + 1) >= Rows) { movedown = false; } else if (wb.GetPixel((int)((S.X + Position.X) + ((Cols / 2) - 1)), ((int)(S.Y + Position.Y) + 2 + 1)) != Colors.Black) { movedown = false; } if (wb.GetPixel((int)((S.X) + ((Cols / 2) - 1)), ((int)(S.Y) + 4)) != Colors.Black) { movedown = false; lose = true; for (int i = 0; i < wb.PixelHeight; i++) { for (int j = 0; j < wb.PixelWidth; j++) { wb.SetPixel(j, i, Colors.Black); } } _level = 1; Level = _level; } } if (movedown) { currTetramino.MoveDown(); currTetraminoDraw(); tetr = false; } else { tetr = true; currTetraminoDraw(); CheckRows(); currTetramino = new Tetramino(); } }
public void CurrTetraminoMoveFastDown() { MediaElement player2 = new MediaElement(); Point Position = currTetramino.getCurrPosition(); Point[] Shape = currTetramino.getCurrShape(); movedown = true; currTetraminoErase(); foreach (Point S in Shape) { if (((int)(S.Y + Position.Y) + 2 + 1) >= Rows) { movedown = false; } else if (wb.GetPixel(((int)(S.X + Position.X) + ((Cols / 2) - 1)), ((int)(S.Y + Position.Y) + 2 + 1)) != Colors.Black) { movedown = false; } if (wb.GetPixel(((int)(S.X) + ((Cols / 2) - 1)), ((int)(S.Y) + 2 + 2)) != Colors.Black) { movedown = false; lose = true; } } if (movedown) { currTetramino.MoveDown(); currTetraminoDraw(); tetr = false; } else { tetr = true; currTetraminoDraw(); CheckRows(); currTetramino = new Tetramino(); } }
public Tetris(WriteableBitmap wbm) { this.wbm = wbm; this.wb = BitmapFactory.New(wbm.PixelWidth / 2, wbm.PixelHeight / 2); for (int i = 0; i < wb.PixelHeight; i++) { for (int j = 0; j < wb.PixelWidth; j++) { wb.SetPixel(j, i, Colors.Black); } } Rows = this.wb.PixelHeight; Cols = this.wb.PixelWidth; _score = 0; _level = 1; Level = _level; LinesFilled = 0; currTetramino = new Tetramino(); currTetraminoDraw(); }
public void CurrTetraminoMoveFastDown() { MediaElement player2 = new MediaElement(); Point Position = currTetramino.getCurrPosition(); Point[] Shape = currTetramino.getCurrShape(); movedown = true; currTetraminoErase(); foreach (Point S in Shape) { if (((int)(S.Y + Position.Y) + 2 + 1) >= Rows) { movedown = false; } else if (wb.GetPixel(((int)(S.X + Position.X) + ((Cols / 2) - 1)), ((int)(S.Y + Position.Y) + 2 + 1)) !=Colors.Black) { movedown = false; } if (wb.GetPixel(((int)(S.X) + ((Cols / 2) - 1)), ((int)(S.Y) + 2 + 2)) != Colors.Black) { movedown = false; lose = true; } } if (movedown) { currTetramino.MoveDown(); currTetraminoDraw(); tetr = false; } else { tetr = true; currTetraminoDraw(); CheckRows(); currTetramino = new Tetramino(); } }
public void CurrTetraminoMoveDown() { MediaElement player2 = new MediaElement(); Point Position = currTetramino.getCurrPosition(); Point[] Shape = currTetramino.getCurrShape(); movedown = true; currTetraminoErase(); foreach (Point S in Shape) { if (((int)(S.Y + Position.Y) + 2 + 1) >= Rows) { movedown = false; } else if (wb.GetPixel((int)((S.X + Position.X) + ((Cols / 2) - 1)),((int)(S.Y + Position.Y) + 2 + 1)) != Colors.Black) { movedown = false; } if (wb.GetPixel((int)((S.X) + ((Cols / 2) - 1)),((int)(S.Y)+4))!= Colors.Black) { movedown = false; lose = true; for (int i = 0; i < wb.PixelHeight; i++) { for (int j = 0; j < wb.PixelWidth; j++) { wb.SetPixel(j, i, Colors.Black); } } _level = 1; Level = _level; } } if (movedown) { currTetramino.MoveDown(); currTetraminoDraw(); tetr = false; } else { tetr = true; currTetraminoDraw(); CheckRows(); currTetramino = new Tetramino(); } }
public Tetris(WriteableBitmap wbm) { this.wbm = wbm; this.wb = BitmapFactory.New(wbm.PixelWidth / 2, wbm.PixelHeight / 2); for (int i = 0; i < wb.PixelHeight; i++) { for (int j = 0; j < wb.PixelWidth; j++) { wb.SetPixel(j, i,Colors.Black); } } Rows = this.wb.PixelHeight; Cols = this.wb.PixelWidth; _score = 0; _level = 1; Level = _level; LinesFilled = 0; currTetramino = new Tetramino(); currTetraminoDraw(); }