Frame 1
_global.xv = 0;
_global.yv = 0;
_global.angm = 1;
_global.hits = 0;
_global.attempts = 1;
Frame 2
Mouse.hide();
this.onEnterFrame = function () {
ball1_mc._x = ball1_mc._x + _global.xv;
ball1_mc._y = ball1_mc._y + _global.yv;
_global.xv = _global.xv + 0.3;
_global.yv = _global.yv * 0.999;
paddle_mc._y = _ymouse;
paddle2_mc._y = _ymouse;
marker_mc._x = _xmouse;
ball1_mc._rotation = ball1_mc._rotation + _global.angm;
if (ball1_mc._y >= 446) {
_global.yv = _global.yv * -0.9;
ball1_mc._y = 445.9;
_global.angm = (_global.xv + _global.angm) / 2;
}
if (ball1_mc._y <= 54) {
_global.yv = _global.yv * -0.9;
ball1_mc._y = 54.1;
_global.angm = ((-1 * _global.xv) + _global.angm) / 2;
}
if (ball1_mc._x <= 54) {
_global.xv = _global.xv * -0.9;
ball1_mc._x = 54.1;
_global.angm = (_global.yv + _global.angm) / 2;
}
if (ball1_mc.hitTest(paddle_mc)) {
_global.xv = _global.xv * (-(1 + (Math.sqrt(_global.xv) / _global.xv)));
_global.yv = _global.yv + ((ball1_mc._y - paddle_mc._y) / 10);
ball1_mc._x = 700;
_global.angm = ((-1 * _global.yv) + _global.angm) / 2;
_global.hits = _global.hits + 1;
hits_txt.text = hits;
}
if (ball1_mc._x >= 900) {
_global.xv = 0;
_global.yv = 3;
ball1_mc._x = 100;
_global.angm = ((-1 * _global.yv) + _global.angm) / 2;
if (score_txt.text < _global.hits) {
score_txt.text = _global.hits;
}
_global.hits = 0;
hits_txt.text = 0;
_global.attempts = _global.attempts + 1;
attempts_txt.text = _global.attempts;
}
};
Frame 3
gotoAndPlay (2);