Mr. Pythagoras can help you here

Assuming that the "object" is at pLocH, pLocV, then to find the 
distance the mouse is away from that object, you can do this:

property pLocH
property pLocV
property spriteNum

-- somewhere, set up pLocH and pLocV,
-- if you are talking about the sprite in this channel, you can do this
on beginsprite me
    pLocH = sprite(spriteNum).locH
    pLocV = sprite(spriteNum).locV
end


on exitFrame me
     distanceH = abs(the mouseH - pLocH))
     distanceV = abs(the mouseV - pLocV))
     distance = sqrt((power(distanceH, 2)) + power(distanceV, 2)))
     if distance <= 5.0 then
        -- inside
     else
         -- outside
     end if
end

Irv

At 9:46 AM +1000 5/3/02, Elvin M. Certeza, Jr. wrote:
>Hello List, does anyone know where I can read on some information regarding
>mouse detection?  I am trying to play with an object detecting the mouse
>location related to it's distance form the object, say within 5 pixels.
>


-- 

Lingo / Director / Shockwave development for all occasions. 
          
   (Home-made Lingo cooked up fresh every day just for you.)
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to