1 Reply Latest reply on May 3, 2008 12:54 PM by Newsgroup_User

    Drag a sprite and get a mark

    IbrahimFromAustralia
      I want to design an activity using Director. I will write a line such as: He ...... a tall boy. I will have three sprites. Sprite one will be (am) sprite two will be (is) and sprite three will be (are). I can make the three sprites dragable but I want the wrong ones to bounce back. The correct one will stay and the user will get a mark. I was told that I could do that using a script that involves a gscore. I have never used this before. Can you help, please?
        • 1. Re: Drag a sprite and get a mark
          Level 7
          >I want to design an activity using Director. I will write a line such as:
          >He
          > ...... a tall boy. I will have three sprites. Sprite one will be (am)
          > sprite
          > two will be (is) and sprite three will be (are). I can make the three
          > sprites
          > dragable but I want the wrong ones to bounce back. The correct one will
          > stay
          > and the user will get a mark. I was told that I could do that using a
          > script
          > that involves a gscore. I have never used this before. Can you help,
          > please?

          I don't know what the gscore is about, but try this (don't make the sprites
          moveable, this script handles the movement better than the default
          moveableSprite behavior):

          property my, homeLoc, selected
          on beginSprite me
          my = sprite(me.spriteNum)
          homeLoc = my.loc
          selected = 0
          end
          on mouseDown me
          selected = 1
          end
          on exitFrame me
          if selected then my.loc = the mouseLoc
          end
          on mouseUp me
          selected = 0
          if <I'm in the correct location - you'll have to code this> then
          alert("Correct!")
          <Whatever else you want it to do when you get a right answer>
          else
          my.loc = my.homeLoc --Bounce back
          alert("Sorry, try again.")
          end if
          end