Older Version Newer Version

bluatigro bluatigro Apr 4, 2010

WindowWidth = 700 WindowHeight = 500 nomainwin timer 250 , [tmr] global red , green , orange global north , west , south , east , foot global frame , state , shift , clicked dim x( 5 ) , y( 5 ) shift = 16 red = 1 * shift green = 2 * shift orange = 3 * shift north = 0 west = 1 south = 2 east = 3 foot = 4 x( north ) = 200 : y( north ) = 0 x( west ) = 50 : y( west ) = 150 x( south ) = 200 : y( south ) = 300 x( east ) = 350 : y( east ) = 150 x( foot ) = 200 : y( foot ) = 150 state = north + red frame = 2 clicked = 0 open "StopLight" for graphics as #m #m "trapclose [quit]" #m "when leftBottonDown [leftbutton]" call light north , red call light west , red call light south , red call light east , red call light foot , red #m "flush" wait [leftbutton] clicked = abs( not( 0 ) ) wait [tmr] frame = frame - 1 select case state case north + red call light north , red if frame < 0 then frame = 30 state = north + green end if case north + green call light north , green if frame < 0 then frame = 10 state = north + orange end if case north + orange call light north , orange if frame < 0 then frame = 2 state = west + red call light north , red end if case west + red call light west , red if frame < 0 then frame = 30 state = west + green end if case west + green call light west , green if frame < 0 then frame = 10 state = west + orange end if case west + orange call light west , orange if frame < 0 then frame = 2 state = south + red call light west , red end if case south + red call light south , red if frame < 0 then frame = 30 state = south + green end if case south + green call light south , green if frame < 0 then frame = 10 state = south + orange end if case south + orange call light south , orange if frame < 0 then frame = 2 state = east + red call light south , red end if case east + red call light east , red if frame < 0 then frame = 30 state = east + green end if case east + green call light east , green if frame < 0 then frame = 10 state = east + orange end if case east + orange call light east , orange if frame < 0 then frame = 2 if clicked then state = foot + red clicked = 0 else state = north + red end if call light east , red end if case foot + red call light foot , red if frame < 0 then frame = 30 state = foot + green end if case foot + green call light foot , green if frame < 0 then frame = 10 state = foot + orange end if case foot + orange call light foot , orange if frame < 0 then frame = 2 state = north + red call light foot , red end if case else end select wait sub light no , clr #m "up" #m "goto " ; x( no ) ; " " ; y( no ) #m "color black" #m "backcolor black" #m "down" #m "boxfilled " ; x( no ) + 30 _ ; " " ; y( no ) + 90 #m "up" select case clr case red #m "color red" #m "backcolor red" #m "goto " ; x( no ) + 15 ; " " ; y( no ) + 15 #m "down" #m "circlefilled 15" case orange #m "color yellow" #m "backcolor yellow" #m "goto " ; x( no ) + 15 ; " " ; y( no ) + 45 #m "down" #m "circlefilled 15" case green #m "color green" #m "backcolor green" #m "goto " ; x( no ) + 15 ; " " ; y( no ) + 75 #m "down" #m "circlefilled 15" case else end select #m "flush" end sub [quit] close #m end