home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / casestdy / ch17_dav / panscan.dcr / 00008.ls < prev    next >
Encoding:
Text File  |  1996-11-12  |  883 b   |  27 lines

  1. global gSpriteWidth, gHalfWay
  2.  
  3. on mouseDown
  4.   set myH to the mouseH
  5.   repeat while the stillDown
  6.     set mouseOffsetH to the mouseH - myH
  7.     if mouseOffsetH > 0 then
  8.       set mouseOffsetH to sqrt(mouseOffsetH)
  9.     else
  10.       set mouseOffsetH to 0 - sqrt(abs(mouseOffsetH))
  11.     end if
  12.     if the right of sprite 1 < mouseOffsetH then
  13.       set the locH of sprite 1 to gHalfWay - mouseOffsetH
  14.       set the locH of sprite 2 to the locH of sprite 1 + gSpriteWidth
  15.     else
  16.       if the left of sprite 1 > mouseOffsetH then
  17.         set the locH of sprite 1 to gHalfWay - gSpriteWidth - mouseOffsetH
  18.         set the locH of sprite 2 to the locH of sprite 1 + gSpriteWidth
  19.       else
  20.         set the locH of sprite 1 to the locH of sprite 1 - mouseOffsetH
  21.         set the locH of sprite 2 to the locH of sprite 2 - mouseOffsetH
  22.       end if
  23.     end if
  24.     updateStage()
  25.   end repeat
  26. end
  27.