Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. How to make a Monopoly board with Qt
Forum Updated to NodeBB v4.3 + New Features

How to make a Monopoly board with Qt

Scheduled Pinned Locked Moved Game Development
14 Posts 4 Posters 5.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #2

    It's a great opportunity to learn, although it does sound a bit more advanced. Take a look at QtQuick and QML, it should be easy to learn and implement your project using that technology.

    (Z(:^

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stillcold
      wrote on last edited by
      #3

      Thanks for the reply and answer to my question! I only have a short time frame of about a week so do you think it's doable within that amount of time?

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #4

        No, I do not think so. That is too short even for an expert (well, depending on how advanced you want the game to be, and whether you care about code quality, of course).

        (Z(:^

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stillcold
          wrote on last edited by
          #5

          The thing is I already have the entire code of the game done as I coded it with Visual Studio 2012 and made the game play on the command line with an actual board and etc. But like you said, I find it highly unreasonable to create a GOOD quality game with Qt in under a week given that I am new to Qt; so am I right in making this assumption? I feel the most I could do with the knowledge I have now is just post a picture of the monopoly board as a central widget then have the player pieces adjust their position on the board with setGeometry after each move. Thanks again.

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #6

            That might do for a hacky solution, yes ;-)

            (Z(:^

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stillcold
              wrote on last edited by
              #7

              Okay cool :)

              So quick question: what's the definition of a widget in Qt? And what would be the best way to implement the idea I just thought of in the above post? I'm thinking a mainwindow with a central widget as the board, and player class as a widget, and have the setGeometry just update after each move. Which widget would be best to display text and actions at the bottom of a board that a player can input and get output from in the form of text? Thanks so much!

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #8

                Use QLabel to display text and images.
                Use QLineEdit to get user input.
                Use QPushButton if you need a button.

                (Z(:^

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  stillcold
                  wrote on last edited by
                  #9

                  Awesome thanks so much!! :)

                  So I'm thinking of this:

                  • Create a class called Game_Board which inherits from MainWindow and will contain menus, the central widget which will be an image of the monopoly board, and player widgets. Then I'll just implement the actual code of the game to be displayed to the user with QLineEdit(getting user input) and QLabel(displaying text of the game) and QPushButton(rolling the dice, starting the game, ending the game, etc) so am I on the right track? thanks again man you've helped me alot!!
                  1 Reply Last reply
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #10

                    Looks about right. Start coding and when more questions spring up, feel free to ask here.

                    BTW: to make the UI automatically respond to changes, use layouts (QLayout: grid, form, horizontal, vertical).

                    (Z(:^

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      stillcold
                      wrote on last edited by
                      #11

                      Will do man, thanks again for all your help!

                      I know what layouts are but I didn't understand why we would need to use them "to make the UI automatically respond to changes?" Thanks again.

                      1 Reply Last reply
                      0
                      • sierdzioS Offline
                        sierdzioS Offline
                        sierdzio
                        Moderators
                        wrote on last edited by
                        #12

                        Sorry, I should have elaborated. When you use layouts, Qt will automatically respond to window resizes, adjusting the size of all the widgets inside layouts. This way the applications looks good when the window is small and continues to look natural when maximised. The alternative would be to hardcode the window sizes, which is error-prone and takes a lot of time.

                        (Z(:^

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          clochydd
                          wrote on last edited by
                          #13

                          Hi sierdzio - perfect hints for cute start :)

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            ScottR
                            wrote on last edited by
                            #14

                            You could instead use a QGraphicsView for the board and QGraphicsPixmapItems for the 'tokens'.

                            It might take longer to implement though, depending on your learning curve.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved