top of script window
draw a labyrinth code snippet | show it | return |
on drawit
  -- update status display
  put "drawing in practice area..." into field "status"
  
  -- restrict drawing area
  set the constraint of sprite gDrawSprite to 5
  
  -- get current drawing specs
  set the width of sprite gDrawSprite = integer(field "dot_size")
  set the height of sprite gDrawSprite = integer(field "dot_size")
  set the foreColor of sprite gDrawSprite = gCurrColor
  
  -- create list to record this stroke
  set newStroke = []
  set lastloc = the loc of sprite gDrawSprite
  cursor [14,15]
  
  repeat while the mousedown
    set mouseLoc = point(the mouseH,the mouseV)
    
    -- only draw a new dot if it is farther than gDotSpace from the last dot
    if  max(abs(the loch of (mouseLoc-lastloc)), ¬
        abs(the locV of (mouseLoc-lastloc))) > gDotSpace then
      set the loc of sprite gDrawSprite = mouseLoc
      
      append newStroke, mouseLoc
      set lastloc = mouseLoc
      updateStage
      
    end if   
  end repeat
  
  -- clean up
  cursor -1
  set the constraint of sprite gDrawSprite to 0
  set the loc of sprite gDrawSprite = point(-500, -500)
  updateStage
  
  -- record the data to our global tracking list
  append (the points of gMyDrawList, newStroke)
  append (the sizes of gMyDrawList, the width of sprite gDrawSprite)
  append (the colors of gMyDrawList, the foreColor of sprite gDrawSprite)
  
end
General script for drawing and recording results to a linear list.

lingo era = v5.0