6 Replies Latest reply on Apr 12, 2010 9:00 AM by dazz3r

    Need conceptual help for a simple drag n drop game

    dazz3r

      As anyone who saw my previous thread knows, I'm trying to make an educational app prototype (I'm new to Flash, this is for a Masters in education) to help students learn IPA symbols (phonetics). I have successfully made a section where the students click on symbols to hear the corresponding audio and listen to explanations.

       

      For the final part of the prototype, I have to create some kind of instructional game. My idea is to have 12 circles, each one playing an audio file of a vowel sound (this I know how to do). The students will have to click the circles to listen and then drag and drop them to the correct IPA symbol. Flash would then give feedback on correct/incorrect answers and a score. Maybe all of this is against the clock, needing a timer.

       

      So, I need to learn drag and drop. What else to I need to learn so that one drop position is considered "correct", the others are considered "incorrect" and a score is given at the end? And maybe a timer?)

       

      Any conceptual help gratefully received!!

       

      Darren

        • 1. Re: Need conceptual help for a simple drag n drop game
          Ned Murphy Adobe Community Professional & MVP

          Your best bet (and friend) when it comes to finding lessons on Flash is Google.  Try searching it for "AS3 drag and drop tutorial" and similar terminology.  I am sure folks have lessons waiting for you to learn.  As far as a timer goes, look into the help documents for the getTimer() function.  You can use it to mark a start time and a finish time, which you can in turn use to calculate the game time.

          • 2. Re: Need conceptual help for a simple drag n drop game
            dazz3r Level 1

            Cheers for the reply.

             

            Yes, I have heard of this Google you speak of The thing is, sometimes as a beginner you can't see the wood for the trees and I find mountains of info when I search, it's hard to know which direction to do in. As for drag & drop I had already found good tutorials on that, it's more the other concepts that need to be employed that I would like information on.

             

            I'll look into the getTomer() function, sounds just what I need.

             

            As for the scoring correct/incorrect answers, i found a wonderful example on flashkit.com, which would basically solve all my problems if I learn how to adapt it. The trouble is it was made in Flash 7, I'm on CS4.

             

            How many changes would I need to make to the code to turn it into AS3?

             

            Cheers everyone

            Darren

             

            (EDIT: I pasted the code and now it looks weird. I used SQL syntax highlighting on this page, maybe somebody could tell me how to past code and get it looking correct?)

             

             

            myAnswers = [[1, 1], [2, 2], [3, 5], [4, 4]];
            
            
            function doDrop(dragSprite, numTargets) {
                 for (i=1; i<numTargets+1; i++) {
                      if (_root[dragSprite].hitTest("_root.q"+i)) {
                           if (_root["q"+i]._currentframe<>2) {
                                _root[dragSprite]._x = _root["q"+i]._x+5;
                                _root[dragSprite]._y = _root["q"+i]._y+2;
                                _root["q"+i].gotoAndStop(2);
                           } else {
                                _root[dragSprite]._x = _root[dragSprite].stx;
                                _root[dragSprite]._y = _root[dragSprite].sty;
                           }
                      }
                 }
            }
            function clearDrop(dragSprite, numTargets) {
                 for (i=1; i<numTargets+1; i++) {
                      if (_root[dragSprite].hitTest("_root.q"+i)) {
                           if (_root["q"+i]._currentframe == 2) {
                                _root["q"+i].gotoAndStop(1);
                                break;
                           }
                      }
                 }
            }
            
            
            
            • 3. Re: Need conceptual help for a simple drag n drop game
              Ned Murphy Adobe Community Professional & MVP

              Unfortunately, these forums aren't (usually) a place for detailed lessons.  If you have a problem you can demonstrate, then you are likely to get help resolving it.  But if lack of knowledge of Flash is the main problem, you're better off finding prepared resources to learn from.

               

              As a beginner, it can be tough learning, but you have to suffer the learning to come to understand the functionality... we all go thru it.  If you want an AS3 solution, find an AS3 tutorial.  Your best bet will be to take small bites and build this in that manner.  Don't try to resolve the whole design in one sweeping motion.  Tackle each part one at at time.  If you have a problem getting some code to work for you, then come back and explain what you have created so far and show the code.

              • 4. Re: Need conceptual help for a simple drag n drop game
                dazz3r Level 1

                Again, thanks for taking the time to respond.

                 

                And your advice is a valuable and true as it is already known to me, the value of learning one step at a time, finding an AS3 tutorial to solve an AS3 problem and so on.

                 

                The thing is, as a 42 year old teacher I'm not trying to become a Flash programmer at this stage of the game, I'm trying to learn sufficient code to put a project idea into practice that shows sound pedagogical principles rather than programming skills. Hence my need to try and take a few shortcuts to get a job done against a pending deadline.

                 

                And also hence my original questions about which concepts (apart from drag and drop and the stop timer you explained) I need to focus on. Which still stands as my main question (the AS one I'll have to try elsewhere). I've only been using Flash for 3 weeks and have seen questions posted here that I could answer, so I don't feel that my "general guidance" question is that demanding or inappropriate.

                 

                Anyway, I shall press on with my lynda.com tutorials and my Doug Winnie podcasts (you see! I had already thought of using the, erm, Internet , for tutorials and practice) and no doubt return with some hopefully more concrete questions.

                 

                Cheers!

                • 5. Re: Need conceptual help for a simple drag n drop game
                  Ned Murphy Adobe Community Professional & MVP

                  Regardless of of how young you are, you don't have to become a Flash programmer to get thru this, but if you want to have something and don't want to pay for it, then...  well, I guess you already know what needs to happen.

                  • 6. Re: Need conceptual help for a simple drag n drop game
                    dazz3r Level 1

                    OK, just in case anybody else gets stuck on something similar and searches this forum, I found a nice drag n drop game that with some serious alteration plus a timer feature might be what I'm looking for.

                     

                    http://monkeyflash.com/tutorials/flash-drag-and-drop/

                     

                    (hope it's OK to post URLs)

                     

                    Now to get to work on examining code and changing it to fit my app.

                     

                    D