1 Reply Latest reply on Dec 11, 2006 8:42 AM by duckets

    Random help please!

      ok so iv created a game that generates random graphic sprites which represent a math question. And also used similar code to generate the answers as draggable sprites. The code works fine in the debugger and the Global Answer is right. My question is how can i make only 1 of the banana sprites = the correct answer and also prevent duplicate sprites appearing as the multiple choice answers.



        • 1. Re: Random help please!
          duckets Level 1
          How about something like this as a behaviour for the answer banana sprites (attached below). It uses a special technique of using a property of the script object, rather than the behaviour instance, to share data between siblings of the same behaviour. Each behaviour selects one item from the list, and deletes that item so no other can pick it. The first instance of the behaviour creates and destroys the list in beginsprite and endsprite.

          hope this helps!

          - Ben