##okhan 4/3/00
##8C
#This is a travel between 3 places:QUIET, RUDE, and FAST
#Using the same set of data(made from the x,y position of 
#the mouse), three different environments are created

g.norefresh()
import math

data= []
for i in range(0, 101):
       data.append(0)
print data
thisx = 0
thisy = 0
while 1:
   if g.getMouse(3) == 100:
          x = g.getConnector ('mouse', 1)  
          y = g.getConnector ('mouse', 2)  
          thisx = data[49]
          thisy = data[51]
          data[50] = data[49]+data[51]
          data[49:50] = []
          data.insert(0,x)
          data[51:52]=[]
          data.append(y)
          
          ##environments
          g.paper(0)
          g.field(0, 65, 90, 100, 80)
          g.field(20, 0, 100, 25, 30)
          
          ##avatar color and shape change with environment        
          #top
          if g.getMouse(2)>=65:           
           g.field(thisx, thisy, thisx+3, thisy+3, 0)
          
          #middle
          if g.getMouse(2)>=25 and g.getMouse(2)<=60:
           g.field(thisx, thisy, thisx+1, thisy+3, 50)
           g.field(thisx-1, thisy+1, thisx+2, thisy+2, 50)
          
          #bottom
          if g.getMouse(2)<=25:           
           for i in range(thisx-3, thisx+4):
            g.pen(100)
            g.line(thisx, thisy, i, thisy+3)
           
         
          for i in range(0, 50):
             ##top environment FAST
             j=i+51
             if g.getMouse(2)>=65:
              g.pen(100-data[j])
              g.setPixel(2*i-10, data[j],(100-data[j]))
             
             ##middle environment RUDE
             if g.getMouse(2)>=25 and g.getMouse(2)<=60:
              if i>25 and i<30:
               g.pen(100)
               g.line(0, i, data[i], i*2)
            
             ##lower environment QUIET 
             if g.getMouse(2)<=25:
              g.pen(data[j])
              g.line(((j-51)*5), 0,((j-51)*3), data[j]) 
                              

          g.refresh()