home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / devglry / studiosw / shockwav / shokcats.dcr / 00082_aDDisplay.ls < prev    next >
Encoding:
Text File  |  1996-05-10  |  1.5 KB  |  61 lines

  1. property myDigits, curNUM, maxDigits, delta, hDelta
  2.  
  3. on birth me, nDigits, initSprite
  4.   set maxDigits to nDigits
  5.   set myDigits to []
  6.   set count to 0
  7.   repeat while count < nDigits
  8.     setAt(myDigits, count + 1, birth(script "nDigit", initSprite + count))
  9.     set count to count + 1
  10.   end repeat
  11.   set curNUM to 0
  12.   set count to 0
  13.   repeat while count < nDigits
  14.     set theDigit to getAt(myDigits, count + 1)
  15.     set delta to the width of cast 1
  16.     set hDelta to the height of cast 1
  17.     set hDelta to (hDelta / 2) + 9
  18.     upDateDigit(theDigit, curNUM)
  19.     set count to count + 1
  20.   end repeat
  21.   return me
  22. end
  23.  
  24. on incNumber me, aNum
  25.   if (curNUM + aNum) > 0 then
  26.     set curNUM to curNUM + aNum
  27.     set baseN to 1
  28.     set count to 1
  29.     repeat while count < (maxDigits - 1)
  30.       set baseN to baseN * 10
  31.       set count to count + 1
  32.     end repeat
  33.     set count to maxDigits
  34.     set varBase to 10
  35.     set thisN to curNUM / varBase
  36.     set thisN to curNUM - (thisN * varBase)
  37.     set YAN to curNUM
  38.     repeat while count >= 1
  39.       if thisN >= 0 then
  40.         set theDigit to getAt(myDigits, count)
  41.         upDateDigit(theDigit, thisN)
  42.         set count to count - 1
  43.         set varBase to varBase
  44.         set YAN to YAN / 10
  45.         set thisN to YAN / varBase
  46.         set thisN to YAN - (thisN * varBase)
  47.       end if
  48.     end repeat
  49.   end if
  50. end
  51.  
  52. on setNumber me, theNum
  53.   set curNUM to theNum
  54.   set count to 0
  55.   repeat while count < maxDigits
  56.     set theDigit to getAt(myDigits, count + 1)
  57.     upDateDigit(theDigit, curNUM)
  58.     set count to count + 1
  59.   end repeat
  60. end
  61.