home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 256 / DR_BRAIN.BIN / BUGS / ACT2 / 00013_Field_13.txt next >
Text File  |  1996-06-14  |  907b  |  22 lines

  1. on mouseUp  -- move from present location to mouseclick
  2.   set mh = the mouseh   -- coordinates that we are moving towards
  3.   set mv = the mousev
  4.   
  5.   set px = the loch of sprite 2  --- location where we are (sprite 2)
  6.   set py = the locv of sprite 2
  7.   
  8.   set timeend = 20.0              -- this is how long we want the move to take
  9.   set xinc = (mh - px)/timeend    -- how far to move per timer tick
  10.   set yinc = (mv - py)/timeend
  11.   set ptime = the timer           -- grab present value for timer
  12.   
  13.   repeat while the timer < ( ptime + timeend) -- repeat until timeend ticks have passed
  14.     set dtime = the timer - ptime                  -- time since ptime was set (begining of move)
  15.     set the loch of sprite 2 = px + (xinc * dtime)
  16.     set the locv of sprite 2 = py + (yinc * dtime)
  17.     updatestage
  18.   end repeat
  19.   
  20.   set the loch of sprite 2 = mh
  21.   set the locv of sprite 2 = mv
  22. end