I'm sure I'm doing something dumb but I can't get
something to work.  I am creating a program that will
place a spot in one of several locations in one of
four colors whenever someone clicks the mouse button.
I want this to happen 5 times and then I want the loop
to stop.  My loop changes the location and color 5
times for each mouse click and I want one mouse click,
one change.  If I remove the UpdateStage  at the end,
it seems to count to 5, then change the location and
color.  Here's the code:

 on mouseDown
  set oldDistanceList = [#veryNear:point(20,20),
#near:point(70,70),
#middle:point(120,120),#far:point(170,170),#veryFar:point(220,220)]
  set randomDistanceList = [:]  
  center = point(400,300)
  
 repeat while true
    if oldDistanceList.count < 1 then exit repeat
   aDistance = random(count(oldDistanceList))
     theValue = oldDistanceList[aDistance]
    theProp = oldDistanceList.getPropAt(aDistance)
    randomDistanceList.addProp(theProp, theValue)
    OldDistanceList.deleteAt(aDistance)  
  end repeat
   
  
  repeat with i= 1 to randomDistanceList.count
    r = random(4)
    if  r = 4 then 
      sprite(1).forecolor = rgb(255, 0, 0)
    else if r = 3 then
      sprite(1).color = rgb (255, 255, 0)
    else if r = 2 then
      sprite(1).color = rgb (0, 255, 0)
    else
      sprite(1).color = rgb(0, 0, 255)    
    end if
    
    if random(2) = 2 then
      x = 1
    else
      x = -1
    end if
    --  --     
    if  random (2) = 2 then 
      y= 1
    else
      y = -1
    end if
    
    sprite(1).loc = center +
randomDistanceList.getAt(i) * point(x, y)
    updateStage
  end  repeat
  
end

This list has gotten me this far.  Thanks for your
help
Paul Schulman
Department of Psychology
SUNY Institute of Technology
Utica NY 13501

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
http://photos.yahoo.com/

[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!]

Reply via email to