Richie,
Here is a quick and dirty script that I threw together some time ago to
draw lines between two points. Basically, you need this script, a line
member that slopes upward: / and a line member that slopes downward: \.
Here is the script: (beware line breaks)
--
-- This function will draw a line on the screen based on
-- coordinates passed to it. Coordinates should be of type
-- point(x, y). There must be a start and end point.
-- finally, the channel for the line must also be passed.
--
-- NOTE: Make sure the members line_positive and line_negative
-- are added to your cast
--
on drawLine(startPoint, endPoint, channel)
upLine = member("line_positive")
downLine = member("line_negative")
-- Check for lines of 0 length
if startPoint.locH = endPoint.locH then
endPoint.locH = endPoint.locH + 1
end if
if startPoint.locV = endPoint.locV then
endPoint.locV = endPoint.locV + 1
end if
-- Determine slope of line
deltaH = endPoint.locH - startPoint.locH
deltaV = endPoint.locV - startPoint.locV
if (deltaH > 0 and deltaV > 0) or not (deltaH > 0 or deltaV > 0) then
sprite(channel).member = downLine
else
sprite(channel).member = upLine
end if
-- Draw the line
sprite(channel).rect = rect(startPoint.locH, startPoint.locV,
endPoint.locH, endPoint.locV)
updateStage
End
Just call the script as follows:
drawline(sprite(1).loc, sprite(2).loc, 3)
Where sprite 1 and 2 are your sprites, and 3 is the channel your line
member is in.
HTH
Brian Romanko
Lead Developer - Neo/SCI Corporation
Member - Greater Rochester Macromedia User Group
>-----Original Message-----
>Hi all,
>
>Any suggestions as to how i can create a line from the
>midpoint of one sprite to the midpoint of the second
>sprite..both the sprites can be anywhere on the stage and not
>necessarily in line. I tried to create a shape object with a
>line on it and then positioned it at the midpoint between the
>two sprites..but then the orientation of the line still
>remains the same. I need the line really going from one sprite
>to the other... Any suggestions...??????? Regards
>
>Richie
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]