home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 July / DPPCPRO0799.ISO / Ents / Files / model.dxr / 00056_textScrollScript.ls < prev    next >
Encoding:
Text File  |  1999-04-21  |  1.7 KB  |  57 lines

  1. property textSprite, myScrollDelay, minSafeArea, maxSafeArea, topLimit, bottomLimit, activeLeft, activeRight
  2.  
  3. on new me
  4.   return me
  5. end
  6.  
  7. on init me, whichTextSprite, scrollDelay, safeArea, tLimit, bLimit
  8.   set textSprite to whichTextSprite
  9.   set myScrollDelay to scrollDelay
  10.   set myOffset to safeArea / 2.0
  11.   set minSafeArea to 241 - myOffset
  12.   set maxSafeArea to 240 + myOffset
  13.   set topLimit to tLimit
  14.   set bottomLimit to bLimit
  15.   set activeLeft to the left of sprite textSprite
  16.   set activeRight to the right of sprite textSprite
  17.   append(the actorList, me)
  18. end
  19.  
  20. on stepFrame me
  21.   if the mouseV < 401 then
  22.     if (the mouseH > activeLeft) and (the mouseH < activeRight) then
  23.       if the mouseV > maxSafeArea then
  24.         set myDirection to (the mouseV - (maxSafeArea - 10)) / myScrollDelay
  25.         scrollUp(me, myDirection)
  26.       else
  27.         if the mouseV < minSafeArea then
  28.           set myDirection to (the mouseV - (minSafeArea + 10)) / myScrollDelay
  29.           scrollDown(me, myDirection)
  30.         end if
  31.       end if
  32.     end if
  33.   end if
  34. end
  35.  
  36. on scrollUp me, myDirection
  37.   set newPos to the locV of sprite textSprite - myDirection
  38.   if newPos < topLimit then
  39.     set the cursor of sprite textSprite to [7, 8]
  40.     set the locV of sprite textSprite to topLimit
  41.   else
  42.     set the cursor of sprite textSprite to [3, 4]
  43.     set the locV of sprite textSprite to newPos
  44.   end if
  45. end
  46.  
  47. on scrollDown me, myDirection
  48.   set newPos to the locV of sprite textSprite - myDirection
  49.   if newPos > bottomLimit then
  50.     set the cursor of sprite textSprite to [5, 6]
  51.     set the locV of sprite textSprite to bottomLimit
  52.   else
  53.     set the cursor of sprite textSprite to [1, 2]
  54.     set the locV of sprite textSprite to newPos
  55.   end if
  56. end
  57.