Hey,

what i need is that this procedure works in a programm that chsnges the lights in a traffic light. i am using timer now but i am 100% sure that my professor during the exam wants to see a function or a procedure in this programm. any suggestions?



Shoes.app :titel=> Ampel, :height=> 500, :width=> 500 do
  background white

  #Ausgangssituation

  #Fugngerampel
  fill gainsboro
  rect 10,50,90,130
  fill black
  lighta = oval :top=> 60, :left=> 30, :radius=> 25
  fill black
  lightb = oval :top=> 120, :left=> 30, :radius=> 25

  #Autoampel
  fill gainsboro
  rect 210,45,150,300
  fill black
  light1 = oval :top=> 50, :left=> 245, :radius=> 40
  fill black
  light2 = oval :top=> 150, :left=> 245, :radius=> 40
  fill black
  light3 = oval :top=> 250, :left=> 245, :radius=> 40

  #def pause (dauer) Prozedur, welche die Zeitabstnde zwischen den Ampelphasen angeben sollte
    #tn=Time.now.to_i
    #te=tn+dauer
      #while tn<te do
        #tn=Time.now.to_i
      #end
  #end

stack :margin=> 30, :top=> 150 do
  button "Walk" do

  #Situation 1 : knopf gedrckt

    #fug˘óngerampel

  timer (5) do

  lighta.fill = red
  lightb.fill = black



    #Autoampel

  light1.fill = black

  light2.fill = black

  light3.fill = green

  end

  #Situation 2 : knopf gerdckt 2

    #fugngerampel


  timer (15) do

  lighta.fill = red
  lightb.fill = black

    #Autoampel

  light1.fill = black
  light2.fill = orange
  light3.fill = black

  end

  #Sitation 3 : knopf gedrckt 3, fugnger laufen ber das zera streifen

  #fugngerampel

  timer (25) do

  lighta.fill = black
  lightb.fill = green

  #Autoampel

  light1.fill = red
  light2.fill = black
  light3.fill = black

  end


  #Situation 4 : Ampel geht aus 1, Autos drfen gleich fahren

  #fugngerampel

  timer (30) do

  lighta.fill = black
  lightb.fill = green

  #Autoampel

  light1.fill = red
  light2.fill = orange
  light3.fill = black

  end

  #Sitaution 5 : Grne ampel luft eim Fugger aus, Autos drfen fahren

  #Fugngerampel

  timer (35) do

  lighta.fill = red
  lightb.fill = black

  #Autoampel

  light1.fill = black
  light2.fill = black
  light3.fill = green

  end

  #Situation 6 : Alle ampeln gehen aus

  #Fugngerampel

  timer (40) do

  lighta.fill = black
  lightb.fill = black

  #Autoampel

  light1.fill = black
  light2.fill = black
  light3.fill = black

  end

end

end

end