Instance of Symbol 12 MovieClip "ball_mc" in Frame 1
onClipEvent (enterFrame) {
if ((this._x <= 40) || (this._x >= 499)) {
if (this.hitTest(_root.paddle1_mc)) {
_root.impact_mc._x = this._x;
_root.impact_mc._y = this._y;
_root.impact_mc.play();
_root.code_mc.Deflection1();
_root.code_mc.ball_direction = 1;
}
if (this.hitTest(_root.paddle2_mc)) {
_root.impact_mc._x = this._x;
_root.impact_mc._y = this._y;
_root.impact_mc.play();
_root.code_mc.Deflection2();
_root.code_mc.ball_direction = -1;
}
}
if (this._x <= 0) {
_root.code_mc.ball_OutBounds = true;
_root.leftgoal_mc.gotoAndPlay(2);
_root.code_mc.game_p2score++;
_root.code_mc.BallRecall();
_root.code_mc.ball_direction = -1;
}
if (this._x >= 550) {
_root.code_mc.ball_OutBounds = true;
_root.rightgoal_mc.gotoAndPlay(2);
_root.code_mc.game_p1score++;
_root.code_mc.BallRecall();
_root.code_mc.ball_direction = 1;
}
if (this._y > 375) {
_root.firstSound.attachSound("blip3");
_root.firstSound.start();
_root.impact2_mc._x = this._x;
_root.impact2_mc._y = this._y;
_root.impact2_mc.gotoAndPlay(2);
_root.code_mc.ball_vDirection = -1;
}
if (this._y < 66) {
_root.firstSound.attachSound("blip3");
_root.firstSound.start();
_root.impact2_mc._x = this._x;
_root.impact2_mc._y = this._y;
_root.impact2_mc.gotoAndPlay(2);
_root.code_mc.ball_vDirection = 1;
}
}
Instance of Symbol 16 MovieClip "paddle1_mc" in Frame 1
onClipEvent (enterFrame) {
if (this._y > 340) {
if (Key.isDown(38)) {
this._y = this._y - 7;
}
}
if (this._y < 100) {
if (Key.isDown(40)) {
this._y = this._y + 7;
}
}
if ((this._y >= 100) && (this._y <= 340)) {
if (Key.isDown(38)) {
this._y = this._y - 7;
}
if (Key.isDown(40)) {
this._y = this._y + 7;
}
}
}
Instance of Symbol 16 MovieClip "paddle2_mc" in Frame 1
onClipEvent (enterFrame) {
if ((_root.ball_mc._x > 213) && (_root.code_mc.ball_inPlay == true)) {
if (_root.ball_mc._y < this._y) {
if (this._y > 100) {
this._y = this._y - 7;
}
}
if (_root.ball_mc._y > this._y) {
if (this._y < 340) {
this._y = this._y + 7;
}
}
}
}
Instance of Symbol 31 MovieClip "code_mc" in Frame 1
onClipEvent (load) {
function Deflection1() {
_root.firstSound.attachSound("blip1");
_root.firstSound.start();
if (_root.ball_mc._y <= _root.paddle1_mc._y) {
_root.code_mc.ball_vDirection = -1;
_root.code_mc.ball_vSpeed = Math.abs((_root.paddle1_mc._y - _root.ball_mc._y) / 3);
} else if (_root.ball_mc._y > _root.paddle1_mc._y) {
_root.code_mc.ball_vDirection = 1;
_root.code_mc.ball_vSpeed = Math.abs((_root.paddle1_mc._y - _root.ball_mc._y) / 3);
}
}
function Deflection2() {
_root.firstSound.attachSound("blip2");
_root.firstSound.start();
if (_root.ball_mc._y <= _root.paddle2_mc._y) {
_root.code_mc.ball_vDirection = -1;
_root.code_mc.ball_vSpeed = Math.abs((_root.paddle2_mc._y - _root.ball_mc._y) / 3);
} else if (_root.ball_mc._y > _root.paddle2_mc._y) {
_root.code_mc.ball_vDirection = 1;
_root.code_mc.ball_vSpeed = Math.abs((_root.paddle2_mc._y - _root.ball_mc._y) / 3);
}
}
function BallRecall() {
_root.ball_mc._x = 270;
_root.ball_mc._y = 217;
_root.code_mc.ball_OutBounds = false;
_root.code_mc.ball_inPlay = false;
_root.code_mc.ball_vSpeed = 0;
_root.paddle1_mc._y = 217;
_root.paddle2_mc._y = 217;
if ((_root.code_mc.game_p1score < 10) && (_root.code_mc.game_p2score < 10)) {
_root.firstSound.attachSound("recall");
_root.firstSound.start();
_root.timer_mc.play();
}
if (_root.code_mc.game_p1score == 10) {
_root.firstSound.attachSound("win");
_root.firstSound.start();
}
if (_root.code_mc.game_p2score == 10) {
_root.firstSound.attachSound("lose");
_root.firstSound.start();
}
}
function MoveTheBall() {
if (_root.code_mc.ball_inPlay == true) {
if (_root.code_mc.ball_OutBounds == false) {
_root.ball_mc._x = _root.ball_mc._x + (_root.code_mc.ball_speed * _root.code_mc.ball_direction);
_root.ball_mc._y = _root.ball_mc._y + (_root.code_mc.ball_vSpeed * _root.code_mc.ball_vDirection);
}
}
}
_root.firstSound = new Sound();
ball_inPlay = false;
ball_direction = -1;
ball_speed = 10;
ball_vSpeed = 0;
ball_vDirection = -1;
ball_OutBounds = false;
ball_vSpeed0 = 0;
ball_vSpeed1 = 3;
ball_vSpeed2 = 6;
ball_vSpeed3 = 9;
game_title = false;
game_p1score = 0;
game_p2score = 0;
game_hasStarted = false;
}
onClipEvent (enterFrame) {
MoveTheBall();
}
Symbol 24 MovieClip Frame 1
stop();
Symbol 24 MovieClip Frame 34
_root.impact2_mc._x = -50;
_root.impact2_mc._y = -200;
Symbol 27 MovieClip Frame 1
stop();
Symbol 29 MovieClip Frame 1
stop();
Symbol 29 MovieClip Frame 62
stop();
Symbol 33 Button
on (release) {
if ((_root.code_mc.game_p1score == 10) || (_root.code_mc.game_p2score == 10)) {
_root.code_mc.game_p1score = 0;
_root.code_mc.game_p2score = 0;
_root.code_mc.game_hasStarted = false;
}
if (((_root.code_mc.game_p1score == 0) && (_root.code_mc.game_p2score == 0)) && (_root.code_mc.game_hasStarted == false)) {
_root.code_mc.game_hasStarted = true;
_root.firstSound.attachSound("gamestart");
_root.firstSound.start();
}
if ((_root.code_mc.ball_inPlay == false) && (_root.code_mc.game_hasStarted == true)) {
_root.timer_mc.play();
}
}
Symbol 36 MovieClip Frame 1
stop();
Symbol 36 MovieClip Frame 90
_root.code_mc.ball_inPlay = true;
gotoAndStop (1);