XFIR 39VMpami:*YEK muhTmuhT muhT3muhT4muhTmuhT muhTmuhT'muhT(muhT52muhT17muhT;*SAC fniCFCRD XtcL SREV SREV SREV6 lccFCRDTT: :Vؼ?g. .tSAC 1IIII]]]]]]qqqqqquy}--Attach to a "Check Answers Button" to make it query the global list for correct order of a 5 step assembly. --Also displays custom messages on right or wrong answers. --In addition, it also displays number of tries based on right or wrong answer on mouseup global glist, glistT set current = glistT.tries if glist = [1, 1, 2, 1,2,3, 1,2,3,4, 1,2,3,4,5] then member("answerresults").text="Correct!" else member("answerresults").text="One or more are incorrect - (Reset) to try again" if member("answerresults").text="Correct!" then set glistT.tries=current+1--a correct answer will add a try as well if member("answerresults").text="One or more are incorrect - (Reset) to try again" then set glistT.tries=current+1--If the answer is incorrect than add a try to the total end if end if endCheck Assembled Answerss11,?%i?'. . XtcL `  !N`!N+!N!N!."!N#!N$!O(%!O&!O.!Od/!O<0rcsL\ \``   5CJCWaP"BW JCWaCW BW JCWJbBW#  lccpamFknujAmuhT ++++++++++++++++++++++++++++++++++ *++V+++ -+++Y++/++V+++""+/[~[+++""+ [++++"""++ ++++"""++߅++ ++"F""++[]Z++++UU+++++++++++++++++ ++@2+++++F"9++++"""+++++9"@+++1?82+++*YEK muhTmuhT muhT3muhT4muhTmuhT muhTmuhT'muhT(muhT52muhT17muhT9*SAC fniCFCRD XtcL SREV SREV SREV* lccFCRDTT: :Vؼ?g. .ltSAC  &&&&::::::NNNNNNRVZ--This behavior is designed to be used for the "Assemble In Correct Order" type activities and will snap back to the location the sprite is currently located. This behavior causes your incorrect drag items to be snaped back when dragged and released. The current DragNDrop behaviors that I have posted only have "snapback" for (correct) drag items. That is to say when the target is where you first drop the behavior and the snap back location being where your sprite currently is. --To use, just drop the behavior on an incorrect drag item. --It is very important that this behavior is removed from a sprite that is tagged with the DragNDrop Challenge behavior (for correct items). Unlike most behaviors, having these two together will cause a conflict. --Also important is to remove it from an item that is already "assembled" meaning it has snapped to the main target. This is because the two behaviors will also conflict if you have two seperate sprites (with the behaviors) on top of each other when checking the correct condition. So basically when an object gets placed correctly, make sure you remove its DragNDrop Challenge behavior from then on in the score. property pOriginalLoc, spritenum on mousedown set pOriginalLoc = sprite(SpriteNum).loc -- record the original position cursor 290--closed grapping hand end on mouseUp me if sprite(SpriteNum).rect=rect(1000,1000,1000,1000) then beep -- Will only else Sprite(SpriteNum).loc = pOriginalLoc --snap back to original location cursor 260 -- normal reach hand end Snap Back To Staring Pointnqq,?,(c?. .tSACv h --This behavior is for use with the "Asemble In Correct Order" type activities where only one drag item is correct and moving along to the next marker is only required when your correct sprite is over the target. --You could actually use the Matching Game behaviors (DragNDrop), but over half of the features are not used for just this simple task of matching one correct item. This behavior also allows itself to be attched to more than one sprite on the same frame for use with a "scored assemble in correct order activity" where you can choose any order to assemble in and the judgement is not made till the end when you "check answers" --One thing to note with these Assemble in correct order activities is that to look right upon jumping to the the next segment you need to have the next segment set up sothe current correct item is attached to your target as "how it would look when assembled". Each "next step" segment will need to take take up two frames. --Why 2 frames? --The first frame would have the marker and a "Play Sound & Message When Correct" frame behavior attached to it. You only hit it for a half second. --the 2nd would be identical with a looping/hold behavior attached -- ready for your next attempt. The reason for pre-frame (1 of 2) is to do nothing more than trigger a sound or message that the action is correct. --properties used property spriteNum, pOriginalLoc, specialcorrectsound, correcttarget, nextsequence, startdrageffect, stopdrageffect ----------------------------------------- --event handlers on mouseDown me pOriginalLoc = sprite(SpriteNum).loc -- record the original position before dragging cursor 290--closed grapping hand startdrageffect end on mouseUp me cursor 260 -- normal reach hand if sprite(spritenum).intersects(correcttarget) then go to nextsequence else sprite(SpriteNum).loc =pOriginalLoc --snap back to original location stopdrageffect end if end ------------------------------------------- --touchsense handlers on startdrageffect --starts forcefeedback effect of dragging if user has touchsense mouse. You'll need the immersion touchsense scripts in your project as well- global gImmWebInstalled global gResRef if (gImmWebInstalled) then startEffect(sprite 15, "dragging", gResRef) end if end on stopdrageffect --stops the forcefeedback effect when not dragging- global gImmWebInstalled global gResRef if (gImmWebInstalled) then stopEffect(sprite 15, "dragging", gResRef) end if end ------------------------------------------------- --Property box modifiers on getPropertyDescriptionList me set theProps to [:] set a to "Choose the target for this correct sprite's match:" set b to #integer set c to [#min: 1, #max: 20] set d to 9 addProp theProps, #correcttarget, [#comment: a, #format: b, #range: c, #default: d] set e to "Marker to jump to when correct?" set f to #marker set g to "step1" addProp theProps, #nextsequence, [#comment: e, #format: f, #default: g] return theProps end Snap To Correct Target[#correcttarget: [#comment: "Choose the target for this correct sprite's match:", #format: #integer, #range: [#min: 1, #max: 20], #default: 9], #nextSequence: [#comment: "Marker to jump to when correct?", #format: #marker, #default: "step1"]]b ,>?. .tSACh Z--This behavior is to be used with Assemble in correct order projects if you are using my DragNDrop Challenge or Quiz behaviors as they refuse to do any commands during mouseup on a correct match if only 1 pair is being set as correct as would be the case if you are doing a dragNdrop challenge. --This behavior is required to make the special message or special sound on correct to actually work as it should --To use, attach this behavior as a frame behavior to the frame before the one you want to hold the user at right before the next attempt. Make sure all your elements are in the frame as well or you will see a blink as for a split second the user would be seeing an empty channel. property specialcorrectsound, specialcorrectmessage on exitFrame me puppetSound 3, member specialcorrectsound alert specialcorrectmessage end ---------------------------------- on getpropertydescriptionlist PDL =[:] PDL [#specialcorrectsound]=[#comment: "choose your special correct sound", #format: #sound, #default:"specialcorrectsound"] PDL [#specialcorrectmessage]=[#comment: "type in your special correct message", #format: #string, #default:"Correct"] return PDL end !Play Sound & Message When Correct[#specialcorrectsound: [#comment: "choose your special correct sound", #format: #sound, #default: "specialcorrectsound"], #specialcorrectmessage: [#comment: "type in your special correct message", #format: #string, #default: "Correct"]]*,?,V?. .tSAC 1IIII]]]]]]qqqqqquy}--Attach to a "Check Answers Button" to make it query the global list for correct order of a 5 step assembly. --Also displays custom messages on right or wrong answers. --In addition, it also displays number of tries based on right or wrong answer on mouseup global glist, glistT set current = glistT.tries if glist = [1, 1, 2, 1,2,3, 1,2,3,4, 1,2,3,4,5] then member("answerresults").text="Correct!" else member("answerresults").text="One or more are incorrect - (Reset) to try again" if member("answerresults").text="Correct!" then set glistT.tries=current+1--a correct answer will add a try as well if member("answerresults").text="One or more are incorrect - (Reset) to try again" then set glistT.tries=current+1--If the answer is incorrect than add a try to the total end if end if endCheck Assembled Answerss11,?%i?'. .tSAC +JJJJ^^^^^^rrrrrrvz~ --Displays the number of tries in a text field based on the contents of a global list that is tracking the number of tries. --This behavior is to be attached to a text field that will the "reciever" of the message that specifies the number of tries property pMyField property spritenum global glistT on beginSprite me set mySprite = the spriteNum of me set pMyField = the name of member the member of sprite mySprite if voidP(glistT) then set glistT= [] end if end on exitFrame me put "Tries ="&& glistT.tries into field pMyField endDisplay List Contents In Fieldp,?+R?/. .tSAC              $(, --Custom global list to track the number of tries attempted. --Also initionally resets textfields refering to the tries and results as blank. You may or may not have these --This behavior has been specifically designed to be used with the Drag&Drop Quiz Activities where tries need to be recorded. -------------------------------------- on prepareMovie global glist set glist = [#tries:0] member("tries").text="" member("answerresults").text="" end&Multiple Global List for Member Changeu.,>ؼ?. .tSAC  .FFFFZZZZZZnnnnnnrvz --Attach this behavior to a check answers button to compare the location of your draggable sprites with the location of the various targets. If all 3 are right it is "correct" --every time the user presses the "check answers" button, 1 attempt will be added to the number of tries that is being tracked in the global list. --The global list is located in the "Multiple Global List for Member Change" behavior on mouseup global glist set current = glist.tries if sprite(5).loc=sprite(2).loc and sprite(6).loc=sprite(3).loc and sprite(7).loc=sprite(4).loc then member("answerresults").text="Correct!" else member("answerresults").text="One or more are incorrect - try again" if member("answerresults").text="One or more are incorrect - try again" then sprite(5).moveablesprite=true if member("answerresults").text="One or more are incorrect - try again" then sprite(6).moveablesprite=true if member("answerresults").text="One or more are incorrect - try again" then sprite(7).moveablesprite=true set glist.tries=current+1 end if end if end if end if end Drap&Drop Check Answersn,?+v?. .knujSREV ASREV AknujtcthePropsbspecialcorrectsound puppetSoundalertspecialcorrectmessagesoundsetAtstringPDLSREV AmuhTy ############### #########################muhT   ě      muhT ***************U*************UU****************U************UT*****************V****U**V*U**U*** +V**U**U*+**UU**UUU+**U+****U**U***V***U**XtcL `  !N!1(+!N$!Nt!4 !N`#!N$!N%!N&!2,.!2/!10rcsL\ \``   5CJCWaP"BW JCWaCW BW JCWJbBW# rcsL~~~\z\\\ V$sIVaWRI AAAAAAAAAAAAAAACDCW Db DCW Db DCW a D IVLAbWDCW a D IVLAbWX V4   answerresults Correct!1One or more are incorrect - (Reset) to try againtSAC  &&&&::::::NNNNNNRVZ--This behavior is designed to be used for the "Assemble In Correct Order" type activities and will snap back to the location the sprite is currently located. This behavior causes your incorrect drag items to be snaped back when dragged and released. The current DragNDrop behaviors that I have posted only have "snapback" for (correct) drag items. That is to say when the target is where you first drop the behavior and the snap back location being where your sprite currently is. --To use, just drop the behavior on an incorrect drag item. --It is very important that this behavior is removed from a sprite that is tagged with the DragNDrop Challenge behavior (for correct items). Unlike most behaviors, having these two together will cause a conflict. --Also important is to remove it from an item that is already "assembled" meaning it has snapped to the main target. This is because the two behaviors will also conflict if you have two seperate sprites (with the behaviors) on top of each other when checking the correct condition. So basically when an object gets placed correctly, make sure you remove its DragNDrop Challenge behavior from then on in the score. property pOriginalLoc, spritenum on mousedown set pOriginalLoc = sprite(SpriteNum).loc -- record the original position cursor 290--closed grapping hand end on mouseUp me if sprite(SpriteNum).rect=rect(1000,1000,1000,1000) then beep -- Will only else Sprite(SpriteNum).loc = pOriginalLoc --snap back to original location cursor 260 -- normal reach hand end Snap Back To Staring Pointnqq,?,(c?. .tSACv h --This behavior is for use with the "Asemble In Correct Order" type activities where only one drag item is correct and moving along to the next marker is only required when your correct sprite is over the target. --You could actually use the Matching Game behaviors (DragNDrop), but over half of the features are not used for just this simple task of matching one correct item. This behavior also allows itself to be attched to more than one sprite on the same frame for use with a "scored assemble in correct order activity" where you can choose any order to assemble in and the judgement is not made till the end when you "check answers" --One thing to note with these Assemble in correct order activities is that to look right upon jumping to the the next segment you need to have the next segment set up sothe current correct item is attached to your target as "how it would look when assembled". Each "next step" segment will need to take take up two frames. --Why 2 frames? --The first frame would have the marker and a "Play Sound & Message When Correct" frame behavior attached to it. You only hit it for a half second. --the 2nd would be identical with a looping/hold behavior attached -- ready for your next attempt. The reason for pre-frame (1 of 2) is to do nothing more than trigger a sound or message that the action is correct. --properties used property spriteNum, pOriginalLoc, specialcorrectsound, correcttarget, nextsequence, startdrageffect, stopdrageffect ----------------------------------------- --event handlers on mouseDown me pOriginalLoc = sprite(SpriteNum).loc -- record the original position before dragging cursor 290--closed grapping hand startdrageffect end on mouseUp me cursor 260 -- normal reach hand if sprite(spritenum).intersects(correcttarget) then go to nextsequence else sprite(SpriteNum).loc =pOriginalLoc --snap back to original location stopdrageffect end if end ------------------------------------------- --touchsense handlers on startdrageffect --starts forcefeedback effect of dragging if user has touchsense mouse. You'll need the immersion touchsense scripts in your project as well- global gImmWebInstalled global gResRef if (gImmWebInstalled) then startEffect(sprite 15, "dragging", gResRef) end if end on stopdrageffect --stops the forcefeedback effect when not dragging- global gImmWebInstalled global gResRef if (gImmWebInstalled) then stopEffect(sprite 15, "dragging", gResRef) end if end ------------------------------------------------- --Property box modifiers on getPropertyDescriptionList me set theProps to [:] set a to "Choose the target for this correct sprite's match:" set b to #integer set c to [#min: 1, #max: 20] set d to 9 addProp theProps, #correcttarget, [#comment: a, #format: b, #range: c, #default: d] set e to "Marker to jump to when correct?" set f to #marker set g to "step1" addProp theProps, #nextsequence, [#comment: e, #format: f, #default: g] return theProps end Snap To Correct Target[#correcttarget: [#comment: "Choose the target for this correct sprite's match:", #format: #integer, #range: [#min: 1, #max: 20], #default: 9], #nextSequence: [#comment: "Marker to jump to when correct?", #format: #marker, #default: "step1"]]b ,>?. .tSAC )))******>>>>>>BFJ--This behavior is to be used with Assemble in correct order projects if you are using my DragNDrop Challenge or Quiz behaviors as they refuse to do any commands during mouseup on a correct match if only 1 pair is being set as correct as would be the case if you are doing a dragNdrop challenge. --This behavior is required to make the special message or special sound on correct to actually work as it should --To use, attach this behavior as a frame behavior to the frame before the one you want to hold the user at right before the next attempt. Make sure all your elements are in the frame as well (meaning don't have any blank frames between the next frame you are going to jump to)...or you will see a blink as for a split second the user would be seeing that empty channel. property specialcorrectsound, specialcorrectmessage on exitFrame me puppetSound 3, member specialcorrectsound alert specialcorrectmessage end ---------------------------------- on getpropertydescriptionlist PDL =[:] PDL [#specialcorrectsound]=[#comment: "choose your special correct sound", #format: #sound, #default:"specialcorrectsound"] PDL [#specialcorrectmessage]=[#comment: "type in your special correct message", #format: #string, #default:"Correct"] return PDL end !Play Sound & Message When Correct[#specialcorrectsound: [#comment: "choose your special correct sound", #format: #sound, #default: "specialcorrectsound"], #specialcorrectmessage: [#comment: "type in your special correct message", #format: #string, #default: "Correct"]]*,?,V?. .tSACA A1 1&1&1&AHA\A\A\A\A\A\ApApApApApApAtAxA|--This behavior is a modified version of Snap To Correct Target and is intended to be used with "Asemble In Correct Order Quiz" type activities where drag items can be assembled in any order with their order recorded to a list that will be queried for correctness with the "Check Assembled Answers" --In its current state, this behavior will handle up to 5 drag ordered items. --Actions that happen on mouseup are: --1. cursor goes back to non-grapping hand --2. Forcefeedback effect is stopped (if your using one) --3. The items assembled state gets recorded in a tracking list --4. A sound of your choice will play --5. Item snaps to correct location if over target --6. target coverup sprite appears over correct item to show it assembled correctly --7. Item's text description dissapears (if description is used) --8. Item snaps back if not correct --Because of all these actions, you will see a pretty long parameters dialogue box. You might want to set up your defaults yourself before dragging the behavior to your project, as many settings such as a sprite's number, will not change and you would do good to set the defaults one time and then begin work. --One thing to note with these Assemble in correct order activities is that to look right upon jumping to the the next segment you might need to have the layer/channel order changed so that an item is under the target or to give the appearence as to "how it would look when assembled". If it is being assembled inside something that is. --As such, I use a vector square with no borders (invisible) to be what I call a "place holder to cover the correct objects". This blank hotspot's member changes to the target member so that upon "snap to" of each item, the item is covered up with the target. Since director does not allow dynamic sprite channel swapping, this would be the best work around. --In the "Scored Assembly Game" example, I have 5 coverup sprites. One for every drag member. If you add more drag members, you may need more drag sprite coverups as well. --If your project does not require the channel order to change, you can just comment out the "if then" statements on the mouseup that relate to each. ---------------------------------------- --properties used property spriteNum, pOriginalLoc, specialcorrectsound, correcttarget, nextsequence, startdrageffect, stopdrageffect, property correcttargetsmember property step1element, step1startloc, step1correctloc, description1, coverup1 property step2element, step2startloc, step2correctloc, description2, coverup2 property step3element, step3startloc, step3correctloc, description3, coverup3 property step4element, step4startloc, step4correctloc, description4, coverup4 property step5element, step5startloc, step5correctloc, description5, coverup5 ----------------------------------------- --event handlers on beginsprite cursor 260 -- normal reach hand end global glist on mouseDown me cursor 290--closed grapping hand startdrageffect end on mouseUp me cursor 260 -- normal reach hand stopdrageffect if sprite(step1element).intersects(correcttarget) then add glist, 1 if sprite(step1element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step1element).intersects(correcttarget) then sprite(step1element).loc=step1correctloc if sprite(step1element).intersects(correcttarget) then sprite(description1).blend=0 if sprite(step1element).intersects(correcttarget) then sprite(coverup1).member=member(correcttargetsmember) else sprite(step1element).loc= step1startloc ---------- if sprite(step2element).intersects(correcttarget) then add glist, 2 if sprite(step2element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step2element).intersects(correcttarget) then sprite(step2element).loc=step2correctloc if sprite(step2element).intersects(correcttarget) then sprite(description2).blend=0 if sprite(step2element).intersects(correcttarget) then sprite(coverup2).member=member(correcttargetsmember) else sprite(step2element).loc= step2startloc ---------- if sprite(step3element).intersects(correcttarget) then add glist, 3 if sprite(step3element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step3element).intersects(correcttarget) then sprite(step3element).loc=step3correctloc if sprite(step3element).intersects(correcttarget) then sprite(description3).blend=0 if sprite(step3element).intersects(correcttarget) then sprite(coverup3).member=member(correcttargetsmember) else sprite(step3element).loc= step3startloc ----------------- if sprite(step4element).intersects(correcttarget) then add glist, 4 if sprite(step4element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step4element).intersects(correcttarget) then sprite(step4element).loc=step4correctloc if sprite(step4element).intersects(correcttarget) then sprite(description4).blend=0 if sprite(step4element).intersects(correcttarget) then sprite(coverup4).member=member(correcttargetsmember) else sprite(step4element).loc= step4startloc --------------------- if sprite(step5element).intersects(correcttarget) then add glist, 5 if sprite(step5element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step5element).intersects(correcttarget) then sprite(step5element).loc=step5correctloc if sprite(step5element).intersects(correcttarget) then sprite(description5).blend=0 if sprite(step5element).intersects(correcttarget) then sprite(coverup5).member=member(correcttargetsmember) else sprite(step5element).loc= step5startloc end if end if end if end if end if end ------------------------------------------------- --Property box modifiers on getPropertyDescriptionList me set theProps to [:] set a to "Choose the sprite # of the main target for this exercise:" set b to #integer set c to [#min: 1, #max: 40] set d to 9 addProp theProps, #correcttarget, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the member name of the main target for this exercise:" set b to #graphic set d to "caliper" addProp theProps, #correcttargetsmember, [#comment: a, #format: b, #default: d] --------------------------------------------------------------step1 set a to "Choose the sprite # of the 1st step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 10 addProp theProps, #step1element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 1s element:" set b to #point set d to point(174, 197) addProp theProps, #step1startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step1 element:" set b to #point set c to point(281, 156) addProp theProps, #step1correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 1st object: " set b to #integer set c to [#min: 1, #max: 40] set d to 11 addProp theProps, #coverup1 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 1 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 3 addProp theProps, #description1 , [#comment: a, #format: b, #range: c, #default: d] ------------------------------------------------------------step2 set a to "Choose the sprite # of the 2nd step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 12 addProp theProps, #step2element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 2's element:" set b to #point set d to point(37, 252) addProp theProps, #step2startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step2 element:" set b to #point set c to point(286, 156) addProp theProps, #step2correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 2nd object: " set b to #integer set c to [#min: 1, #max: 40] set d to 13 addProp theProps, #coverup2 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 1 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 2 addProp theProps, #description2 , [#comment: a, #format: b, #range: c, #default: d] ------------------------------------------------------------step3 set a to "Choose the sprite # of the step3 element:" set b to #integer set c to [#min: 1, #max: 40] set d to 14 addProp theProps, #step3element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 3's element:" set b to #point set d to point(166,114) addProp theProps, #step3startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step3 element:" set b to #point set c to point(281,160) addProp theProps, #step3correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 3rd object: " set b to #integer set c to [#min: 1, #max: 40] set d to 15 addProp theProps, #coverup3 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 3 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 1 addProp theProps, #description3 , [#comment: a, #format: b, #range: c, #default: d] -----------------------------------------------step4 set a to "Choose the sprite # of the 4th step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 16 addProp theProps, #step4element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 4's element:" set b to #point set d to point(104, 189) addProp theProps, #step4startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step4 element:" set b to #point set c to point(293, 157) addProp theProps, #step4correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 4th object: " set b to #integer set c to [#min: 1, #max: 40] set d to 17 addProp theProps, #coverup4 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 4 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 4 addProp theProps, #description4 , [#comment: a, #format: b, #range: c, #default: d] -------------------------------------------------------step5 set a to "Choose the sprite # of the 5th step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 18 addProp theProps, #step5element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 5's element:" set b to #point set d to point(42, 131) addProp theProps, #step5startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step5 element:" set b to #point set c to point(268, 156) addProp theProps, #step5correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 5th object: " set b to #integer set c to [#min: 1, #max: 40] set d to 19 addProp theProps, #coverup5 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 5 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 5 addProp theProps, #description5 , [#comment: a, #format: b, #range: c, #default: d] ------------ set c to "Name of the special correct sound for snap to target?" set f to #sound set d to "specialcorrectsound" addProp theProps, #specialcorrectsound, [#comment: c, #format: f, #default: d] return theProps end ------------------------------------------- --touchsense handlers on startdrageffect --starts forcefeedback effect of dragging if user has touchsense mouse. You'll need the immersion touchsense scripts in your project as well- global gImmWebInstalled global gResRef if (gImmWebInstalled) then startEffect(sprite 15, "dragging", gResRef) end if end on stopdrageffect --stops the forcefeedback effect when not dragging- global gImmWebInstalled global gResRef if (gImmWebInstalled) then stopEffect(sprite 15, "dragging", gResRef) end if end Snap To Correct Target Quiz[#correcttarget: [#comment: "Choose the sprite # of the main target for this exercise:", #format: #integer, #range: [#min: 1, #max: 40], #default: 9], #correcttargetsmember: [#comment: "Choose the member name of the main target for this exercise:", #format: #graphic, #default: "caliper"], #step1element: [#comment: "Choose the sprite # of the 1st step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 10], #step1startloc: [#comment: "Choose the start location of step 1s element:", #format: #point, #default: point(174, 197)], #step1correctloc: [#comment: "Choose the assembled correct finish location of the step1 element:", #format: #point, #default: point(281, 156)], #coverup1: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 1st object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 11], #description1: [#comment: "What is the sprite # of the text description of step 1 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 3], #step2element: [#comment: "Choose the sprite # of the 2nd step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 12], #step2startloc: [#comment: "Choose the start location of step 2's element:", #format: #point, #default: point(37, 252)], #step2correctloc: [#comment: "Choose the assembled correct finish location of the step2 element:", #format: #point, #default: point(286, 156)], #coverup2: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 2nd object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 13], #description2: [#comment: "What is the sprite # of the text description of step 1 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 2], #step3element: [#comment: "Choose the sprite # of the step3 element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 14], #step3startloc: [#comment: "Choose the start location of step 3's element:", #format: #point, #default: point(166, 114)], #step3correctloc: [#comment: "Choose the assembled correct finish location of the step3 element:", #format: #point, #default: point(281, 160)], #coverup3: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 3rd object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 15], #description3: [#comment: "What is the sprite # of the text description of step 3 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 1], #step4element: [#comment: "Choose the sprite # of the 4th step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 16], #step4startloc: [#comment: "Choose the start location of step 4's element:", #format: #point, #default: point(104, 189)], #step4correctloc: [#comment: "Choose the assembled correct finish location of the step4 element:", #format: #point, #default: point(293, 157)], #coverup4: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 4th object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 17], #description4: [#comment: "What is the sprite # of the text description of step 4 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 4], #step5element: [#comment: "Choose the sprite # of the 5th step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 18], #step5startloc: [#comment: "Choose the start location of step 5's element:", #format: #point, #default: point(42, 131)], #step5correctloc: [#comment: "Choose the assembled correct finish location of the step5 element:", #format: #point, #default: point(268, 156)], #coverup5: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 5th object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 19], #description5: [#comment: "What is the sprite # of the text description of step 5 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 5], #specialcorrectsound: [#comment: "Name of the special correct sound for snap to target?", #format: #sound, #default: "specialcorrectsound"]]s88,>?%. .tSAC +JJJJ^^^^^^rrrrrrvz~ --Displays the number of tries in a text field based on the contents of a global list that is tracking the number of tries. --This behavior is to be attached to a text field that will the "reciever" of the message that specifies the number of tries property pMyField property spritenum global glistT on beginSprite me set mySprite = the spriteNum of me set pMyField = the name of member the member of sprite mySprite if voidP(glistT) then set glistT= [] end if end on exitFrame me put "Tries ="&& glistT.tries into field pMyField endDisplay List Contents In Fieldp,?+R?/. .tSAC              $(, --Custom global list to track the number of tries attempted. --Also initionally resets textfields refering to the tries and results as blank. You may or may not have these --This behavior has been specifically designed to be used with the Drag&Drop Quiz Activities where tries need to be recorded. -------------------------------------- on prepareMovie global glist set glist = [#tries:0] member("tries").text="" member("answerresults").text="" end&Multiple Global List for Member Changeu.,>ؼ?. .tSAC   ? T T T e y y y y y y -- Attach to a reset button in a Scored matching game to reset the number of tries and force the objects back to their starting points (as mentioned below) --Also jumps to the "next" marker (a frame where all items are in their starting positions) for the purpose of reseting the game when all are correct. Without this, all drag objects would stay in their current positions on reset even if correct. property drag1, drag2, drag3 property drag1start, drag2start, drag3start on mouseup go to next global glist set glist.tries=0 --these next lines below, will force the objects back to their starting point on reset. Normally, a correct answer on the first try to one of the items would hold the sprite on that target during a reset. These lines make sure everything goes back to their starting positions. --Note: the following lines are hard coded because I am being lazy and because I am only using this specific reset button in this quick example. if member("answerresults").text="Correct!" then sprite(drag1).loc= drag1start if member("answerresults").text="Correct!" then sprite(drag2).loc= drag2start if member("answerresults").text="Correct!" then sprite(drag3).loc= drag3start end if end if end -------------------------------- on getPropertyDescriptionList me set theProps to [:] -------------------------------------drag item1 set c to "Choose the 1st drag sprite's # " set f to #integer set g to [#min: 1, #max: 20] set d to 5 addProp theProps, #drag1, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 1st drag sprite's starting location - enter as ''point(#, #)''" set f to #point set d to point(158, 133) addProp theProps, #drag1start, [#comment: c, #format: f, #default: d] -------------------------------------drag item2 set c to "Choose the 2nd drag sprite's # " set f to #integer set g to [#min: 1, #max: 20] set d to 6 addProp theProps, #drag2, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 2nd drag sprite's starting location - enter as ''point(#, #)''" set f to #point set d to point(170, 65) addProp theProps, #drag2start, [#comment: c, #format: f, #default: d] -------------------------------------drag item3 set c to "Choose the 3rd drag sprite's # " set f to #integer set g to [#min: 1, #max: 20] set d to 7 addProp theProps, #drag3, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 3rd drag sprite's starting location - enter as ''point(#, #)''" set f to #point set d to point(220, 86) addProp theProps, #drag3start, [#comment: c, #format: f, #default: d] return theProps end Reset Drag&Drop Game[#drag1: [#comment: "Choose the 1st drag sprite's # ", #format: #integer, #range: [#min: 1, #max: 20], #default: 5], #drag1start: [#comment: "Choose the 1st drag sprite's starting location - enter as ''point(#, #)''", #format: #point, #default: point(158, 133)], #drag2: [#comment: "Choose the 2nd drag sprite's # ", #format: #integer, #range: [#min: 1, #max: 20], #default: 6], #drag2start: [#comment: "Choose the 2nd drag sprite's starting location - enter as ''point(#, #)''", #format: #point, #default: point(170, 65)], #drag3: [#comment: "Choose the 3rd drag sprite's # ", #format: #integer, #range: [#min: 1, #max: 20], #default: 7], #drag3start: [#comment: "Choose the 3rd drag sprite's starting location - enter as ''point(#, #)''", #format: #point, #default: point(220, 86)]] c,?%i?. . tSAC  .FFFFZZZZZZnnnnnnrvz --Attach this behavior to a check answers button to compare the location of your draggable sprites with the location of the various targets. If all 3 are right it is "correct" --every time the user presses the "check answers" button, 1 attempt will be added to the number of tries that is being tracked in the global list. --The global list is located in the "Multiple Global List for Member Change" behavior on mouseup global glist set current = glist.tries if sprite(5).loc=sprite(2).loc and sprite(6).loc=sprite(3).loc and sprite(7).loc=sprite(4).loc then member("answerresults").text="Correct!" else member("answerresults").text="One or more are incorrect - try again" if member("answerresults").text="One or more are incorrect - try again" then sprite(5).moveablesprite=true if member("answerresults").text="One or more are incorrect - try again" then sprite(6).moveablesprite=true if member("answerresults").text="One or more are incorrect - try again" then sprite(7).moveablesprite=true set glist.tries=current+1 end if end if end if end if end Drap&Drop Check Answersn,?+v?. .rcsL|||\\"\\^\\ $ i /222*2BWCfBWACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO       rcsL\\jjbt/Pfhhh.l* 2c@BR #>R JCWaP"BWBV BWJCWJCg JBW JCWJbBV IACWDIBWIACWDIBWCRDREREAEACRA RLEE!LE"LE#LE$LCBW DRE%RDRLEE!LE"LE$LCBW LBW&-'.,*(+) Fj dragging3Choose the target for this correct sprite's match: Marker to jump to when correct?step1rcsL\!:$!N\``t8/2R : AJ/CW BW0J2BW1 CRLE/E!DE"E3E$DCBg4LE2E!DE"E5E$DCBg4LBW&6&>h"choose your special correct soundspecialcorrectsound%type in your special correct messageCorrectrcsL~~~\z\\\ V$sIVaWRI AAAAAAAAAAAAAAACDCW Db DCW Db DCW a D IVLAbWDCW a D IVLAbWX V4   answerresults Correct!1One or more are incorrect - (Reset) to try againrcsL222\\`b YV7#A  KaRLA%\CW aZPYIVCW[COV\ DIVaW JYY Tries =rcsL\\\\ CO EWCOVDCW Db  V answerresultsknuj\graphicpointglistTtriesCurrentpMyFieldnamevoidpmySpriteknujSREV AmuhTx\b\\b\\bb\\b\\b\\b\T\b\\b\VVV+b\ b\\UVb\\b\\V\\b\b\\bUT\\b\\b+\ b\\b[҆\b\\Vb\b\\b~ҫ\b\\b\++b\bV\b\\b\ \V\b\b\\b\\b}\b\b\\b\\V/(/)\\4,.\\b\\Yb3\.\b\)Y .\b\b\\b+խY|_\b\ \\b\\Ճ\b\\b\Šěb\\b \YYS\b\ \b\\b\YY\b\\b\b\\bbY\\b\\\\b\\b)/b\\b\7\\\b\\b鬆\\b\\\b\\b\\b\\b\\b\\b\\b\\b\ b\\b\\\b\b\ \\b\\b\b\\b\b\\\\b\ b\b\\b\\b\\\\b\\b\\b\b\\\b\\b\\\1\\1\\b\\b\\\\b\b\b\\b\\\b\\b \b\\b\b\\b\\b\b\\b\b\\b\b\ b\\b\\b\\b\\b\b\\b\\b\\b\\b\b\\b\\b\\b\\b\b\\b\\b\b\\b\b\b\\muhTa 1\\\\11\\ \\1 ě1\\V7\ ġ\  1+V ěV\ V muhT ## #### ## ě#### #####   muhTb++++++++++++++++++++++++++++++++++++++++++#++++++++#++++++׬+++++++++++++++++++#++#++++++#++++++#++++++++++++++++++++++++++rcsL\  \\\" e EWCO DCW Db DCW Db    triesanswerresultsrcsL888\  4\hh~vy{}z|~T '$LNX &X ExBWI bWDCW a D JyCWJzbDCW a D J{CWJ|bDCW a D J}CWJ~b CRDREREAEACRARLEyE!LE"LE#LE$LCBW DREURCWURLEzE!LE"LE$LCBW DREREAEACRARLE{E!LE"LE#LE$LCBW DREURAACWURLE|E!LE"LE$LCBW DREREAEACRARLE}E!LE"LE#LE$LCBW DREURAVCWURLE~E!LE"LE$LCBW LBW&-,+)*       D(answerresults Correct! Choose the 1st drag sprite's # JChoose the 1st drag sprite's starting location - enter as ''point(#, #)'' Choose the 2nd drag sprite's # JChoose the 2nd drag sprite's starting location - enter as ''point(#, #)'' Choose the 3rd drag sprite's # JChoose the 3rd drag sprite's starting location - enter as ''point(#, #)''knuj"tSACA A1 1&1&1&AHA\A\A\A\A\A\ApApApApApApAtAxA|--This behavior is a modified version of Snap To Correct Target and is intended to be used with "Asemble In Correct Order Quiz" type activities where drag items can be assembled in any order with their order recorded to a list that will be queried for correctness with the "Check Assembled Answers" --In its current state, this behavior will handle up to 5 drag ordered items. --Actions that happen on mouseup are: --1. cursor goes back to non-grapping hand --2. Forcefeedback effect is stopped (if your using one) --3. The items assembled state gets recorded in a tracking list --4. A sound of your choice will play --5. Item snaps to correct location if over target --6. target coverup sprite appears over correct item to show it assembled correctly --7. Item's text description dissapears (if description is used) --8. Item snaps back if not correct --Because of all these actions, you will see a pretty long parameters dialogue box. You might want to set up your defaults yourself before dragging the behavior to your project, as many settings such as a sprite's number, will not change and you would do good to set the defaults one time and then begin work. --One thing to note with these Assemble in correct order activities is that to look right upon jumping to the the next segment you might need to have the layer/channel order changed so that an item is under the target or to give the appearence as to "how it would look when assembled". If it is being assembled inside something that is. --As such, I use a vector square with no borders (invisible) to be what I call a "place holder to cover the correct objects". This blank hotspot's member changes to the target member so that upon "snap to" of each item, the item is covered up with the target. Since director does not allow dynamic sprite channel swapping, this would be the best work around. --In the "Scored Assembly Game" example, I have 5 coverup sprites. One for every drag member. If you add more drag members, you may need more drag sprite coverups as well. --If your project does not require the channel order to change, you can just comment out the "if then" statements on the mouseup that relate to each. ---------------------------------------- --properties used property spriteNum, pOriginalLoc, specialcorrectsound, correcttarget, nextsequence, startdrageffect, stopdrageffect, property correcttargetsmember property step1element, step1startloc, step1correctloc, description1, coverup1 property step2element, step2startloc, step2correctloc, description2, coverup2 property step3element, step3startloc, step3correctloc, description3, coverup3 property step4element, step4startloc, step4correctloc, description4, coverup4 property step5element, step5startloc, step5correctloc, description5, coverup5 ----------------------------------------- --event handlers on beginsprite cursor 260 -- normal reach hand end global glist on mouseDown me cursor 290--closed grapping hand startdrageffect end on mouseUp me cursor 260 -- normal reach hand stopdrageffect if sprite(step1element).intersects(correcttarget) then add glist, 1 if sprite(step1element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step1element).intersects(correcttarget) then sprite(step1element).loc=step1correctloc if sprite(step1element).intersects(correcttarget) then sprite(description1).blend=0 if sprite(step1element).intersects(correcttarget) then sprite(coverup1).member=member(correcttargetsmember) else sprite(step1element).loc= step1startloc ---------- if sprite(step2element).intersects(correcttarget) then add glist, 2 if sprite(step2element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step2element).intersects(correcttarget) then sprite(step2element).loc=step2correctloc if sprite(step2element).intersects(correcttarget) then sprite(description2).blend=0 if sprite(step2element).intersects(correcttarget) then sprite(coverup2).member=member(correcttargetsmember) else sprite(step2element).loc= step2startloc ---------- if sprite(step3element).intersects(correcttarget) then add glist, 3 if sprite(step3element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step3element).intersects(correcttarget) then sprite(step3element).loc=step3correctloc if sprite(step3element).intersects(correcttarget) then sprite(description3).blend=0 if sprite(step3element).intersects(correcttarget) then sprite(coverup3).member=member(correcttargetsmember) else sprite(step3element).loc= step3startloc ----------------- if sprite(step4element).intersects(correcttarget) then add glist, 4 if sprite(step4element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step4element).intersects(correcttarget) then sprite(step4element).loc=step4correctloc if sprite(step4element).intersects(correcttarget) then sprite(description4).blend=0 if sprite(step4element).intersects(correcttarget) then sprite(coverup4).member=member(correcttargetsmember) else sprite(step4element).loc= step4startloc --------------------- if sprite(step5element).intersects(correcttarget) then add glist, 5 if sprite(step5element).intersects(correcttarget) then puppetsound specialcorrectsound if sprite(step5element).intersects(correcttarget) then sprite(step5element).loc=step5correctloc if sprite(step5element).intersects(correcttarget) then sprite(description5).blend=0 if sprite(step5element).intersects(correcttarget) then sprite(coverup5).member=member(correcttargetsmember) else sprite(step5element).loc= step5startloc end if end if end if end if end if end ------------------------------------------------- --Property box modifiers on getPropertyDescriptionList me set theProps to [:] set a to "Choose the sprite # of the main target for this exercise:" set b to #integer set c to [#min: 1, #max: 40] set d to 9 addProp theProps, #correcttarget, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the member name of the main target for this exercise:" set b to #graphic set d to "caliper" addProp theProps, #correcttargetsmember, [#comment: a, #format: b, #default: d] --------------------------------------------------------------step1 set a to "Choose the sprite # of the 1st step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 10 addProp theProps, #step1element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 1s element:" set b to #point set d to point(174, 197) addProp theProps, #step1startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step1 element:" set b to #point set c to point(281, 156) addProp theProps, #step1correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 1st object: " set b to #integer set c to [#min: 1, #max: 40] set d to 11 addProp theProps, #coverup1 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 1 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 3 addProp theProps, #description1 , [#comment: a, #format: b, #range: c, #default: d] ------------------------------------------------------------step2 set a to "Choose the sprite # of the 2nd step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 12 addProp theProps, #step2element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 2's element:" set b to #point set d to point(37, 252) addProp theProps, #step2startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step2 element:" set b to #point set c to point(286, 156) addProp theProps, #step2correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 2nd object: " set b to #integer set c to [#min: 1, #max: 40] set d to 13 addProp theProps, #coverup2 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 1 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 2 addProp theProps, #description2 , [#comment: a, #format: b, #range: c, #default: d] ------------------------------------------------------------step3 set a to "Choose the sprite # of the step3 element:" set b to #integer set c to [#min: 1, #max: 40] set d to 14 addProp theProps, #step3element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 3's element:" set b to #point set d to point(166,114) addProp theProps, #step3startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step3 element:" set b to #point set c to point(281,160) addProp theProps, #step3correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 3rd object: " set b to #integer set c to [#min: 1, #max: 40] set d to 15 addProp theProps, #coverup3 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 3 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 1 addProp theProps, #description3 , [#comment: a, #format: b, #range: c, #default: d] -----------------------------------------------step4 set a to "Choose the sprite # of the 4th step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 16 addProp theProps, #step4element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 4's element:" set b to #point set d to point(104, 189) addProp theProps, #step4startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step4 element:" set b to #point set c to point(293, 157) addProp theProps, #step4correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 4th object: " set b to #integer set c to [#min: 1, #max: 40] set d to 17 addProp theProps, #coverup4 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 4 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 4 addProp theProps, #description4 , [#comment: a, #format: b, #range: c, #default: d] -------------------------------------------------------step5 set a to "Choose the sprite # of the 5th step element:" set b to #integer set c to [#min: 1, #max: 40] set d to 18 addProp theProps, #step5element, [#comment: a, #format: b, #range: c, #default: d] set a to "Choose the start location of step 5's element:" set b to #point set d to point(42, 131) addProp theProps, #step5startloc, [#comment: a, #format: b, #default: d] set a to "Choose the assembled correct finish location of the step5 element:" set b to #point set c to point(268, 156) addProp theProps, #step5correctloc, [#comment: a, #format: b, #default: c] set a to "What is the sprite # of placeholder sprite that will place the target over correct 5th object: " set b to #integer set c to [#min: 1, #max: 40] set d to 19 addProp theProps, #coverup5 , [#comment: a, #format: b, #range: c, #default: d] set a to "What is the sprite # of the text description of step 5 sprite:" set b to #integer set c to [#min: 1, #max: 40] set d to 5 addProp theProps, #description5 , [#comment: a, #format: b, #range: c, #default: d] ------------ set c to "Name of the special correct sound for snap to target?" set f to #sound set d to "specialcorrectsound" addProp theProps, #specialcorrectsound, [#comment: c, #format: f, #default: d] return theProps end ------------------------------------------- --touchsense handlers on startdrageffect --starts forcefeedback effect of dragging if user has touchsense mouse. You'll need the immersion touchsense scripts in your project as well- global gImmWebInstalled global gResRef if (gImmWebInstalled) then startEffect(sprite 15, "dragging", gResRef) end if end on stopdrageffect --stops the forcefeedback effect when not dragging- global gImmWebInstalled global gResRef if (gImmWebInstalled) then stopEffect(sprite 15, "dragging", gResRef) end if end Snap To Correct Target Quiz[#correcttarget: [#comment: "Choose the sprite # of the main target for this exercise:", #format: #integer, #range: [#min: 1, #max: 40], #default: 9], #correcttargetsmember: [#comment: "Choose the member name of the main target for this exercise:", #format: #graphic, #default: "caliper"], #step1element: [#comment: "Choose the sprite # of the 1st step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 10], #step1startloc: [#comment: "Choose the start location of step 1s element:", #format: #point, #default: point(174, 197)], #step1correctloc: [#comment: "Choose the assembled correct finish location of the step1 element:", #format: #point, #default: point(281, 156)], #coverup1: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 1st object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 11], #description1: [#comment: "What is the sprite # of the text description of step 1 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 3], #step2element: [#comment: "Choose the sprite # of the 2nd step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 12], #step2startloc: [#comment: "Choose the start location of step 2's element:", #format: #point, #default: point(37, 252)], #step2correctloc: [#comment: "Choose the assembled correct finish location of the step2 element:", #format: #point, #default: point(286, 156)], #coverup2: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 2nd object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 13], #description2: [#comment: "What is the sprite # of the text description of step 1 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 2], #step3element: [#comment: "Choose the sprite # of the step3 element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 14], #step3startloc: [#comment: "Choose the start location of step 3's element:", #format: #point, #default: point(166, 114)], #step3correctloc: [#comment: "Choose the assembled correct finish location of the step3 element:", #format: #point, #default: point(281, 160)], #coverup3: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 3rd object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 15], #description3: [#comment: "What is the sprite # of the text description of step 3 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 1], #step4element: [#comment: "Choose the sprite # of the 4th step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 16], #step4startloc: [#comment: "Choose the start location of step 4's element:", #format: #point, #default: point(104, 189)], #step4correctloc: [#comment: "Choose the assembled correct finish location of the step4 element:", #format: #point, #default: point(293, 157)], #coverup4: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 4th object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 17], #description4: [#comment: "What is the sprite # of the text description of step 4 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 4], #step5element: [#comment: "Choose the sprite # of the 5th step element:", #format: #integer, #range: [#min: 1, #max: 40], #default: 18], #step5startloc: [#comment: "Choose the start location of step 5's element:", #format: #point, #default: point(42, 131)], #step5correctloc: [#comment: "Choose the assembled correct finish location of the step5 element:", #format: #point, #default: point(268, 156)], #coverup5: [#comment: "What is the sprite # of placeholder sprite that will place the target over correct 5th object: ", #format: #integer, #range: [#min: 1, #max: 40], #default: 19], #description5: [#comment: "What is the sprite # of the text description of step 5 sprite:", #format: #integer, #range: [#min: 1, #max: 40], #default: 5], #specialcorrectsound: [#comment: "Name of the special correct sound for snap to target?", #format: #sound, #default: "specialcorrectsound"]]s88,>?%. .tSAC. .))))..'.'.'.'.'.'.;.;.;.;.;.;.?.C.G--- This behavior is a modified version of my DragNDropChallenge behavior except the "auto jump when correct" has been commented out and replaced with the ability to select what would be "wrong targets" and their "snap to" positions as well. --Selection of wrong targets has been added to elimnate the possibility of the user choosing correct answers via process of elimination. --In addition, "auto snap back to starting position" has been elimated as well as the addition of making the sprites movable when incorrect due to the user needing to move them again on a second try. --As such, this behavior makes this activity more like a quiz where the user really needs to understand the material and not have it be just a guessing game. Likewise, you would use this behavior if you were wanting to score the exercise. --This behavior allows for the matching of 3 scored pairs, 2 of which are incorrect. All pairs are not judged until the user checks answer via a button with my "DragNDrop Check Answers" behavior. See my site for this behavior. --As mentioned this behavior will ask you to identify the 2 wrong answers by sprite # and rect coordinates. If you require more than 2 wrong answers (3 matching pairs total), then you can simply add them in the mouseup event, properties and properties description list. See Code --IMPORTANT! For this behavior, make sure that the targets are larger than the drag items(bounding box size that is). The difference between the bounding box size of each graphic will be the snap to pixel difference. ----------------------------------------------------------------------------------- --With that, here is the original behaviors description: --This behavior Solves the map problem, the jigsaw problem, the "let"s dress a character" problem, and others. When dragged atop a sprite you can later move the sprite and it will remember its "solved" position. When the end user moves all sprites back in their solved positions play will proceed to the next label, or any other desired label. -- Also can be used for "Assemble In Correct Order" activitites. --In this version you must set your sprites to movable. The behavior will NOT do that for you like the DragNDrop Challance behavior does --The routine handles asynchronous dragging by adding the behavior itself to the actorList, and removing the behavior from the actorList when the mouse is released or when the piece snaps into place. This lets you run other animations in the background and use the computer normally, in a way that tight repeat loops do not. --The "CheckForCompletion" routine is interesting, because it checks for all other sprites which share that behavior, and asks them whether they"re already in correct position. It does this by passing a list in the sendAllSprites broadcast, which avoids having to get values returned from the sprite broadcast call. (Unlike numeric or string variables, all variables which point to a list point to the same object.) --Why the long "DraggedPuzzlePiecesBehavior_CompletionQuery" name? Because this message is broadcast to all sprites. Specifying the castLib and behavior avoids possible crosstalk with other behaviors written by other people. You could broadcast a simple "CompletionQuery" message to all sprites in your own work, but a non-scripting designer may be puzzled if they use another behavior that has a handler of similar name. Unique names reduce crosstalk. --You can customize this in many ways... the simplest is in the "CheckForCompletion" method, where click sounds or help strings can be added. -------------------------------- --properties property spriteNum, dragOffset, pOriginalLoc, specialcorrectsound, invisible, wrongtarget1, wrongtarget1sLoc, correcttarget, correcttargetsLoc, wrongtarget2, wrongtarget2sLoc ----------------------------------------- --Handlers on mouseDown me set dragOffset to the loc of sprite spriteNum - the clickLoc add the actorList, me pOriginalLoc = sprite(SpriteNum).loc -- record the original position cursor 290--closed grapping hand startdrageffect end on mouseUp me deleteOne the actorList, me cursor 260 -- normal reach hand if sprite(spritenum).within(correcttarget) then sprite(spritenum).loc=correcttargetsLoc --if at the location make it stick if sprite(spritenum).loc=correcttargetsLoc then puppetSound specialcorrectsound -- custom correct sound for sprite. -- else sprite(SpriteNum).loc =pOriginalLoc --snap back to original location if sprite(spritenum).loc=correcttargetsLoc then sprite(spritenum).Moveablesprite=false ------For the 1st wrong pair------ if sprite(spritenum).within(wrongtarget1) then sprite(spritenum).loc=wrongtarget1sLoc --if at the location make it stick if sprite(spritenum).loc=wrongtarget1sLoc then puppetSound specialcorrectsound if sprite(spritenum).loc=wrongtarget1sLoc then sprite(spritenum).Moveablesprite=false ------For the 2nd wrong pair------ if sprite(spritenum).within(wrongtarget2) then sprite(spritenum).loc=wrongtarget2sLoc --if at the location make it stick if sprite(spritenum).loc=wrongtarget2sLoc then puppetSound specialcorrectsound if sprite(spritenum).loc=wrongtarget2sLoc then sprite(spritenum).Moveablesprite=false stopdrageffect end if end if end if end if end if end if end if end if end if end on startdrageffect --starts forcefeedback effect of dragging if user has touchsense mouse. You'll need the immersion touchsense scripts in your project as well- global gImmWebInstalled global gResRef if (gImmWebInstalled) then startEffect(sprite 15, "dragging", gResRef) end if end on clearmessage -- clears the message textfield if you have one- put " " into member "textfield" end on stopdrageffect --stops the forcefeedback effect when not dragging- global gImmWebInstalled global gResRef if (gImmWebInstalled) then stopEffect(sprite 15, "dragging", gResRef) end if end --on stepFrame me --set newLoc to point(the mouseH, the mouseV) + dragOffset --set the loc of sprite spriteNum to newLoc --set delta to newLoc - correctLoc --if (abs(the locH of delta) < snapDistance) then --if (abs(the locV of delta) < snapDistance) then CheckForCompletion(me) --end if --end on spriteleave sprite(spritenum).rect = rect(334, 166, 375, 202) puppetSound specialcorrectsound end -- Uncomment the event below if you are wanting the " Drag N Drop Quiz" function. Judgment of what is correct will now be based on a submitt/check answers button instead.-- --on CheckForCompletion me --set the loc of sprite spriteNum to correctLoc -- uncomment the two lines below if you want a custom message and common sound when sprite correct-- --puppetSound "yoursound" --puts a common sound when correct --put "That's the correct place for " & the name of member (the member of sprite spriteNum) into field "textfield" -- --set success to [TRUE] --sendAllSprites #DraggedPuzzlePiecesBehavior_CompletionQuery, success -- if min(success) = TRUE then go nextSequence --deleteOne the actorList, me --if invisible=true then spriteleave --end if --end if --end --on CheckForCompletionAllInvisible me -- set the loc of sprite spritenum to rect(334, 166, 375, 202) -- set success to [TRUE] -- sendAllSprites #AllDraggedPiecesInvisible_CompletionQuery, success -- if min(success) = TRUE then go nextSequence -- deleteOne the actorList, me -- if invisible=true then spriteleave --end if --end if --end --on DraggedPuzzlePiecesBehavior_CompletionQuery me, success --add success, (the loc of sprite spriteNum = correctLoc) --end -- --on AllDraggedPiecesInvisible_CompletionQuery me, success --add success, (the rect of sprite spriteNum = rect(334, 166, 375, 202)) --end --Property box modifiers ------------------------------ on getPropertyDescriptionList me set theProps to [:] set c to "Choose the correct target sprite's, sprite number:" set f to #integer set g to [#min: 1, #max: 20] set d to 4 addProp theProps, #correcttarget, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the correct target (from above) coordinates - enter as ''point(#, #)''" set f to #point set d to point(46, 175) addProp theProps, #correcttargetsLoc, [#comment: c, #format: f, #default: d] --------------------------------------------- set c to "Choose the 1st sprite # that is to be incorrect" set f to #integer set g to [#min: 1, #max: 20] set d to 3 addProp theProps, #wrongtarget1, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''" set f to #point set d to point(54, 62) addProp theProps, #wrongtarget1sLoc, [#comment: c, #format: f, #default: d] ----------------------------------------------------- set c to "Choose the 2nd sprite # that is to be incorrect" set f to #integer set g to [#min: 1, #max: 20] set d to 4 addProp theProps, #wrongtarget2, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''" set f to #point set d to point(40, 117) addProp theProps, #wrongtarget2sLoc, [#comment: c, #format: f, #default: d] set c to "Name of the special snap sound for this sprite?" set f to #string set d to "specialcorrectsound" addProp theProps, #specialcorrectsound, [#comment: c, #format: f, #default: d] set c to "Make invisible after correct match" set f to #boolean set d to "false" addProp theProps, #invisible, [#comment: c, #format: f, #default: d] return theProps end on getBehaviorDescription me set line1 to "This behavior is for puzzle pieces that you wish to drag around and snap into place. When all the pieces are assembled then play proceeds to the next sequence, or to any labeled frame you wish." & RETURN set line2 to "" & RETURN set line3 to "To use:" & RETURN set line4 to "1) Assemble the puzzle on the screen in its solved arrangement." & RETURN set line5 to "2) Drag this behavior onto each piece, one at a time. You can just click ok on the Parameter Dialog, or you can tweak the label to go to or the snapping distance. (You do not need to adjust the target location field.)" & RETURN set line6 to "3) Once each piece has this behavior, then mix up the pieces as you wish. The behavior will remember where they should go." & RETURN set line7 to "" & RETURN set line8 to "The behavior script itself has additional info on script construction, if you wish to customize this behavior further." & RETURN set line9 to "" & RETURN set line10 to "" & RETURN return line1 & line2 & line3 & line4 & line5 & line6 & line7 & line8 & line9 & line10 end Drag&Drop Quiz[#correcttarget: [#comment: "Choose the correct target sprite's, sprite number:", #format: #integer, #range: [#min: 1, #max: 20], #default: 4], #correcttargetsLoc: [#comment: "Choose the correct target (from above) coordinates - enter as ''point(#, #)''", #format: #point, #default: point(46, 175)], #wrongtarget1: [#comment: "Choose the 1st sprite # that is to be incorrect", #format: #integer, #range: [#min: 1, #max: 20], #default: 3], #wrongtarget1sLoc: [#comment: "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''", #format: #point, #default: point(54, 62)], #wrongtarget2: [#comment: "Choose the 2nd sprite # that is to be incorrect", #format: #integer, #range: [#min: 1, #max: 20], #default: 4], #wrongtarget2sLoc: [#comment: "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''", #format: #point, #default: point(40, 117)], #specialcorrectsound: [#comment: "Name of the special snap sound for this sprite?", #format: #string, #default: "specialcorrectsound"], #invisible: [#comment: "Make invisible after correct match", #format: #boolean, #default: "false"]]s%D%Y,>?{. .tSAC   ? T T T e y y y y y y -- Attach to a reset button in a Scored matching game to reset the number of tries and force the objects back to their starting points (as mentioned below) --Also jumps to the "next" marker (a frame where all items are in their starting positions) for the purpose of reseting the game when all are correct. Without this, all drag objects would stay in their current positions on reset even if correct. property drag1, drag2, drag3 property drag1start, drag2start, drag3start on mouseup go to next global glist set glist.tries=0 --these next lines below, will force the objects back to their starting point on reset. Normally, a correct answer on the first try to one of the items would hold the sprite on that target during a reset. These lines make sure everything goes back to their starting positions. --Note: the following lines are hard coded because I am being lazy and because I am only using this specific reset button in this quick example. if member("answerresults").text="Correct!" then sprite(drag1).loc= drag1start if member("answerresults").text="Correct!" then sprite(drag2).loc= drag2start if member("answerresults").text="Correct!" then sprite(drag3).loc= drag3start end if end if end -------------------------------- on getPropertyDescriptionList me set theProps to [:] -------------------------------------drag item1 set c to "Choose the 1st drag sprite's # " set f to #integer set g to [#min: 1, #max: 20] set d to 5 addProp theProps, #drag1, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 1st drag sprite's starting location - enter as ''point(#, #)''" set f to #point set d to point(158, 133) addProp theProps, #drag1start, [#comment: c, #format: f, #default: d] -------------------------------------drag item2 set c to "Choose the 2nd drag sprite's # " set f to #integer set g to [#min: 1, #max: 20] set d to 6 addProp theProps, #drag2, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 2nd drag sprite's starting location - enter as ''point(#, #)''" set f to #point set d to point(170, 65) addProp theProps, #drag2start, [#comment: c, #format: f, #default: d] -------------------------------------drag item3 set c to "Choose the 3rd drag sprite's # " set f to #integer set g to [#min: 1, #max: 20] set d to 7 addProp theProps, #drag3, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 3rd drag sprite's starting location - enter as ''point(#, #)''" set f to #point set d to point(220, 86) addProp theProps, #drag3start, [#comment: c, #format: f, #default: d] return theProps end Reset Drag&Drop Game[#drag1: [#comment: "Choose the 1st drag sprite's # ", #format: #integer, #range: [#min: 1, #max: 20], #default: 5], #drag1start: [#comment: "Choose the 1st drag sprite's starting location - enter as ''point(#, #)''", #format: #point, #default: point(158, 133)], #drag2: [#comment: "Choose the 2nd drag sprite's # ", #format: #integer, #range: [#min: 1, #max: 20], #default: 6], #drag2start: [#comment: "Choose the 2nd drag sprite's starting location - enter as ''point(#, #)''", #format: #point, #default: point(170, 65)], #drag3: [#comment: "Choose the 3rd drag sprite's # ", #format: #integer, #range: [#min: 1, #max: 20], #default: 7], #drag3start: [#comment: "Choose the 3rd drag sprite's starting location - enter as ''point(#, #)''", #format: #point, #default: point(220, 86)]] c,?%i?. .rcsL|||\\"\\^\\ $ i /222*2BWCfBWACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO ACWACgACWACgDACWACgACWACg(A CWACgA CWACg E ACO       rcsL8 8 8\  4 \rrX`/mgheij+'*2$$$U(].<<< ]<>RRRaV^\|||us|j~: _h. %t JA!\CfaP`_bKBW9JCWaP"BWBV  _bKBWcBWJCWJCgd JCWJebJCWaJe J/BW0JCWaJe JCWbfJCWJgCgd JCWJhbJCWaJh J/BW0JCWaJh JCWbfJCWJiCgd JCWJjbJCWaJj J/BW0JCWaJj JCWbfBVIACWDIBWDDCW !Bgk IACWDIBWJCWNwCWbJ/BW0CRDREREAEACRARLEE!LE"LE#LE$LCBW DREURA.CWURLEeE!LE"LE$LCBW DREREAEACRARLEgE!LE"LE#LE$LCBW DREURA6A>CWURLEhE!LE"LE$LCBW DREREAEACRARLEiE!LE"LE#LE$LCBW DREURA(AuCWURLEjE!LE"LE$LCBW DRE5RD RLE/E!LE"LE$LCBW D RElRD RLEmE!LE"LE$LCBW LBW&-,+)*      D D RDD RDD RDD RDD RDD RDD RDD RDD RDD R LL L L L L L L L L BW&nopqrstuvw!"Z.b` dragging textfield3Choose the correct target sprite's, sprite number:NChoose the correct target (from above) coordinates - enter as ''point(#, #)''0Choose the 1st sprite # that is to be incorrectIChoose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''0Choose the 2nd sprite # that is to be incorrect0Name of the special snap sound for this sprite?specialcorrectsound#Make invisible after correct matchfalseThis behavior is for puzzle pieces that you wish to drag around and snap into place. When all the pieces are assembled then play proceeds to the next sequence, or to any labeled frame you wish. To use:@1) Assemble the puzzle on the screen in its solved arrangement.2) Drag this behavior onto each piece, one at a time. You can just click ok on the Parameter Dialog, or you can tweak the label to go to or the snapping distance. (You do not need to adjust the target location field.){3) Once each piece has this behavior, then mix up the pieces as you wish. The behavior will remember where they should go.wThe behavior script itself has additional info on script construction, if you wish to customize this behavior further.rcsL\\jjbt/Pfhhh.l* 2c@BR #>R JCWaP"BWBV BWJCWJCg JBW JCWJbBV IACWDIBWIACWDIBWCRDREREAEACRA RLEE!LE"LE#LE$LCBW DRE%RDRLEE!LE"LE$LCBW LBW&-'.,*(+) Fj dragging3Choose the target for this correct sprite's match: Marker to jump to when correct?step1rcsL\!1x!NL\``t8/2 : AJ/CW BW0J2BW1 CRLE/E!DE"E3E$DCBg4LE2E!DE"E5E$DCBg4LBW&6&>h"choose your special correct soundspecialcorrectsound%type in your special correct messageCorrectrcsL222\.!\ P />8?:;=@DABCEIFGHJNKLMOSPQR 7 @.  4~ 9,<  p   /A2   0\: BW"BWBVBWBVJ8CWJCg I ABW9J8CWJCg J/BW0J8CWJCg J8CWJ:bJ8CWJCg J;CWbCW b J8CWJ?bJ@CWJCg I ABW9J@CWJCg J/BW0J@CWJCg J@CWJAbJ@CWJCg JBCWbCW b J@CWJDbJECWJCg I ABW9JECWJCg J/BW0JECWJCg JECWJFbJECWJCg JGCWbCW b JECWJIbJJCWJCg I ABW9JJCWJCg J/BW0JJCWJCg JJCWJKbJJCWJCg JLCWbCW b JJCWJNbJOCWJCg I ABW9JOCWJCg J/BW0JOCWJCg JOCWJPbJOCWJCg JQCWbCW b JOCWJSb     CRDREREAEA(CRA RLEE!LE"LE#LE$LCBW DRETRDRLE>E!LE"LE$LCBW DREREAEA(CRA RLE8E!LE"LE#LE$LCBW DREURCWURLE?E!LE"LE$LCBW DREURCWURLE:E!LE"LE$LCBW DREREAEA(CRA RLE=E!LE"LE#LE$LCBW DREREAEA(CRARLE;E!LE"LE#LE$LCBW DREREAEA(CRA RLE@E!LE"LE#LE$LCBW D REURA%CWURLEDE!LE"LE$LCBW D REURCWURLEAE!LE"LE$LCBW D REREAEA(CRA RLECE!LE"LE#LE$LCBW DREREAEA(CRARLEBE!LE"LE#LE$LCBW D REREAEA(CRARLEEE!LE"LE#LE$LCBW D REURArCWURLEIE!LE"LE$LCBW DREURCWURLEFE!LE"LE$LCBW DREREAEA(CRARLEHE!LE"LE#LE$LCBW DREREAEA(CRARLEGE!LE"LE#LE$LCBW DREREAEA(CRARLEJE!LE"LE#LE$LCBW DREURAhCWURLENE!LE"LE$LCBW DREUR%CWURLEKE!LE"LE$LCBW DREREAEA(CRARLEME!LE"LE#LE$LCBW DREREAEA(CRARLELE!LE"LE#LE$LCBW DREREAEA(CRARLEOE!LE"LE#LE$LCBW DREURA*CWURLESE!LE"LE$LCBW DREUR CWURLEPE!LE"LE$LCBW DREREAEA(CRARLERE!LE"LE#LE$LCBW DREREAEA(CRARLEQE!LE"LE#LE$LCBW DRE3RDRLE/E!LE"LE$LCBW LBW&-'.,*+                          IACWDIBWIACWDIBW>8F TDvVH*B:Choose the sprite # of the main target for this exercise:=Choose the member name of the main target for this exercise:caliper-Choose the sprite # of the 1st step element:.Choose the start location of step 1s element:CChoose the assembled correct finish location of the step1 element:`What is the sprite # of placeholder sprite that will place the target over correct 1st object: ?What is the sprite # of the text description of step 1 sprite:-Choose the sprite # of the 2nd step element:/Choose the start location of step 2's element:CChoose the assembled correct finish location of the step2 element:`What is the sprite # of placeholder sprite that will place the target over correct 2nd object: *Choose the sprite # of the step3 element:/Choose the start location of step 3's element:CChoose the assembled correct finish location of the step3 element:`What is the sprite # of placeholder sprite that will place the target over correct 3rd object: ?What is the sprite # of the text description of step 3 sprite:-Choose the sprite # of the 4th step element:/Choose the start location of step 4's element:CChoose the assembled correct finish location of the step4 element:`What is the sprite # of placeholder sprite that will place the target over correct 4th object: ?What is the sprite # of the text description of step 4 sprite:-Choose the sprite # of the 5th step element:/Choose the start location of step 5's element:CChoose the assembled correct finish location of the step5 element:`What is the sprite # of placeholder sprite that will place the target over correct 5th object: ?What is the sprite # of the text description of step 5 sprite:6Name of the special correct sound for snap to target?specialcorrectsound draggingrcsL222\\`b YV7#A  KaRLA%\CW aZPYIVCW[COV\ DIVaW JYY Tries =rcsL\\\\ CO EWCOVDCW Db  V answerresultsrcsL\  \\\" e EWCO DCW Db DCW Db    triesanswerresultsrcsL888\  4\hh~vy{}z|~T '$LNX &X ExBWI bWDCW a D JyCWJzbDCW a D J{CWJ|bDCW a D J}CWJ~b CRDREREAEACRARLEyE!LE"LE#LE$LCBW DREURCWURLEzE!LE"LE$LCBW DREREAEACRARLE{E!LE"LE#LE$LCBW DREURAACWURLE|E!LE"LE$LCBW DREREAEACRARLE}E!LE"LE#LE$LCBW DREURAVCWURLE~E!LE"LE$LCBW LBW&-,+)*       D(answerresults Correct! Choose the 1st drag sprite's # JChoose the 1st drag sprite's starting location - enter as ''point(#, #)'' Choose the 2nd drag sprite's # JChoose the 2nd drag sprite's starting location - enter as ''point(#, #)'' Choose the 3rd drag sprite's # JChoose the 3rd drag sprite's starting location - enter as ''point(#, #)''rcsL\  \\\>JV2246I aWRACWaACWaACWaACWaACWaACWaDCW Db DCW Db DCW a D ACWAbfDCW a D ACWAbfDCW a D ACWAbfI LAbWX E   answerresults Correct!&One or more are incorrect - try againmanL prepareFrame exitFramemouseUpcursormeframegosprite intersectsgListallmatchesmade prepareMoviemembertext mouseDown pOriginalLoc spriteNumlocrectbeepstartdrageffectstopdrageffectgetPropertyDescriptionList correcttarget nextSequencegImmWebInstalled startEffectgResRef stopEffectintegerminmaxaddPropcommentformatrangedefaultmarkerreturnaegdfcthePropsbspecialcorrectsound puppetSoundalertspecialcorrectmessagesoundsetAtstringPDL beginSprite step1elementaddstep1correctloc description1blendcoverup1correcttargetsmember step1startloc step2elementstep2correctloc description2coverup2 step2startloc step3elementstep3correctloc description3coverup3 step3startloc step4elementstep4correctloc description4coverup4 step4startloc step5elementstep5correctloc description5coverup5 step5startlocgraphicpointglistTtriesCurrentpMyFieldnamevoidpmySprite clearmessage spriteleavegetBehaviorDescription dragOffsetclickLoc actorList deleteOnewithincorrecttargetsLocmoveableSprite wrongtarget1wrongtarget1sLoc wrongtarget2wrongtarget2sLoc setContentsboolean invisibleline1line2line3line4line5line6line7line8line9line10nextdrag1 drag1startdrag2 drag2startdrag3 drag3startmuhT 1\\\11\\\\\ \1\111\V \   V\ ##1####V  ]]G#٥zk@d1\1\QKQQKQQV1[ZaZ+qvLpvpLVba+pRpRpRpV++V걄a +MvpRppR\Va +qvLvLvpVa0+V1\00001\%++110QLvpRpv}{V0``0 KvpRpLv\10g`QpRpLvLv 0 QqpvpvppR*aZ[`[`[ ,KQQK-QK,1muhT \b\\b\\b\b\b\b\b\b\b\\b\\b\\b\b\\b\\b\b\\b\b\\b\\\\b\\ b\\bb\\T\b\\VVVV+\\b\\b\\UV\b\b\\bb\\b\bUT\b\b\+\\b\\b\[҆\b\\\V\b\\b\~ҫb\b\\+]b\\b\2V\\b\b\\bV\\b\\b\\b\\b\}b\\b\\b\\b\\V/(/)\4,.b\b\\b\\\Y\3\.\b\b\b\\b\\bb)Y..\b\b\\b\\+խY|_\b\b\\b\\b\\Ճ\b\\b\##\b\\\YYS\\b\ \b\\b\bYY\b\ b\\b\\b\Yb\\b\ \b\\b\\\b\)/\b\\b\b\b\\b\\b\RvRvRv\b\\bb\\b\b\\b\vLvLpR8+\\\b\\b\b\\b\\RvLpvQ\\b\\b\b\\b\ vKvRuLb\b\\b\\b\\b\\b\b\b\b\\\b\b\\b\b\\bb\\b\b\\\\\b\\b\b\\b\\\b\\b\b\b\b\\b\\ b\vLvRv\b\\b\\b\\b\\b\b\b\\bLvLvL\\bb\\b\ b\\b\b\vRpRpb\\\\b\\b\b\\b\\\b\b\RuRvQ\\b\b\b\\b\b\ b\\bb\\b\\b\\\b\\b\\b\\b\b\\b\b\\b\b\b\\bmuhT 11#1\\1### ##### ###11#dF#׫+O"#OVVQKQQKV\Vqwpqv1V󌊅 pvLvLW0` wLvLv[+` pqpwq8֊ \011 \\1\ |1 |7111 +|1111\+V\1\11\\\+ 1111 \111\111+11111muhTL 11#1\\1### ##### ###11#dF#׫+O"#OVVQKQQKV\Vqwpqv1V󌊅 pvLvLW0` wLvLv[+` pqpwq8֊ \011 \\1#+\ # ,qvLppv}1## vLp7## LvLv1## pvqLp\#### QLQKR1 #####pammdLXFIRpami R!pamm6 *YEKtSAC knujTr)FCRDTtSACv *.knujY!XtcLLVmuhTxtSACP'fniCl0SREV PmanLrrcsL|itSACImuhTtSAC[tSACh;knuj-tSACl$muhTarcsLDWrcsLpxknujmuhTyfQmuhTRmuhTTtSACAtSACBtSACFrcsLr{knujknujT06rcsL2F}rcsL~\XrcsL2rcsLmuhTmuhTbknujP*knujKrcsL8 0mknuj 8knujPrcsLrcsL8rcsLƗmuhT`tSACKmuhTDmuhTTmuhTLknuj,tSAC.,knujl"*SAC0knuj (,knuj :knujY;knujv `<knuj=knujAHn>knujD?knujB@knuj@Aknuj|BknujCknujDknuj2Eknuj~Fknuj2FGknujHknujZIknuj JtSAC. .))))..'.'.'.'.'.'.;.;.;.;.;.;.?.C.G--- This behavior is a modified version of my DragNDropChallenge behavior except the "auto jump when correct" has been commented out and replaced with the ability to select what would be "wrong targets" and their "snap to" positions as well. --Selection of wrong targets has been added to elimnate the possibility of the user choosing correct answers via process of elimination. --In addition, "auto snap back to starting position" has been elimated as well as the addition of making the sprites movable when incorrect due to the user needing to move them again on a second try. --As such, this behavior makes this activity more like a quiz where the user really needs to understand the material and not have it be just a guessing game. Likewise, you would use this behavior if you were wanting to score the exercise. --This behavior allows for the matching of 3 scored pairs, 2 of which are incorrect. All pairs are not judged until the user checks answer via a button with my "DragNDrop Check Answers" behavior. See my site for this behavior. --As mentioned this behavior will ask you to identify the 2 wrong answers by sprite # and rect coordinates. If you require more than 2 wrong answers (3 matching pairs total), then you can simply add them in the mouseup event, properties and properties description list. See Code --IMPORTANT! For this behavior, make sure that the targets are larger than the drag items(bounding box size that is). The difference between the bounding box size of each graphic will be the snap to pixel difference. ----------------------------------------------------------------------------------- --With that, here is the original behaviors description: --This behavior Solves the map problem, the jigsaw problem, the "let"s dress a character" problem, and others. When dragged atop a sprite you can later move the sprite and it will remember its "solved" position. When the end user moves all sprites back in their solved positions play will proceed to the next label, or any other desired label. -- Also can be used for "Assemble In Correct Order" activitites. --In this version you must set your sprites to movable. The behavior will NOT do that for you like the DragNDrop Challance behavior does --The routine handles asynchronous dragging by adding the behavior itself to the actorList, and removing the behavior from the actorList when the mouse is released or when the piece snaps into place. This lets you run other animations in the background and use the computer normally, in a way that tight repeat loops do not. --The "CheckForCompletion" routine is interesting, because it checks for all other sprites which share that behavior, and asks them whether they"re already in correct position. It does this by passing a list in the sendAllSprites broadcast, which avoids having to get values returned from the sprite broadcast call. (Unlike numeric or string variables, all variables which point to a list point to the same object.) --Why the long "DraggedPuzzlePiecesBehavior_CompletionQuery" name? Because this message is broadcast to all sprites. Specifying the castLib and behavior avoids possible crosstalk with other behaviors written by other people. You could broadcast a simple "CompletionQuery" message to all sprites in your own work, but a non-scripting designer may be puzzled if they use another behavior that has a handler of similar name. Unique names reduce crosstalk. --You can customize this in many ways... the simplest is in the "CheckForCompletion" method, where click sounds or help strings can be added. -------------------------------- --properties property spriteNum, dragOffset, pOriginalLoc, specialcorrectsound, invisible, wrongtarget1, wrongtarget1sLoc, correcttarget, correcttargetsLoc, wrongtarget2, wrongtarget2sLoc ----------------------------------------- --Handlers on mouseDown me set dragOffset to the loc of sprite spriteNum - the clickLoc add the actorList, me pOriginalLoc = sprite(SpriteNum).loc -- record the original position cursor 290--closed grapping hand startdrageffect end on mouseUp me deleteOne the actorList, me cursor 260 -- normal reach hand if sprite(spritenum).within(correcttarget) then sprite(spritenum).loc=correcttargetsLoc --if at the location make it stick if sprite(spritenum).loc=correcttargetsLoc then puppetSound specialcorrectsound -- custom correct sound for sprite. -- else sprite(SpriteNum).loc =pOriginalLoc --snap back to original location if sprite(spritenum).loc=correcttargetsLoc then sprite(spritenum).Moveablesprite=false ------For the 1st wrong pair------ if sprite(spritenum).within(wrongtarget1) then sprite(spritenum).loc=wrongtarget1sLoc --if at the location make it stick if sprite(spritenum).loc=wrongtarget1sLoc then puppetSound specialcorrectsound if sprite(spritenum).loc=wrongtarget1sLoc then sprite(spritenum).Moveablesprite=false ------For the 2nd wrong pair------ if sprite(spritenum).within(wrongtarget2) then sprite(spritenum).loc=wrongtarget2sLoc --if at the location make it stick if sprite(spritenum).loc=wrongtarget2sLoc then puppetSound specialcorrectsound if sprite(spritenum).loc=wrongtarget2sLoc then sprite(spritenum).Moveablesprite=false stopdrageffect end if end if end if end if end if end if end if end if end if end on startdrageffect --starts forcefeedback effect of dragging if user has touchsense mouse. You'll need the immersion touchsense scripts in your project as well- global gImmWebInstalled global gResRef if (gImmWebInstalled) then startEffect(sprite 15, "dragging", gResRef) end if end on clearmessage -- clears the message textfield if you have one- put " " into member "textfield" end on stopdrageffect --stops the forcefeedback effect when not dragging- global gImmWebInstalled global gResRef if (gImmWebInstalled) then stopEffect(sprite 15, "dragging", gResRef) end if end --on stepFrame me --set newLoc to point(the mouseH, the mouseV) + dragOffset --set the loc of sprite spriteNum to newLoc --set delta to newLoc - correctLoc --if (abs(the locH of delta) < snapDistance) then --if (abs(the locV of delta) < snapDistance) then CheckForCompletion(me) --end if --end on spriteleave sprite(spritenum).rect = rect(334, 166, 375, 202) puppetSound specialcorrectsound end -- Uncomment the event below if you are wanting the " Drag N Drop Quiz" function. Judgment of what is correct will now be based on a submitt/check answers button instead.-- --on CheckForCompletion me --set the loc of sprite spriteNum to correctLoc -- uncomment the two lines below if you want a custom message and common sound when sprite correct-- --puppetSound "yoursound" --puts a common sound when correct --put "That's the correct place for " & the name of member (the member of sprite spriteNum) into field "textfield" -- --set success to [TRUE] --sendAllSprites #DraggedPuzzlePiecesBehavior_CompletionQuery, success -- if min(success) = TRUE then go nextSequence --deleteOne the actorList, me --if invisible=true then spriteleave --end if --end if --end --on CheckForCompletionAllInvisible me -- set the loc of sprite spritenum to rect(334, 166, 375, 202) -- set success to [TRUE] -- sendAllSprites #AllDraggedPiecesInvisible_CompletionQuery, success -- if min(success) = TRUE then go nextSequence -- deleteOne the actorList, me -- if invisible=true then spriteleave --end if --end if --end --on DraggedPuzzlePiecesBehavior_CompletionQuery me, success --add success, (the loc of sprite spriteNum = correctLoc) --end -- --on AllDraggedPiecesInvisible_CompletionQuery me, success --add success, (the rect of sprite spriteNum = rect(334, 166, 375, 202)) --end --Property box modifiers ------------------------------ on getPropertyDescriptionList me set theProps to [:] set c to "Choose the correct target sprite's, sprite number:" set f to #integer set g to [#min: 1, #max: 20] set d to 4 addProp theProps, #correcttarget, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the correct target (from above) coordinates - enter as ''point(#, #)''" set f to #point set d to point(46, 175) addProp theProps, #correcttargetsLoc, [#comment: c, #format: f, #default: d] --------------------------------------------- set c to "Choose the 1st sprite # that is to be incorrect" set f to #integer set g to [#min: 1, #max: 20] set d to 3 addProp theProps, #wrongtarget1, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''" set f to #point set d to point(54, 62) addProp theProps, #wrongtarget1sLoc, [#comment: c, #format: f, #default: d] ----------------------------------------------------- set c to "Choose the 2nd sprite # that is to be incorrect" set f to #integer set g to [#min: 1, #max: 20] set d to 4 addProp theProps, #wrongtarget2, [#comment: c, #format: f, #range: g, #default: d] set c to "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''" set f to #point set d to point(40, 117) addProp theProps, #wrongtarget2sLoc, [#comment: c, #format: f, #default: d] set c to "Name of the special snap sound for this sprite?" set f to #string set d to "specialcorrectsound" addProp theProps, #specialcorrectsound, [#comment: c, #format: f, #default: d] set c to "Make invisible after correct match" set f to #boolean set d to "false" addProp theProps, #invisible, [#comment: c, #format: f, #default: d] return theProps end on getBehaviorDescription me set line1 to "This behavior is for puzzle pieces that you wish to drag around and snap into place. When all the pieces are assembled then play proceeds to the next sequence, or to any labeled frame you wish." & RETURN set line2 to "" & RETURN set line3 to "To use:" & RETURN set line4 to "1) Assemble the puzzle on the screen in its solved arrangement." & RETURN set line5 to "2) Drag this behavior onto each piece, one at a time. You can just click ok on the Parameter Dialog, or you can tweak the label to go to or the snapping distance. (You do not need to adjust the target location field.)" & RETURN set line6 to "3) Once each piece has this behavior, then mix up the pieces as you wish. The behavior will remember where they should go." & RETURN set line7 to "" & RETURN set line8 to "The behavior script itself has additional info on script construction, if you wish to customize this behavior further." & RETURN set line9 to "" & RETURN set line10 to "" & RETURN return line1 & line2 & line3 & line4 & line5 & line6 & line7 & line8 & line9 & line10 end Drag&Drop Quiz[#correcttarget: [#comment: "Choose the correct target sprite's, sprite number:", #format: #integer, #range: [#min: 1, #max: 20], #default: 4], #correcttargetsLoc: [#comment: "Choose the correct target (from above) coordinates - enter as ''point(#, #)''", #format: #point, #default: point(46, 175)], #wrongtarget1: [#comment: "Choose the 1st sprite # that is to be incorrect", #format: #integer, #range: [#min: 1, #max: 20], #default: 3], #wrongtarget1sLoc: [#comment: "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''", #format: #point, #default: point(54, 62)], #wrongtarget2: [#comment: "Choose the 2nd sprite # that is to be incorrect", #format: #integer, #range: [#min: 1, #max: 20], #default: 4], #wrongtarget2sLoc: [#comment: "Choose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''", #format: #point, #default: point(40, 117)], #specialcorrectsound: [#comment: "Name of the special snap sound for this sprite?", #format: #string, #default: "specialcorrectsound"], #invisible: [#comment: "Make invisible after correct match", #format: #boolean, #default: "false"]]s%D%Y,>?{. .rcsL8 8 8\  4 \rrX`/mgheij+'*2$$$U(].<<< ]<>RRRaV^\|||us|j~: _h. %t JA!\CfaP`_bKBW9JCWaP"BWBV  _bKBWcBWJCWJCgd JCWJebJCWaJe J/BW0JCWaJe JCWbfJCWJgCgd JCWJhbJCWaJh J/BW0JCWaJh JCWbfJCWJiCgd JCWJjbJCWaJj J/BW0JCWaJj JCWbfBVIACWDIBWDDCW !Bgk IACWDIBWJCWNwCWbJ/BW0CRDREREAEACRARLEE!LE"LE#LE$LCBW DREURA.CWURLEeE!LE"LE$LCBW DREREAEACRARLEgE!LE"LE#LE$LCBW DREURA6A>CWURLEhE!LE"LE$LCBW DREREAEACRARLEiE!LE"LE#LE$LCBW DREURA(AuCWURLEjE!LE"LE$LCBW DRE5RD RLE/E!LE"LE$LCBW D RElRD RLEmE!LE"LE$LCBW LBW&-,+)*      D D RDD RDD RDD RDD RDD RDD RDD RDD RDD R LL L L L L L L L L BW&nopqrstuvw!"Z.b` dragging textfield3Choose the correct target sprite's, sprite number:NChoose the correct target (from above) coordinates - enter as ''point(#, #)''0Choose the 1st sprite # that is to be incorrectIChoose the 1st incorrect sprite's coordinates - enter as ''point(#, #)''0Choose the 2nd sprite # that is to be incorrect0Name of the special snap sound for this sprite?specialcorrectsound#Make invisible after correct matchfalseThis behavior is for puzzle pieces that you wish to drag around and snap into place. When all the pieces are assembled then play proceeds to the next sequence, or to any labeled frame you wish. To use:@1) Assemble the puzzle on the screen in its solved arrangement.2) Drag this behavior onto each piece, one at a time. You can just click ok on the Parameter Dialog, or you can tweak the label to go to or the snapping distance. (You do not need to adjust the target location field.){3) Once each piece has this behavior, then mix up the pieces as you wish. The behavior will remember where they should go.wThe behavior script itself has additional info on script construction, if you wish to customize this behavior further.yrcsL222\.!\ P />8?:;=@DABCEIFGHJNKLMOSPQR 7 @.  4~ 9,<  p   /A2   0\: BW"BWBVBWBVJ8CWJCg I ABW9J8CWJCg J/BW0J8CWJCg J8CWJ:bJ8CWJCg J;CWbCW b J8CWJ?bJ@CWJCg I ABW9J@CWJCg J/BW0J@CWJCg J@CWJAbJ@CWJCg JBCWbCW b J@CWJDbJECWJCg I ABW9JECWJCg J/BW0JECWJCg JECWJFbJECWJCg JGCWbCW b JECWJIbJJCWJCg I ABW9JJCWJCg J/BW0JJCWJCg JJCWJKbJJCWJCg JLCWbCW b JJCWJNbJOCWJCg I ABW9JOCWJCg J/BW0JOCWJCg JOCWJPbJOCWJCg JQCWbCW b JOCWJSb     CRDREREAEA(CRA RLEE!LE"LE#LE$LCBW DRETRDRLE>E!LE"LE$LCBW DREREAEA(CRA RLE8E!LE"LE#LE$LCBW DREURCWURLE?E!LE"LE$LCBW DREURCWURLE:E!LE"LE$LCBW DREREAEA(CRA RLE=E!LE"LE#LE$LCBW DREREAEA(CRARLE;E!LE"LE#LE$LCBW DREREAEA(CRA RLE@E!LE"LE#LE$LCBW D REURA%CWURLEDE!LE"LE$LCBW D REURCWURLEAE!LE"LE$LCBW D REREAEA(CRA RLECE!LE"LE#LE$LCBW DREREAEA(CRARLEBE!LE"LE#LE$LCBW D REREAEA(CRARLEEE!LE"LE#LE$LCBW D REURArCWURLEIE!LE"LE$LCBW DREURCWURLEFE!LE"LE$LCBW DREREAEA(CRARLEHE!LE"LE#LE$LCBW DREREAEA(CRARLEGE!LE"LE#LE$LCBW DREREAEA(CRARLEJE!LE"LE#LE$LCBW DREURAhCWURLENE!LE"LE$LCBW DREUR%CWURLEKE!LE"LE$LCBW DREREAEA(CRARLEME!LE"LE#LE$LCBW DREREAEA(CRARLELE!LE"LE#LE$LCBW DREREAEA(CRARLEOE!LE"LE#LE$LCBW DREURA*CWURLESE!LE"LE$LCBW DREUR CWURLEPE!LE"LE$LCBW DREREAEA(CRARLERE!LE"LE#LE$LCBW DREREAEA(CRARLEQE!LE"LE#LE$LCBW DRE3RDRLE/E!LE"LE$LCBW LBW&-'.,*+                          IACWDIBWIACWDIBW>8F TDvVH*B:Choose the sprite # of the main target for this exercise:=Choose the member name of the main target for this exercise:caliper-Choose the sprite # of the 1st step element:.Choose the start location of step 1s element:CChoose the assembled correct finish location of the step1 element:`What is the sprite # of placeholder sprite that will place the target over correct 1st object: ?What is the sprite # of the text description of step 1 sprite:-Choose the sprite # of the 2nd step element:/Choose the start location of step 2's element:CChoose the assembled correct finish location of the step2 element:`What is the sprite # of placeholder sprite that will place the target over correct 2nd object: *Choose the sprite # of the step3 element:/Choose the start location of step 3's element:CChoose the assembled correct finish location of the step3 element:`What is the sprite # of placeholder sprite that will place the target over correct 3rd object: ?What is the sprite # of the text description of step 3 sprite:-Choose the sprite # of the 4th step element:/Choose the start location of step 4's element:CChoose the assembled correct finish location of the step4 element:`What is the sprite # of placeholder sprite that will place the target over correct 4th object: ?What is the sprite # of the text description of step 4 sprite:-Choose the sprite # of the 5th step element:/Choose the start location of step 5's element:CChoose the assembled correct finish location of the step5 element:`What is the sprite # of pl