Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Make Tetris with C++ and paint?

  • 30-01-2004 09: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, Registered Users 2 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, Registered Users 2 Posts: 5,111 ✭✭✭tba


    Id love to see that in action.


Advertisement