detect which direction the cursor moves


[ Zettels Traum ] [ search / suche ]

von dp am 30.Maerz 97 um 12:10:42:

zu: Perlen aus dem Strom der Nachrichten im direct_L von Daniel am 22.Dezember 96 um 02:00:59:

This FrameScript will find the direction but to use it with different
sounds you may want to smooth its output by some kind of averaging it over
time.
Hope this helps
Daniel Plaenitz
--------------------
on exitFrame
  global glastPos,gLastDirec
  set here=point(the mouseH,the mouseV)
  if voidP(glastPos) then set gLastpos=here
  set direction=here - gLastpos
  set hor=getat(direction,1)
  set ver=getat(direction,2)
  if hor=0 and ver=0 then set Direc="still"
  else if hor<0 and ver=0 then set Direc="west"
  else if hor>0 and ver=0 then set Direc="east"
  else if hor=0 and ver<0 then set Direc="north"
  else if hor=0 and ver>0 then set Direc="south"
  else if hor<0 and ver>0 then set Direc="southwest"
  else if hor>0 and ver<0 then set Direc="northeast"
  else if hor>0 and ver>0 then set Direc="southeast"
  else if hor<0 and ver<0 then set Direc="northwest"
  if gLastDirec <> Direc then
    set gLastDirec=Direc
    put Direc
  end if
  set gLastpos=here
  go to the frame
end




Dazu:























D. Plänitz