drawLine

  how to join to arbitrary points with a line
line




  joining points
>> another problem I have come across.
>>
>> on mouseDown
>> -- set the starting point here
>>
>> -- while the mouse is still down
>> -- have a line follow the mouse
>> -- around that is stationary at
>> -- the starting point.
>> end mouseDown
>
>HAR har har har har! Hee hee hee hoo hoo!
>
>I'd like to hear from *anyone* who has pulled that off in Director.
>"Tricky" is certainly one term I'd use to describe it. "Where's my &%$#*
>vodka?" is another.
>

Warren, I want my vodka!

the frame script below is roughly adapted from an old d4 script which used outdated lingo like 
the spritebox ( I had to use the online help to remember what this command did).
All you need to use it are two line shape member, one going from top left to bottom right named 
"lineL", the other one going from bottom left up to top right, named "lineR". 


Best regards

Daniel Plaenitz
<http://www.lingo.de>

--------------------------------------
-- frame Script
-- line shape hardcoded for sprite 1, adapt according your needs

property myStartP

on exitFrame
  if the stillDown then checkLine
  go the frame
end

on mousedown
  set myStartP = point(the mouseH,the mouseV)
end

on mouseUp
  set myStartP = void
end

on checkLine
  -- hardcoded sprite reference, adapt it
  set lineSprite = 1

  set myEndP = point(the mouseH,the mouseV)
  drawline lineSprite,myStartP,myendP
end

on drawline dSprite,startp,endp
  
  set p1=the locH of startp
  set p2=the locV of startp
  set p3 =the locH of endP
  set p4 = the locV of endP
  
  -- pick the propper lineMember
  if (p1<p3) and (p2<p4) or (p1>p3) and (p2>p4) then 
    set the member of sprite dSprite to member  "LineL"
  else
    set the member of sprite dSprite to member "LineR"
  end if
  
  set the rect of sprite dSprite = rect( p1,p2,p3,p4)
end


Home shock + cgi Bits 'n pieces Director Lingo Shocklets Contact










pageID=l_drawLine