Script
Script
BOLA
onClipEvent(load){
dir=Math.round(Math.random()*1);
speed=10;
if(dir==1){
var Ang=45;
}else {
var Ang=135;
}
xspeed=speed*Math.cos((Ang)*Math.PI/180);
yspeed=speed*Math.sin((Ang)*Math.PI/180);
}
onClipEvent(enterFrame){
this._x+=xspeed;
this._y+=yspeed;
if((this._x<=5)||(this._x>=295)){
xspeed=-xspeed;
}
if((this._y<=5)||(_root.persegi.hitTest(this))){
yspeed=-yspeed;
removeMovieClip(this);
}
if(this._y>300){
_root.hidup-=1;
if(_root.hidup==0){
_root.play();
}
_x=150;
_y=100;
dir=Math.round(Math.random()*1);
speed=10;
if(dir==1){
var Ang=45;
}else{
var Ang=135;
}
xspeed=speed*Math.cos((Ang)*Math.PI/180);
yspeed=speed*Math.sin((Ang)*Math.PI/180);
}
}
14. PERSEGI
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
if(this._x<=275){
this._x+=10
}
}
if(Key.isDown(Key.LEFT)){
if(this._x>=25){
this._x-=10;
}
}
}
17. KOTAK
onClipEvent(enterFrame){
if((this.hitTest(_root.bola))){
_root.bola.yspeed=-_root.bola.yspeed;
this.play();
}
}
23. Kotak frame
stop();
27. Kotak frame
stop();
_root.score+=10;
if(_root.score==160){
_root.play();
}
15. Score
stop();
var score=0;
var hidup=5;
18. Score
stop();
scoreAkhir=score;
if(_root.hidup==0){