You are on page 1of 1

ACTIVITY

BALL CATCHING GAME

1. Create a movie clip for basket named net_catch


2. Type the following scripts for net_catch movie clip
action panel
onClipEvent (load) {
var dir:Number = 0;
}
onClipEvent (enterFrame) {
if (this.hitTest (_parent.ball_catch1) ){
_parent.ball_catch1._y = 0;
}
if (this.hitTest (_parent.ball_catch2) ){
_parent.ball_catch2._y = 0;
}
if (this.hitTest (_parent.ball_catch3) ){
_parent.ball_catch3._y = 0;
}
if (dir == 0) {
this. _x +=10;
if(this._x > 400) {
dir = 1;
}
} else if (dir == 1) {
this._x -=10;
if (this._x < 130) {
dir = 0; }}}
3. Create three movie clips for ball_catch1, ball_catch2 & ball_catch3
4. Type the following scripts for the each movie clip:
ball_catch1 = 5 ball_catch2 = 3 ball_catch3= 2
onClipEvent (enterFrame) {
this._y +=5;
if (this._y > 450) {
this._y = 0;
}
}

5. In the button action panel, type the following scripts:


on(press){
if (net_catch.dir == 1){
net_catch.dir = 0;
} else if (net_catch.dir ==0) {
net_catch.dir=1;
}}
6. Save your file as ballcatchNAME.fla and test your program

You might also like