예제 #1
0
파일: Game.cs 프로젝트: kugamigh/Tetris
 public Game(Window gameWindow)
 {
     FillBagOfPieces();
     _CurrentShape    = ChooseNewShape();
     _CollisionTester = _CurrentShape.Clone();
     gameTimer        = SplashKit.CreateTimer("gameTicks");
     gameTimer.Start();
     gameTimer.Pause();
 }
예제 #2
0
파일: Game.cs 프로젝트: kugamigh/Tetris
    private void MoveDown()
    {
        if (gameTimer.IsPaused)
        {
            gameTimer.Start();
        }

        Console.WriteLine("Moving down");

        if (_CollisionTester.MoveShape(Direction.Down) && !_CollisionTester.CheckOverlaps())
        {
            _CurrentShape.MoveShape(Direction.Down);
        }
        else
        {
            _CollisionTester.MoveShape(Direction.Up);
            _CurrentShape.AssignToGrid();
            TetrisGrid.ClearLines();
            _CurrentShape    = ChooseNewShape();
            _CollisionTester = _CurrentShape.Clone();
            _CurrentShape.GenerateShape();
            _CollisionTester.GenerateShape();
        }
    }