50 likes | 59 Views
Create an interactive animation dice game with two dice and a "roll" button. Each dice displays a random number from 1 to 6 when the button is clicked. If both dice show the same number, the color of the dice changes and a song is played. Each roll changes the color of the dice and plays a different song.
E N D
"The games of a people reveal a great deal about them.“ Marshall McLuhan Intro to Action Script 5
Create an interactive animation dice game with two dice and button “roll” to through them. Each dice has to display random number from 1 to 6 each time the button “roll” is clicked. If both dice show the same number, change the color property of each dice and play a song. Play randomly selected songs each time dice show the same number. Change each dice color on each roll. Play different song for each roll. Exercise – dice
myObjectColor = new Color(“movieclip_name") ; myObjectColor.setRGB(0xFFFFFF); Exercise – dice
on (release) { // make list of possible responses responses = new Array("1", "2", "3", "4", "5", "6" ); // get number of responses n = responses.length; // pick random response r = Int(Math.random()*n); f = Int(Math.random()*n); // place response in text area dice1 = responses[r]; dice2 = responses[f]; dice1Color = new Color("dice1"); dice1Color.setRGB(0xFFFFFF); dice2Color = new Color("dice2"); dice2Color.setRGB(0xFFFFFF); Exercise – dice
if(r==f) { dice1Color.setRGB(0xFF0000); dice2Color.setRGB(0xFF0000); } // start animation gotoAndPlay(2); } Exercise – dice