Chapter 4, Listing 4

Listing 4: Bill-O-Meter

Script of cd button "Start Game"

	on mouseUp
	  put FALSE into ende
	  put 264 into item 1 of position
	  put 235 into item 2 of position
	  set the loc of cd button Bill to position
	  set the icon of cd button Bill to Bill2
	  put 4 into kasse
	  put kasse && "$" into cd field "Kasse"
	  repeat until ende = TRUE
	    put random(2) into muenze
	    if muenze = 1 then
	      -- Bill hat verloren
	      subtract 41 from item 1 of position
	      subtract 1 from kasse
	      if kasse = 0 then
	        put TRUE into ende
	        put TRUE into Verloren
	      end if
	    else
	      -- Bill hat gewonnen
	      add 41 to item 1 of position
	      add 1 to kasse
	      if kasse = 8 then
	        put TRUE into ende
	        put TRUE into Gewonnen
	      end if
	    end if
	    wait 10 ticks
	    put kasse && "$" into cd field "Kasse"
	    set the loc of cd button Bill to position
	    if kasse > 6 then
	      set the icon of cd button Bill to Bill1
	    else if kasse > 2 then
	      set the icon of cd button Bill to Bill2
	    else
	      set the icon of cd button Bill to Bill3
	    end if
	  end repeat
	  if Verloren = TRUE then
	    repeat with i = 1 to 6
	      set the hilite of cd button "Verloren" to TRUE
	      wait 5 ticks
	      set the hilite of cd button "Verloren" to FALSE
	      wait 5 ticks
	    end repeat
	  else
	    repeat with i = 1 to 6
	      set the hilite of cd button "Gewonnen" to TRUE
	      set the hilite of cd button "Bill" to FALSE
	      wait 5 ticks
	      set the hilite of cd button "Gewonnen" to FALSE
	      set the hilite of cd button "Bill" to TRUE
	      wait 5 ticks
	    end repeat
	    set the hilite of cd button "Bill" to FALSE
	  end if
	end mouseUp

© 1997 by Jörg Kantel
Zurück zum Inhaltsverzeichnis