|
From: Mitch Wallace on 22 Apr 2008 15:56 I just got Dir11 and was testing the PuzzleDrop Behavior I found. (http://director-online.com/buildArticle.php?id=222) But when I set it up and ran the program it didn?t work. So I tried increasing the Acceptable Variance to cover the whole screen and then it found the object and snapped it into place as soon as the program started. (It executed the initial test call on line 30.) So I reduced the Acceptable Variance to a large area that didn?t encompass my object before I had the chance to move it with the mouse. Then I moved the object into the covered area ? it still didn?t work. Finally I figured out that the "on mouseUP me" line (33) isn?t working. If I move an object into the area and drop it the behavior doesn?t work. But if I move an object into the area and double click on it the behavior finds it and snaps it into place. How can I fix this? I?m very new to Director and I?m not sure if this is a Dir11 bug or something that simply needs recoded for Dir11. (By-the-way I?m using a PC running XP.) --PuzzleDrop Behavior --copyright � 1998 ZZP Online, LLC --This behavior allows a sprite to be moved around -- the stage. On mouseUp, the sprite will compare -- its loc to a targetLoc. If it is within the -- acceptable target range, then the sprite locks -- into place. property pTargetH property pTargetV property pVariance property pTargetLoc -- point(pTargetH, pTargetV) property pMySprite property pStatus -- #inPlace or #notInPlace on getPropertyDescriptionList me set pdlist to [:] addprop pdlist, #pTargetH, [#comment:"Target locH", #format:#integer, #default:0] addprop pdlist, #pTargetV, [#comment:"Target locV", #format:#integer, #default:0] addprop pdlist, #pVariance, [#comment:"Acceptable Variance", #format:#integer, #default:0] return pdlist end getPropertyDescriptionList on beginSprite me set pMySprite = the spriteNum of me set the moveableSprite of sprite pMySprite to TRUE set pTargetLoc = point(pTargetH, pTargetV) set pStatus = #notInPlace testLoc me end on mouseUp me testLoc me end on testLoc me set testH = the locH of sprite pMySprite set testV = the locV of sprite pMySprite if abs(pTargetH - testH) < pVariance then if abs(pTargetV - testV) < pVariance then set the loc of sprite pMySprite = pTargetLoc set the moveableSprite of sprite pMySprite to FALSE -- puppetSound 3, "click" beep() set pStatus = #inPlace updateStage checkWin me end if end if end on checkWin me set statusList = [] sendAllSprites (#reportStatus, pMySprite, statusList) if getOne(statusList, #notInPlace) then nothing else puzzleFinished me end if end on reportStatus me, whichSprite, statusList if whichSprite <> pMySprite then add statusList, pStatus end if end on puzzleFinished me alert "You did it!" end
|
Pages: 1 Prev: Pre Director 11 Shockwave Content breaking Next: Deleting sprites? |