home *** CD-ROM | disk | FTP | other *** search
/ GQ - Louise, World Cup, …remy Clarkson, Armageddon / GQCD.iso / files / modlbio.dxr / 00036_textScrollScript.ls < prev    next >
Encoding:
Text File  |  1998-05-21  |  1.7 KB  |  62 lines

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