Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Make Tetris with C++ and paint?

Options
  • 30-01-2004 9:50pm
    #1
    Closed Accounts Posts: 263 ✭✭


    Anyone know where I can find a tutorial to guide me through how to make
    "Tetris" the game with 'C++' and 'Paint? Thanx.


Comments

  • Registered Users Posts: 491 ✭✭Silent Bob


    I shan't search the web for you...

    But I shall tell you that the game logic behind Tetris isn't overly complicated. The board can really be thought of as a 10x30 grid (start thinking 2D array) and every single 'piece' is comprised of four blocks.

    Then you just need to work out how to rotate the different pieces and how to decide where the pieces will land (bit of collision-style detection, keep track of the height of the piece...). You will also need to know when a line is formed.

    As regards Paint. You don't need it. You will need some form of graphics library (curses, OpenGL, gtk, that one that windows uses...), every one of which provides the kind of primitives you will need to draw tetris blocks.

    I co-wrote a 'robot' that plays tetris earlier this year. It basically involved being able to simulate every aspect of the game so that the robot could see the outcome of every possible move and make the best one based on that judgement.


  • Registered Users Posts: 5,111 ✭✭✭tba


    Id love to see that in action.


Advertisement