Skip to content

A tetris game implemented using C++ and FLTK library for the GUI

License

Notifications You must be signed in to change notification settings

vilas897/Tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tetris

A tetris game implemented using C++ and FLTK.

Compilation (OSX)

g++ tetrisfinal.cpp fltk-config --use-forms --use-gl --use-images --ldstaticflags --cxxflags

Running:

./ouput

Functionalities

  • A piece with a randomized color and type is generated periodically and it moves down the playing area. User can control the orientation and position of the piece using arrow keys until the current piece reaches the bottom of the playing board. At this point a new piece is generated.

  • User cannot move or orient a piece in the following situations:

    • The piece tries to move out of the playing board area as a result of the user’s action
    • If there is another piece already blocking it’s movement
  • Exceptions are thrown if the above cases are encountered. The error is caught and the playing board border turns red, indicating to the user that his move is invalid and prevents the piece from making that move.

  • If the user is able to form a straight line with a set of pieces, the scoreboard is updated and the said line is deleted from the playing board.

  • If any piece touches the top of the playing board and no straight line is formed, the game ends.

User Interactions

The user can interact using the following keys

  • ESC : End Game and Close Window
  • Up Arrow Key: Rotate current piece clockwise
  • Down Arrow Key: Rotate current piece counter-clockwise
  • Left Arrow Key: Move current piece left
  • Right Arrow Key: Move current piece right
  • Space Bar: Bring current piece to the bottom of the playing area.

Screenshots

Screenshot

About

A tetris game implemented using C++ and FLTK library for the GUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages