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. [SOLVED]Question in Destroying Objects
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Question in Destroying Objects

Scheduled Pinned Locked Moved Game Development
7 Posts 4 Posters 4.7k 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.
  • L Offline
    L Offline
    lexan
    wrote on last edited by
    #1

    hi everyone I would like to ask on how would I be able to destroy falling objects in the game I'm making
    the objects are supposed to be destroyed once the user input a correct answer

    i think i'll be using this algorithm

    @if(input==array[randomIndex,1])@

    but apparently, I will not be using array anymore...
    Im using a Math function in javascript so that I'll be able to generate random numbers for the questions...

    anyone have an idea?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

      The idea is depends on if you want to use garbage collection in javascript or not. You can leave them and let javascript to handle this deletion or you want delete them explicitly by using xxx.destroy()

      And how about your array, if it's a property in QML or not

      Chuck

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lexan
        wrote on last edited by
        #3

        Thanks for your reply Chuck. I have another question. How would I limit the number of falling objects in my game? Since I still haven't implemented a timer.. I want to have falling objects stop, say, after one minute? how's that?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chuck Gao
          wrote on last edited by
          #4

          [quote author="lexan" date="1310295579"]Thanks for your reply Chuck. I have another question. How would I limit the number of falling objects in my game? Since I still haven't implemented a timer.. I want to have falling objects stop, say, after one minute? how's that?
          [/quote]

          1. Just use a int property like
            @property int objectCount: MAX_COUNT@

          2. I think timer is the best way, it's very simple using QML :D

          Chuck

          1 Reply Last reply
          0
          • C Offline
            C Offline
            changsheng230
            wrote on last edited by
            #5

            Dynamic Object Management in QML :
            http://doc.qt.nokia.com/4.7-snapshot/qdeclarativedynamicobjects.html

            Chang Sheng
            常升

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lexan
              wrote on last edited by
              #6

              but hey how can I destroy an object based on an event or on a trigger??
              for example.. if the user inputted/key in a correct answer the falling object must be destroyed?
              how would i do that??

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kunal_the_one
                wrote on last edited by
                #7

                I had done similar coding for my The Math Game, in this game some coulds fall from top and when user answer correct answer it got destroyed.

                I had written down my experience for creating that game in following post. Check out "Performing animation on component destruction." section. that might help you.

                http://kunalmaemo.blogspot.com/2011/05/some-qml-animation-technique.html

                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