Combined Code
movieClip 4 Ball {
frame 1 {
dX = 5;
dY = 5;
h = Stage.height - Math.round(this._height / 2);
w = Stage.width - Math.round(this._width / 2);
t = +Math.round(this._height / 2);
l = +Math.round(this._width / 2);
this._y = Math.random() * (h - t) + t;
this._x = Math.random() * (w - l) + l;
S = new Sound();
S.attachSound('Bounce');
}
frame 2 {
this._x += dX;
this._y += dY;
}
frame 3 {
bX = this._x;
bY = this._y;
if (bX >= w or bX <= l) {
dX = -dX;
this._x += dX;
S.start;
}
if (bY >= h or bY <= t) {
dY = -dY;
this._y += dY;
S.start();
}
gotoAndPlay(2);
}
}
frame 1 {
B = new Sound();
B.attachSound('Bang');
_root.Blast1.stop();
_root.Blast1._visible = false;
counter = 0;
time = getTimer();
}
frame 1 {
}
movieClip 7 {
}
movieClip 12 {
frame 5 {
this.stop();
}
}
movieClip 16 {
}
instance of movieClip 16 {
onClipEvent (load) {
Mouse.hide();
this.startDrag(true);
}
onClipEvent (mouseDown) {
_root.B.start();
if (this.hitTest(_root.Duck)) {
_root.Blast1._x = _root.Duck._x;
_root.Blast1._y = _root.Duck._y;
_root.Duck.stop();
_root.Duck._visible = false;
_root.Blast1._visible = true;
_root.Blast1.play();
++_root.counter;
_root.score = _root.counter;
if (_root.counter == 10) {
_root.score = Math.round((getTimer() - _root.time) / 1000) + ' seconds';
} else {
_root.Duck._x = Math.random() * 200 + 50;
_root.Duck._y = Math.random() * 200 + 50;
_root.Duck.dX = -_root.Duck.dX;
_root.Duck.dY = -_root.Duck.dY;
_root.Duck.play();
_root.Duck._visible = true;
}
if (Blast1 == 10) {
ball.stop();
}
}
}
}