Michael Nadel wrote:

> I want that the user should be almost exactly on top of the 
> invisible sprite in 
> order for the puzzle piece to become visible. Is there 
> another way to do 
> this that would test if the user is approximately almost 
> exactly within the 
> rect of the invisible sprite?? (not "exactly", but 
> "approximately exactly?"

Untested e-mail Lingo:

property pMySprite
property pTargetSprite
property pPctMatch
property pMyArea

on init me, targetSprite
  pTargetSprite = targetSprite
  pPctMatch = 0.8
  pMySprite = sprite(me.spriteNum)
  pMyArea = float(pMySprite.width * pMySprite.height)
end

on checkDrop
  combinedRect = union(pMySprite.rect, pTargetSprite.rect)
  totalArea = float(combinedRect.width * combinedRect.height)
  if ((totalArea * pPctMatch) <= pMyArea) then
    return TRUE
  else
    return FALSE
  end if
end checkDrop

Test, debug, add comments, and let me know how it works.

Cordially,

Kerry Thompson


[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 
lingo-l@penworks.com  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to