From: "Akvile K." Date: 2011-12-11T22:14:07+09:00 Subject: Re: How can i make this procedure into a function? 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 #Fußgängerampel 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 Zeitabstände zwischen den Ampelphasen angeben sollte #tn=Time.now.to_i #te=tn+dauer #while tn 30, :top=> 150 do button "Walk" do #Situation 1 : knopf gedrückt #fuflg‰ngerampel timer (5) do lighta.fill = red lightb.fill = black #Autoampel light1.fill = black light2.fill = black light3.fill = green end #Situation 2 : knopf gerdückt 2 #fußgängerampel timer (15) do lighta.fill = red lightb.fill = black #Autoampel light1.fill = black light2.fill = orange light3.fill = black end #Sitation 3 : knopf gedrückt 3, fußgänger laufen über das zera streifen #fußgängerampel 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 dürfen gleich fahren #fußgängerampel timer (30) do lighta.fill = black lightb.fill = green #Autoampel light1.fill = red light2.fill = orange light3.fill = black end #Sitaution 5 : Grüne ampel läuft eim Fußgäger aus, Autos dürfen fahren #Fußgängerampel 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 #Fußgängerampel timer (40) do lighta.fill = black lightb.fill = black #Autoampel light1.fill = black light2.fill = black light3.fill = black end end end end -- Posted via http://www.ruby-forum.com/.