home *** CD-ROM | disk | FTP | other *** search
/ Encyklopedia Omnia / Planeta.iso / data / a_gen.dir / 00028_vScroll&Lock.ls < prev    next >
Encoding:
Text File  |  2000-11-14  |  2.0 KB  |  66 lines

  1. property NSconstraint, stopLoc, lastTicks, changePeriod, stopRange, enabled, origLoc, tag
  2. global gCatenaccio
  3.  
  4. on beginSprite
  5.   set lastTicks to the ticks
  6.   set enabled to 1
  7.   set gCatenaccio to []
  8. end
  9.  
  10. on mouseDown
  11.   if enabled then
  12.     set Ns to the currentSpriteNum
  13.     set hOffset to the mouseV - the locV of sprite Ns
  14.     set origLoc to the locV of sprite Ns
  15.     set the blend of sprite Ns to 100
  16.     repeat while the stillDown
  17.       set newVloc to constrainV(NSconstraint, the mouseV - hOffset)
  18.       set the locV of sprite Ns to newVloc
  19.       updateStage()
  20.     end repeat
  21.   end if
  22. end
  23.  
  24. on mouseUp
  25.   if enabled then
  26.     set Ns to the currentSpriteNum
  27.     set dropLoc to the locV of sprite Ns
  28.     if (dropLoc <= (stopLoc + 20)) and (dropLoc >= (stopLoc - 20)) then
  29.       puppetSound(1, "doing")
  30.       set the locV of sprite Ns to stopLoc
  31.       updateStage()
  32.       set enabled to 0
  33.       if getPos(gCatenaccio, tag) = 0 then
  34.         add(gCatenaccio, tag)
  35.       end if
  36.       if count(gCatenaccio) = 2 then
  37.         go(#next)
  38.       end if
  39.     else
  40.       puppetSound(1, "Switch1")
  41.       set the locV of sprite Ns to origLoc
  42.       updateStage()
  43.     end if
  44.   end if
  45. end
  46.  
  47. on exitFrame
  48.   if enabled then
  49.     set diff to the ticks - lastTicks
  50.     set Ns to the currentSpriteNum
  51.     if diff >= (changePeriod * 2) then
  52.       set the blend of sprite Ns to 100
  53.       set lastTicks to the ticks
  54.       exit
  55.     end if
  56.     if (diff >= changePeriod) and (the blend of sprite Ns = 100) then
  57.       set the blend of sprite Ns to 40
  58.     end if
  59.   end if
  60. end
  61.  
  62. on getPropertyDescriptionList
  63.   set p_list to [#NSconstraint: [#comment: "Sprite di vincolo:", #format: #integer, #default: 0, #range: 1, 5: 120], #stopLoc: [#comment: "Stop al pixel:", #format: #integer, #default: 0], #stopRange: [#comment: "Intervallo di stop:", #format: #integer, #default: 10], #changePeriod: [#comment: "Periodo di lampeggio:", #format: #integer, #default: 30], #tag: [#comment: "Tag:", #format: #symbol, #default: #temp, #range: [#temp, #piov]]]
  64.   return p_list
  65. end
  66.