home *** CD-ROM | disk | FTP | other *** search
- property NSconstraint, stopLoc, lastTicks, changePeriod, stopRange, enabled, origLoc, tag
- global gCatenaccio
-
- on beginSprite
- set lastTicks to the ticks
- set enabled to 1
- set gCatenaccio to []
- end
-
- on mouseDown
- if enabled then
- set Ns to the currentSpriteNum
- set hOffset to the mouseV - the locV of sprite Ns
- set origLoc to the locV of sprite Ns
- set the blend of sprite Ns to 100
- repeat while the stillDown
- set newVloc to constrainV(NSconstraint, the mouseV - hOffset)
- set the locV of sprite Ns to newVloc
- updateStage()
- end repeat
- end if
- end
-
- on mouseUp
- if enabled then
- set Ns to the currentSpriteNum
- set dropLoc to the locV of sprite Ns
- if (dropLoc <= (stopLoc + 20)) and (dropLoc >= (stopLoc - 20)) then
- puppetSound(1, "doing")
- set the locV of sprite Ns to stopLoc
- updateStage()
- set enabled to 0
- if getPos(gCatenaccio, tag) = 0 then
- add(gCatenaccio, tag)
- end if
- if count(gCatenaccio) = 2 then
- go(#next)
- end if
- else
- puppetSound(1, "Switch1")
- set the locV of sprite Ns to origLoc
- updateStage()
- end if
- end if
- end
-
- on exitFrame
- if enabled then
- set diff to the ticks - lastTicks
- set Ns to the currentSpriteNum
- if diff >= (changePeriod * 2) then
- set the blend of sprite Ns to 100
- set lastTicks to the ticks
- exit
- end if
- if (diff >= changePeriod) and (the blend of sprite Ns = 100) then
- set the blend of sprite Ns to 40
- end if
- end if
- end
-
- on getPropertyDescriptionList
- 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]]]
- return p_list
- end
-