Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Game Implementation
Qt 6.11 is out! See what's new in the release blog

QML Game Implementation

Scheduled Pinned Locked Moved QML and Qt Quick
16 Posts 4 Posters 9.2k 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.
  • T Offline
    T Offline
    timoph
    wrote on last edited by
    #7

    AFAIK there's no straightforward way to do it. You can expose the underlaying QGraphicsItem stuff and use collidesWith() etc from there or you can implement your own collision detection based on item coordinates (could be a bit expensive operation). Dunno if there are examples floating on this floating around somewhere.

    If someone has a nice and clean example for this, please share.

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #8

      Please don't start new topics on the same subject over and over again. Please give us some time to respond. Not everybody is always active. It's weekend you know;-)

      I Merged the 3 threads.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mikealfa
        wrote on last edited by
        #9

        I am making a game FastBall actually trying to implement the ipad game fastball2....
        in the game we have a horizontal path on which there are stars and obstacles...
        the user gains points by collecting stars and game gets over if hits obstacles...

        Well, i have implemented the Ball Module, the *stars8 and the individual obstacles modules by QML...
        i have also implemented the ball to jump when clicked...

        I have given an animation to the star and set the running property false and i have the animations to take place when the Ball moves over the star and the Ball to disappear when hits the obstacles...

        just stuck over here...how can i do that :(

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mikealfa
          wrote on last edited by
          #10

          @eddy
          m really sorry but i guess u may have to merge one more thread to this..
          m really sorry but just got stuck here and jus wanna to move way ahead

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #11

            I just merged number 4.

            Thanks for the hint ;-)

            If you have new info to add or more specific questions it is recommended to continue in the same topic. People will eventually read them. Some patience helps.

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mikealfa
              wrote on last edited by
              #12

              hey come on....
              u r too fast !

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mikealfa
                wrote on last edited by
                #13

                to: task_struct
                hey....can u tell me how to use the box2d plugin to detect collisions for my @Ball@ and @Star@ objects ?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  task_struct
                  wrote on last edited by
                  #14

                  Hello,

                  It's pretty easy. You create a World and Bodies for star and ball( may be the best fixture will be Circle ). To detect collisions you can use fixture's signal beginContact

                  For examples, see http://gitorious.org/qml-box2d/qml-box2d/trees/master/examples

                  I can't find detailed documentation so I use source code. You can look at headers to see what different types can do. In QML all Q_PROPERTYs are visible, also you can connect to every signal, and you can call every function that starts with macro Q_INVOKABLE

                  "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

                  • Linu...
                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mikealfa
                    wrote on last edited by
                    #15

                    hey tas but how to use the beginContact signal...i tried using it bt guess m messing lil with its syntax...unable to get output

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      task_struct
                      wrote on last edited by
                      #16

                      Hello,

                      You shoud have something like this:

                      @
                      Body {
                      id: someBody

                          fixtures: Circle {
                                  id: circle
                      
                                  radius: 10
                                  density: 6
                                  friction: 0.7
                                  restitution: 0.4
                      
                                  onBeginContact: {
                                          // put here your code
                                  }
                          }
                      

                      }
                      @

                      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

                      • Linu...
                      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