home *** CD-ROM | disk | FTP | other *** search
/ Blender Volume 2 #3 / Blender_2_3.iso / BLENDER / FILES / OPENING.DIR / 00026.ls < prev    next >
Encoding:
Text File  |  1996-04-01  |  2.4 KB  |  81 lines

  1. on moveBar
  2.   set sp to 39
  3.   set w to the width of sprite sp
  4.   set the locH of sprite sp to min(max(the mouseH - (w / 2), 0), 640 - the width of sprite sp)
  5.   updateStage()
  6. end
  7.  
  8. on bounceBall
  9.   global gList, gList1
  10.   set sp to 40
  11.   set x to getAt(gList, 1)
  12.   set Y to getAt(gList, 2)
  13.   set w to the width of sprite sp
  14.   set a to the bottom of sprite sp
  15.   set b to the left of sprite sp
  16.   set c to the right of sprite sp
  17.   set D to (a + Y) >= 480
  18.   set e to (a + Y) >= the top of sprite (sp - 1)
  19.   set f to (b + x + w) >= the left of sprite (sp - 1)
  20.   set g to (b + x) <= the right of sprite (sp - 1)
  21.   if (c + x) >= 640 then
  22.     sound playFile 2, "MouseDWN.AIF"
  23.     setAt(gList, 1, -x)
  24.   else
  25.     if (b + x) <= 0 then
  26.       sound playFile 2, "MouseDWN.AIF"
  27.       setAt(gList, 1, -x)
  28.     else
  29.       if (the top of sprite sp + Y) <= 0 then
  30.         sound playFile 2, "MouseDWN.AIF"
  31.         setAt(gList, 2, -Y)
  32.       else
  33.         if D then
  34.           sound playFile 2, "MouseDWN.AIF"
  35.           setAt(gList, 2, -Y)
  36.         else
  37.           if e and f and g then
  38.             sound playFile 2, "delt.AIF"
  39.             setAt(gList, 2, -Y)
  40.             set q to the left of sprite (sp - 1)
  41.             set r to the width of sprite (sp - 1)
  42.             set myWidth to r + (2.0 * w)
  43.             set POS to (b + (w / 2) - (q - w)) / myWidth
  44.             if x > 0 then
  45.               set sign to 1
  46.             else
  47.               set sign to -1
  48.             end if
  49.             setAt(gList, 1, POS * sign * 2 * Y)
  50.           else
  51.             repeat with i in gList1
  52.               if sprite sp intersects i then
  53.                 sound playFile 2, "MouseUp.AIF"
  54.                 set the visible of sprite i to 0
  55.                 set x to getPos(gList1, i)
  56.                 if (the top of sprite sp <= the bottom of sprite i) or (the bottom of sprite sp >= the top of sprite i) then
  57.                   setAt(gList, 2, -Y)
  58.                 end if
  59.                 deleteAt(gList1, x)
  60.                 set num to count(gList1)
  61.                 if num then
  62.                   setAt(gList, 2, getAt(gList, 2) + 0.29999999999999999)
  63.                 end if
  64.                 exit repeat
  65.               end if
  66.             end repeat
  67.           end if
  68.         end if
  69.       end if
  70.     end if
  71.   end if
  72.   set x to getAt(gList, 1)
  73.   set Y to getAt(gList, 2)
  74.   set a to getAt(gList, 3)
  75.   set b to getAt(gList, 4)
  76.   set the locH of sprite sp to integer(a + x)
  77.   set the locV of sprite sp to integer(b + Y)
  78.   setAt(gList, 3, a + x)
  79.   setAt(gList, 4, b + Y)
  80. end
  81.