Programming Concepts and Applications
for Artists and Designers
instructor:
Peter Gerstmann
student:
Yuegu Hu
task06 : waiting for the beloved
task06_A
.fla   .swf  code
 

 

Code for task06
on _root, frame 2:
buddy.stand();
var rightPeople = false;
 
 
on _root, frame 26: if (Math.random() > .4) {
buddy.tap();
}
else {
gotoAndPlay("waiting");
}

 
on _root, frame 50:
if (Math.random()>.8) {
car_mc.attachMovie("car_right", "car_right_mc", 1);
gal_mc.attachMovie("stand_Rnd","stand_Rnd_mc",2);
var rightPeople = true;
} else {
car_mc.attachMovie("car_wrong", "car_wrong_mc", 1);
gal_mc.attachMovie("stand_Squ","stand_Squ_mc",2);
var rightPeople = false;
}
buddy.tap();
 
 
on _root, frame 62:
buddy.scratch();
 
  on _root, frame 74:
if (rightPeople == true) {
gal_mc.attachMovie("stand_Rnd","stand_Rnd_mc",2);
} else {
gal_mc.attachMovie("stand_Squ","stand_Squ_mc",2);
}

  on _root, frame 98:
buddy.scratch();  
 
on _root, frame 121:
if (rightPeople == true) {
gotoAndPlay("happy");
buddy.jump();
}
else {
gotoAndPlay("worry");
};
 
 
on _root, frame 139:
buddy.propose();
 
 
on _root, frame 169:
stop();
 
inside movie clip 'flake', on frame 1:
var counter = 1;
var xOffset = 1;
var yOffset = Math.random() * .2 ;
var xPos = Math.random() * 853;
var yPos = Math.random() * 480;
this.onEnterFrame = function(){
xPos += (counter+ Math.random()*9)%9 -3;
yPos += counter * yOffset;
this._x = xPos % 853;
this._y = yPos;
this._alpha = yOffset * 250 + 40;
this._xscale = yOffset * 350 + 20;
this._yscale = yOffset * 350 + 20;
counter +=1;
if (yPos >480){
yPos = Math.random() * 50;
xPos = Math.random() * 853;
counter = 1;
}
}
 
 
on button 'replay':
on(release){
_root.gotoAndPlay(1);
}