property pOrigLocation -- store the original location for 'snap back' property pMatchSprite -- the number of the sprite to match property pMatchName -- the name of the sprite to match property pSpriteType -- the type of sprite to match ----------------------------------------------------- -- Drag one sprite to another and check for a match. -- If the match sprite is a vector type, the fill -- mode of the vector shape is altered. -- Ken Loge - http://diginoodles.com ----------------------------------------------------- on getPropertyDescriptionList me list = [:] addProp list, #pMatchSprite, [#comment: "Couple this sprite with sprite channel:", #format: #integer, #default: 0] return list end on beginSprite me pOrigLocation = sprite(me.spriteNum).loc -- allow sprite to be dragged with the mouse sprite(me.spriteNum).moveableSprite = TRUE -- name of match sprite pMatchName = sprite(pMatchSprite).member.name -- type of sprite pSpriteType = sprite(pMatchSprite).member.type end on mouseUp me checkForMatch(me) end -- check for sprite intersection. If the match sprite is a vector -- type, then change vector properties when intersect occurs. on checkForMatch me -- see if the sprite is inside the rectangle of the matching sprite if inside(sprite(me.spriteNum).loc, sprite(pMatchSprite).rect) then if sprite(pMatchSprite).member.type = #vectorShape then -- we have a match, so set the match sprite to solid fill -- if it is a vectorShape member(pMatchName).fillMode = #solid end if else -- we don't have a match, snap back sprite(me.spriteNum).loc = pOrigLocation if sprite(pMatchSprite).member.type = #vectorShape then -- we have a match, so set the match sprite to no fill -- if it is a vectorShape member(pMatchName).fillMode = #none end if end if end