Frame 1
loadedbytes = getBytesLoaded();
totalbytes = getBytesTotal();
percentbytes = int(loadedbytes / (totalbytes / 100));
tellTarget (_root.loader) {
gotoAndStop(_root.percentbytes);
};
Frame 2
if (loadedbytes == totalbytes) {
gotoAndStop (3);
} else {
gotoAndPlay (1);
}
Frame 3
function itemHandler(obj, item) {
getURL ("http://www.xenwars.com", "_blank");
}
root_cm = new ContextMenu();
root_cm.hideBuiltInItems();
root_cm.customItems.push(new ContextMenuItem("Xenwars", itemHandler));
_root.menu = root_cm;
storage = SharedObject.getLocal("store");
level = storage.data.uptolevel;
yourhigh = storage.data.myhighscore;
hp = storage.data.myhp;
used = storage.data.myused;
unused = storage.data.myunused;
str = storage.data.mystr;
points = storage.data.mypoints;
defence = storage.data.mydef;
if (level == undefined) {
storage.data.uptolevel = 1;
level = 1;
}
if (yourhigh == undefined) {
storage.data.myhighscore = 0;
yourhigh = 0;
}
if (hp == undefined) {
storage.data.myhp = 100;
hp = 100;
}
if (used == undefined) {
storage.data.myused = 0;
used = 0;
}
if (unused == undefined) {
storage.data.myunused = 0;
unused = 0;
}
if (str == undefined) {
storage.data.mystr = 20;
str = 20;
}
if (points == undefined) {
storage.data.mypoints = 0;
points = 0;
}
if (defence == undefined) {
storage.data.mydef = 0;
defence = 0;
}
_root.lastlevel = storage.data.uptolevel;
_root.highest = storage.data.myhighscore;
_root.lasthpleft = storage.data.myhp;
_root.lastpoints = storage.data.mypoints;
_root.lastunused = storage.data.myunused;
_root.laststr = storage.data.mystr;
_root.lastused = storage.data.myused;
_root.lastdef = storage.data.mydef;
stop();
Frame 4
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 20;
ball2.vx = -5;
ball2.vy = -3;
ball2.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= _root.dist) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > _root.dist) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 4
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 5
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 20;
ball2.vx = -5;
ball2.vy = -3;
ball2.move();
ball3.mass = 10;
ball3.vx = -1;
ball3.vy = -1;
ball3.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 5
onClipEvent (enterFrame) {
if (_root.invin == 0) {
_root.ball;
if (hitTest(_root.ball3)) {
defs = _root.defence / 20;
dmglol = 1 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 6
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 113) {
this._x = 113;
this.vx = -this.vx;
} else if (this._x > 402) {
this._x = 402;
this.vx = -this.vx;
}
if (this._y < 160) {
this._y = 160;
this.vy = -this.vy;
} else if (this._y > 290) {
this._y = 290;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 20;
ball2.vx = -5;
ball2.vy = -3;
ball2.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 113) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 402) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 160) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 290) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 6
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.ball3)) {
_root.hp = _root.hp - 1;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 7
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 10;
ball2.vx = -7;
ball2.vy = -7;
ball2.move();
ball3.mass = 10;
ball3.vx = 10;
ball3.vy = 10;
ball3.move();
ball4.mass = 10;
ball4.vx = 7;
ball4.vy = 7;
ball4.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 7
onClipEvent (enterFrame) {
if (_root.invin == 0) {
_root.ball;
if (hitTest(_root.ball3)) {
defs = _root.defence / 10;
dmglol = 1 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
_root.ball;
if (hitTest(_root.ball4)) {
defs = _root.defence / 10;
dmglol = 1 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 8
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
_root.enemyhp = 0;
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 50;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 40) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 10;
thehp = Math.floor((40 * speed) / 50);
_root.enemyhp = _root.enemyhp + thehp;
if (_root.enemyhp > 100) {
_root.enemyhp = 100;
}
enemyhealth.gotoAndStop(_root.enemyhp);
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 8
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.ball3)) {
_root.hp = _root.hp - 1;
if (_root.hp < 1) {
this.gotoAndPlay(2);
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
}
Frame 9
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
} else if ((((this._x < 390) && (this._x > 370)) && (this._y > 150)) && (this._y < 300)) {
this._x = 390;
this.vx = -this.vx;
} else if ((((this._x < 160) && (this._x > 140)) && (this._y > 150)) && (this._y < 300)) {
this._x = 140;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
} else if ((((this._y < 300) && (this._y > 280)) && (this._x > 140)) && (this._x < 390)) {
this._y = 300;
this.vy = -this.vy;
} else if ((((this._y < 170) && (this._y > 150)) && (this._x > 140)) && (this._x < 390)) {
this._y = 150;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 40;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
ball3.mass = 10;
ball3.vx = -1;
ball3.vy = -1;
ball3.move();
ball4.mass = 10;
ball4.vx = -5;
ball4.vy = -5;
ball4.move();
ball5.mass = 10;
ball5.vx = -10;
ball5.vy = -10;
ball5.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if ((((ball._y < 300) && (ball._y > 280)) && (ball._x > 140)) && (ball._x < 390)) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if ((((ball._y < 170) && (ball._y > 150)) && (ball._x > 140)) && (ball._x < 390)) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if ((((ball._x < 390) && (ball._x > 370)) && (ball._y > 150)) && (ball._y < 300)) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if ((((ball._x < 160) && (ball._x > 140)) && (ball._y > 150)) && (ball._y < 300)) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp < 1) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 9
onClipEvent (enterFrame) {
if (_root.invin == 0) {
_root.ball;
if (hitTest(_root.ball3)) {
defs = _root.defence / 10;
dmglol = 1 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
_root.ball;
if (hitTest(_root.ball4)) {
defs = _root.defence / 10;
dmglol = 1 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
_root.ball;
if (hitTest(_root.ball5)) {
defs = _root.defence / 10;
dmglol = 1 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 10
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 40;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
ball4.mass = 10;
ball4.vx = -5;
ball4.vy = -5;
ball4.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 10
onClipEvent (enterFrame) {
if (_root.invin == 0) {
_root.ball;
if (hitTest(_root.ball4)) {
defs = _root.defence / 10;
dmglol = 2 - defs;
if (dmglol < 0.5) {
dmglol = 0.5;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 11
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 40;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
ball4.mass = 10;
ball4.vx = -5;
ball4.vy = -5;
ball4.move();
ball5.mass = 10;
ball5.vx = -7;
ball5.vy = -7;
ball5.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 11
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.ball5)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 5 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp < 1) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 12
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 40;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
ball5.mass = 10;
ball5.vx = -7;
ball5.vy = -7;
ball5.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 12
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.ball5)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 5 - defs;
if (dmglol < 0.25) {
dmglol = 0.25;
}
_root.hp = _root.hp - dmglol;
if (_root.hp < 1) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
_root.ball;
if (hitTest(_root.teleport)) {
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
}
}
Frame 13
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
_root.enemyhp = 0;
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 150;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 50) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 2;
thehp = Math.floor(((40 * speed) / 50) / 2);
_root.enemyhp = _root.enemyhp + thehp;
if (_root.enemyhp > 100) {
_root.enemyhp = 100;
}
enemyhealth.gotoAndStop(_root.enemyhp);
} else if (distance > 50) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 13
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
_root.ball;
if (hitTest(_root.teleport)) {
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
}
_root.ball;
if (hitTest(_root.teleport2)) {
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
}
_root.ball;
if (hitTest(_root.teleport3)) {
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
}
_root.ball;
if (hitTest(_root.teleport4)) {
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
}
}
Frame 14
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 40;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 14
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Instance of Symbol 258 MovieClip "mine6" in Frame 14
onClipEvent (enterFrame) {
_root.mine6;
if (hitTest(_root.ball)) {
explosion = new Sound();
explosion.attachSound("explosion1");
_root.explosion.start();
this.gotoAndPlay(41);
}
}
Instance of Symbol 258 MovieClip "mine3" in Frame 14
onClipEvent (enterFrame) {
_root.mine3;
if (hitTest(_root.ball)) {
explosion = new Sound();
explosion.attachSound("explosion1");
_root.explosion.start();
this.gotoAndPlay(41);
}
}
Instance of Symbol 258 MovieClip "mine2" in Frame 14
onClipEvent (enterFrame) {
_root.mine2;
if (hitTest(_root.ball)) {
_root.explosion = new Sound();
_root.explosion.attachSound("explosion1");
_root.explosion.start();
this.gotoAndPlay(41);
}
}
Instance of Symbol 258 MovieClip "mine1" in Frame 14
onClipEvent (enterFrame) {
_root.mine1;
if (hitTest(_root.ball)) {
explosion = new Sound();
explosion.attachSound("explosion1");
_root.explosion.start();
this.gotoAndPlay(41);
}
}
Instance of Symbol 258 MovieClip "mine4" in Frame 14
onClipEvent (enterFrame) {
_root.mine4;
if (hitTest(_root.ball)) {
explosion = new Sound();
explosion.attachSound("explosion1");
_root.explosion.start();
this.gotoAndPlay(41);
}
}
Frame 15
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 205) {
this._y = 205;
this.vy = -this.vy;
} else if (this._y > 250) {
this._y = 250;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -5;
ball.vy = 0;
ball.move();
ball2.mass = 100;
ball2.vx = -5;
ball2.vy = -3;
ball2.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 205) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 250) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 15
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 16
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 40;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
ball5.mass = 10;
ball5.vx = -7;
ball5.vy = -7;
ball5.move();
ball4.mass = 10;
ball4.vx = -5;
ball4.vy = -5;
ball4.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 16
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.ball5)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 2 - defs;
if (dmglol < 0.5) {
dmglol = 0.5;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.ball4)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 2 - defs;
if (dmglol < 0.5) {
dmglol = 0.5;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
_root.ball;
if (hitTest(_root.teleport)) {
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
}
}
Frame 17
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 40;
ball2.vx = -10;
ball2.vy = -6;
ball2.move();
ball5.mass = 10;
ball5.vx = -15;
ball5.vy = -15;
ball5.move();
ball4.mass = 10;
ball4.vx = -3;
ball4.vy = -10;
ball4.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 17
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.ball5)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 5 - defs;
if (dmglol < 0.5) {
dmglol = 0.5;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.ball4)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 5 - defs;
if (dmglol < 0.5) {
dmglol = 0.5;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 18
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
_root.enemyhp = 0;
_root.onedecoy = 0;
_root.twodecoy = 0;
MovieClip.prototype.move = function () {
this.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 40) {
this._y = 40;
this.vy = -this.vy;
} else if (this._y > 410) {
this._y = 410;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
ball.mass = _root.str;
ball.vx = -3;
ball.vy = 6;
ball.move();
ball2.mass = 100;
ball2.vx = -5;
ball2.vy = -6;
ball2.move();
coll = 0;
_root.onEnterFrame = function () {
if (_root.invin == 0) {
speed = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
dmg = Math.floor((40 * speed) / 50) - (_root.defence / 10);
if (dmg < 0) {
dmg = 0;
}
if (ball._x < 0) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._x > 520) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y < 40) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (ball._y > 410) {
hitwall = 1;
_root.hp = _root.hp - dmg;
if (_root.hp <= 0) {
ball.gotoAndPlay(2);
}
}
if (hitwall == 1) {
hit = new Sound();
blah = Math.round(Math.random() * 3);
if (blah == 1) {
thesound = "hit1";
}
if (blah == 3) {
thesound = "hit2";
}
if (blah == 2) {
thesound = "hit3";
}
hit.attachSound(thesound);
_root.hit.start();
hitwall = 0;
}
}
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
hitd = new Sound();
hitd.attachSound("hitother");
_root.hitd.start();
_root.points = _root.points + 5;
thehp = Math.floor(((40 * speed) / 50) / 2);
_root.enemyhp = _root.enemyhp + thehp;
if (_root.enemyhp > 100) {
_root.enemyhp = 100;
}
enemyhealth.gotoAndStop(_root.enemyhp);
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
if (_root.points > yourhigh) {
yourhigh = _root.points;
storage.data.myhighscore = _root.points;
}
storage.data.uptolevel = _root.level;
storage.data.myhp = _root.hp;
storage.data.mypoints = _root.points;
storage.data.myunused = _root.unused;
storage.data.mystr = _root.str;
storage.data.myused = _root.used;
storage.data.mydef = _root.defence;
stop();
Instance of Symbol 17 MovieClip [ball] "ball" in Frame 18
onClipEvent (enterFrame) {
_root.ball;
if (hitTest(_root.dc1)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 2 - defs;
if (dmglol < 0.5) {
dmglol = 0.5;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.dc2)) {
if (_root.invin == 0) {
defs = _root.defence / 10;
dmglol = 2 - defs;
if (dmglol < 0.5) {
dmglol = 0.5;
}
_root.hp = _root.hp - dmglol;
if (_root.hp <= 0) {
this.gotoAndPlay(2);
}
}
}
_root.ball;
if (hitTest(_root.pwrup1)) {
_root.gotitem1 = new Sound();
_root.gotitem1.attachSound("item1and2");
_root.gotitem1.start();
removeMovieClip(_root.pwrup1);
_root.hp = _root.hp + 10;
_root.points = _root.points + 10;
}
_root.ball;
if (hitTest(_root.pwrup2)) {
_root.gotitem2 = new Sound();
_root.gotitem2.attachSound("item1and2");
_root.gotitem2.start();
removeMovieClip(_root.pwrup2);
_root.hp = _root.hp + 20;
_root.points = _root.points + 20;
}
_root.ball;
if (hitTest(_root.pwrup3)) {
_root.gotitem3 = new Sound();
_root.gotitem3.attachSound("item3");
_root.gotitem3.start();
removeMovieClip(_root.pwrup3);
_root.points = _root.points + 30;
_root.invin = 1;
this.gotoAndPlay(45);
}
}
Frame 19
removeMovieClip(_root.pwrup1);
removeMovieClip(_root.pwrup2);
removeMovieClip(_root.pwrup3);
removeMovieClip(_root.dc1);
removeMovieClip(_root.dc2);
stop();
Frame 20
removeMovieClip(_root.pwrup1);
removeMovieClip(_root.pwrup2);
removeMovieClip(_root.pwrup3);
removeMovieClip(_root.dc1);
removeMovieClip(_root.dc2);
stop();
Frame 21
if (_root.invin == 1) {
_root.invin = 0;
}
if (_root.hp <= 0) {
_level0.gotoAndStop(19);
}
Frame 40
_root.level = _root.level + 1;
_root.points = _root.points + 50;
if (((_root.points > 99) && (_root.used < 1)) && (_root.unused < 1)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 199) && (_root.used < 2)) && (_root.unused < 2)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 299) && (_root.used < 3)) && (_root.unused < 3)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 399) && (_root.used < 4)) && (_root.unused < 4)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 499) && (_root.used < 5)) && (_root.unused < 5)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 599) && (_root.used < 6)) && (_root.unused < 6)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 699) && (_root.used < 7)) && (_root.unused < 7)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 799) && (_root.used < 8)) && (_root.unused < 8)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 899) && (_root.used < 9)) && (_root.unused < 9)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 999) && (_root.used < 10)) && (_root.unused < 10)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1099) && (_root.used < 11)) && (_root.unused < 11)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1199) && (_root.used < 12)) && (_root.unused < 12)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1299) && (_root.used < 13)) && (_root.unused < 13)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1399) && (_root.used < 14)) && (_root.unused < 14)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1499) && (_root.used < 15)) && (_root.unused < 15)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1599) && (_root.used < 16)) && (_root.unused < 16)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1699) && (_root.used < 17)) && (_root.unused < 17)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1799) && (_root.used < 18)) && (_root.unused < 18)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1899) && (_root.used < 19)) && (_root.unused < 19)) {
_root.unused = _root.unused + 1;
}
if (((_root.points > 1999) && (_root.used < 20)) && (_root.unused < 20)) {
_root.unused = _root.unused + 1;
}
stop();
Symbol 12 MovieClip [notothis1] Frame 40
num = Math.floor(Math.random() * 3);
if (num == 1) {
gotoAndPlay (41);
} else {
gotoAndPlay (1);
}
Symbol 12 MovieClip [notothis1] Frame 51
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
Symbol 12 MovieClip [notothis1] Frame 61
gotoAndPlay (1);
Symbol 13 MovieClip [decoy1] Frame 40
num = Math.floor(Math.random() * 3);
if (num == 1) {
gotoAndPlay (41);
} else if (num > 1) {
gotoAndPlay (1);
}
num2 = Math.floor(Math.random() * 10);
if (num2 == 1) {
if (_root.twodecoy == 0) {
gotoAndPlay (62);
} else if (_root.twodecoy == 1) {
gotoAndPlay (1);
} else if (num2 > 1) {
gotoAndPlay (1);
}
}
Symbol 13 MovieClip [decoy1] Frame 51
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
Symbol 13 MovieClip [decoy1] Frame 61
gotoAndPlay (1);
Symbol 13 MovieClip [decoy1] Frame 62
_root.twodecoy = 1;
_root.attachMovie("notothis1", "dc2", 2);
num3 = Math.floor(Math.random() * 550);
num41 = Math.floor(Math.random() * 400);
num42 = num41 + 40;
_root.dc2._x = num3;
_root.dc2._y = num42;
_root.dc2.mass = 10;
_root.dc2.vx = 5;
_root.dc2.vy = 5;
_root.dc2.move();
gotoAndPlay (1);
Symbol 17 MovieClip [ball] Frame 1
#initclip 5
Object.registerClass("ball", Ball);
#endinitclip
stop();
Symbol 17 MovieClip [ball] Frame 2
_level0.gotoAndStop(20);
Symbol 17 MovieClip [ball] Frame 40
_level0.gotoAndStop(15);
Symbol 17 MovieClip [ball] Frame 45
_root.dist = 55;
timeD = new MyTimer(3);
timeD.start();
if (this.D.hasPassed()) {
_root.invin = 0;
_root.dist = 30;
this.gotoAndPlay(1);
}
Symbol 17 MovieClip [ball] Frame 46
gotoAndPlay (45);
Symbol 19 MovieClip [ball2] Frame 1
#initclip 3
Object.registerClass("ball2", Ball);
#endinitclip
Symbol 20 MovieClip [level1] Frame 1
function findAnAngle(xthing, ything) {
term = (Math.PI/180);
if (xthing < 0) {
t = 180 + (Math.atan(ything / xthing) / term);
} else if ((xthing > 0) && (ything >= 0)) {
t = Math.atan(ything / xthing) / term;
} else if ((xthing > 0) && (ything < 0)) {
t = 360 + (Math.atan(ything / xthing) / term);
} else if ((xthing == 0) && (ything == 0)) {
t = 0;
} else if ((xthing == 0) && (ything >= 0)) {
t = 90;
} else {
t = 270;
}
return(t);
}
function doCollision(ball, ball2) {
dx = ball._x - ball2._x;
dy = ball._y - ball2._y;
phi = Math.atan(dy / dx);
term = (Math.PI/180);
v1i = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
v2i = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
ang1 = findAnAngle(ball.vx, ball.vy) * term;
ang2 = findAnAngle(ball2.vx, ball2.vy) * term;
v1xr = v1i * Math.cos(ang1 - phi);
v1yr = v1i * Math.sin(ang1 - phi);
v2xr = v2i * Math.cos(ang2 - phi);
v2yr = v2i * Math.sin(ang2 - phi);
v1fxr = (((ball.mass - ball2.mass) * v1xr) + ((ball2.mass + ball2.mass) * v2xr)) / (ball.mass + ball2.mass);
v2fxr = (((ball.mass + ball.mass) * v1xr) + ((ball2.mass - ball.mass) * v2xr)) / (ball.mass + ball2.mass);
v1fyr = v1yr;
v2fyr = v2yr;
_root.ball.vx = (Math.cos(phi) * v1fxr) + (Math.cos(phi + (Math.PI/2)) * v1fyr);
_root.ball.vy = (Math.sin(phi) * v1fxr) + (Math.sin(phi + (Math.PI/2)) * v1fyr);
_root.ball2.vx = (Math.cos(phi) * v2fxr) + (Math.cos(phi + (Math.PI/2)) * v2fyr);
_root.ball2.vy = (Math.sin(phi) * v2fxr) + (Math.sin(phi + (Math.PI/2)) * v2fyr);
}
MovieClip.prototype.move = function () {
_root.onEnterFrame = function () {
if (this._x < 0) {
this._x = 0;
this.vx = -this.vx;
} else if (this._x > 520) {
this._x = 520;
this.vx = -this.vx;
}
if (this._y < 0) {
this._y = 0;
this.vy = -this.vy;
} else if (this._y > 370) {
this._y = 370;
this.vy = -this.vy;
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
};
};
_root.onLoad = function () {
ball.mass = 20;
ball.vx = 3;
ball.vy = 6;
ball.move();
ball2.mass = 5;
ball2.vx = -5;
ball2.vy = -3;
ball2.move();
coll = 0;
};
_root.onEnterFrame = function () {
distance_x = Math.abs(ball._x - ball2._x);
distance_y = Math.abs(ball._y - ball2._y);
distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
if ((distance <= 30) && (coll == 0)) {
coll = 1;
doCollision(ball, ball2);
} else if (distance > 30) {
coll = 0;
}
if (Key.isDown(39) && (ball.vx < 10)) {
ball.vx = ball.vx + 0.5;
}
if (Key.isDown(37) && (ball.vx > -10)) {
ball.vx = ball.vx - 0.5;
}
if (Key.isDown(38) && (ball.vy > -10)) {
ball.vy = ball.vy - 0.5;
}
if (Key.isDown(40) && (ball.vy < 10)) {
ball.vy = ball.vy + 0.5;
}
};
Symbol 29 Button
on (release) {
removeMovieClip(_root.credz);
}
Symbol 52 Button
on (release) {
removeMovieClip(_root.inst);
}
Symbol 55 Button
on (release) {
this.gotoAndStop(2);
}
Symbol 58 Button
on (release) {
this.gotoAndStop(1);
}
Symbol 61 Button
on (release) {
this.gotoAndStop(3);
}
Symbol 67 MovieClip [instructions] Frame 1
stop();
Symbol 67 MovieClip [instructions] Frame 2
stop();
Symbol 67 MovieClip [instructions] Frame 3
stop();
Symbol 71 MovieClip [enemy1] Frame 1
#initclip 4
Object.registerClass("enemy1", Ball);
#endinitclip
Symbol 336 MovieClip [__Packages.MyTimer] Frame 0
class MyTimer
{
var time, btime;
function MyTimer (seconds) {
time = seconds * 1000;
}
function setTime(time) {
this.time = time;
}
function setTimeSeconds(time) {
this.time = time * 1000;
}
function addTime(offset) {
time = time + offset;
}
function getTime() {
return(time);
}
function start() {
btime = getTimer();
}
function hasPassed() {
return((getTimer() - btime) > time);
}
function toString() {
var _local2 = getTimer() - btime;
var _local4 = _local2 % 1000;
var _local3 = Math.floor(_local2 / 1000);
return((_local3 + "::") + _local4);
}
function timeLeft() {
return((time + btime) - getTimer());
}
function countDown() {
var _local2 = timeLeft();
var _local4 = _local2 % 1000;
var _local3 = Math.floor(_local2 / 1000);
return(_local3);
}
}
Symbol 337 MovieClip [__Packages.Ball] Frame 0
class Ball extends MovieClip
{
function Ball () {
super();
}
function findAnAngle(xthing, ything) {
var _local3 = (Math.PI/180);
if (xthing < 0) {
var _local4 = 180 + (Math.atan(ything / xthing) / _local3);
} else if ((xthing > 0) && (ything >= 0)) {
var _local4 = Math.atan(ything / xthing) / _local3;
} else if ((xthing > 0) && (ything < 0)) {
var _local4 = 360 + (Math.atan(ything / xthing) / _local3);
} else if ((xthing == 0) && (ything == 0)) {
var _local4 = 0;
} else if ((xthing == 0) && (ything >= 0)) {
var _local4 = 90;
} else {
var _local4 = 270;
}
return(_local4);
}
function doCollision(ball, ball2) {
var _local20 = ball._x - ball2._x;
var _local18 = ball._y - ball2._y;
var _local4 = Math.atan(_local18 / _local20);
var _local6 = (Math.PI/180);
var _local15 = Math.sqrt((ball.vx * ball.vx) + (ball.vy * ball.vy));
var _local14 = Math.sqrt((ball2.vx * ball2.vx) + (ball2.vy * ball2.vy));
var _local13 = findAnAngle(ball.vx, ball.vy) * _local6;
var _local12 = findAnAngle(ball2.vx, ball2.vy) * _local6;
var _local10 = _local15 * Math.cos(_local13 - _local4);
var _local17 = _local15 * Math.sin(_local13 - _local4);
var _local11 = _local14 * Math.cos(_local12 - _local4);
var _local19 = _local14 * Math.sin(_local12 - _local4);
var _local9 = (((ball.mass - ball2.mass) * _local10) + ((ball2.mass + ball2.mass) * _local11)) / (ball.mass + ball2.mass);
var _local7 = (((ball.mass + ball.mass) * _local10) + ((ball2.mass - ball.mass) * _local11)) / (ball.mass + ball2.mass);
var _local8 = _local17;
var _local16 = _local19;
_root.ball.vx = (Math.cos(_local4) * _local9) + (Math.cos(_local4 + (Math.PI/2)) * _local8);
_root.ball.vy = (Math.sin(_local4) * _local9) + (Math.sin(_local4 + (Math.PI/2)) * _local8);
_root.ball2.vx = (Math.cos(_local4) * _local7) + (Math.cos(_local4 + (Math.PI/2)) * _local16);
_root.ball2.vy = (Math.sin(_local4) * _local7) + (Math.sin(_local4 + (Math.PI/2)) * _local16);
}
}
Symbol 87 Button
on (release) {
_root.attachMovie("instructions", "inst", 1);
_root.inst._x = 38;
_root.inst._y = 135;
}
Symbol 90 Button
on (release) {
_root.attachMovie("creditz", "credz", 1);
_root.credz._x = 38;
_root.credz._y = 135;
}
Symbol 93 Button
on (release) {
if (_root.lasthpleft > 30) {
_root.hp = _root.lasthpleft;
} else {
_root.hp = 30;
}
_root.level = _root.lastlevel;
_root.points = _root.lastpoints;
_root.unused = _root.lastunused;
_root.str = _root.laststr;
_root.used = _root.lastused;
_root.defence = _root.lastdef;
_root.dist = 30;
_root.invin = 0;
_level0.gotoAndPlay(_root.lastlevel + 3);
}
Symbol 96 Button
on (release) {
_root.lasthpleft = 100;
_root.lastlevel = 1;
_root.lastpoints = 0;
_root.lastunused = 0;
_root.laststr = 20;
_root.lastused = 0;
_root.lastdef = 0;
}
Symbol 101 Button
on (release) {
this.gotoAndPlay(3);
}
Symbol 105 Button
on (release) {
done = new Sound();
done.attachSound("done.wav");
_root.done.start();
this.music = "Menya Zovut Shnur";
gotoAndStop (23);
}
Symbol 108 Button
on (release) {
done = new Sound();
done.attachSound("done.wav");
_root.done.start();
this.music = "Chainsaw_09";
gotoAndStop (21);
}
Symbol 110 Button
on (release) {
done = new Sound();
done.attachSound("done.wav");
_root.done.start();
this.music = "Rock Music";
gotoAndStop (22);
}
Symbol 112 Button
on (release) {
done = new Sound();
done.attachSound("done.wav");
_root.done.start();
this.music = "None!";
gotoAndStop (24);
}
Symbol 113 Button
on (release) {
this.gotoAndPlay(2);
}
Symbol 123 MovieClip Frame 1
this.music = "None";
stop();
Symbol 123 MovieClip Frame 3
stopAllSounds();
Symbol 123 MovieClip Frame 20
stop();
Symbol 123 MovieClip Frame 21
stop();
Symbol 123 MovieClip Frame 22
stop();
Symbol 123 MovieClip Frame 23
stop();
Symbol 123 MovieClip Frame 24
stop();
Symbol 140 MovieClip Frame 1
timeCheck = new MyTimer(10);
timeCheck.start();
this.onEnterFrame = function () {
this.thetimer = this.timeCheck.countDown();
if (this.timeCheck.hasPassed()) {
removeMovieClip(_root.pwrup1);
removeMovieClip(_root.pwrup2);
removeMovieClip(_root.pwrup3);
_level0.gotoAndPlay(21);
}
if (this.thetimer == 9) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 7) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 4) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 2) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
};
Symbol 150 Button
on (release) {
_quality = "HIGH";
}
Symbol 152 Button
on (release) {
_quality = "MEDIUM";
}
Symbol 154 Button
on (release) {
_quality = "LOW";
}
Symbol 187 MovieClip Frame 1
stop();
Symbol 187 MovieClip Frame 100
removeMovieClip(_root.dc1);
removeMovieClip(_root.dc2);
_level0.gotoAndPlay(21);
Symbol 197 MovieClip Frame 70
_visible = false;
Symbol 216 MovieClip Frame 1
timeCheck = new MyTimer(20);
timeCheck.start();
this.onEnterFrame = function () {
this.thetimer = this.timeCheck.countDown();
if (this.timeCheck.hasPassed()) {
removeMovieClip(_root.pwrup1);
removeMovieClip(_root.pwrup2);
removeMovieClip(_root.pwrup3);
_level0.gotoAndPlay(21);
}
if (this.thetimer == 19) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 17) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 14) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 12) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 9) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 7) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 4) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
if (this.thetimer == 2) {
num = Math.floor(Math.random() * 100);
if (num == 1) {
nump = Math.floor(Math.random() * 10);
if (nump < 6) {
_root.attachMovie("powerup1", "pwrup1", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup1._x = num1;
_root.pwrup1._y = num22;
}
if ((nump < 9) && (nump > 5)) {
_root.attachMovie("powerup2", "pwrup2", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup2._x = num1;
_root.pwrup2._y = num22;
}
if (nump > 8) {
_root.attachMovie("powerup3", "pwrup3", 1);
num1 = Math.floor(Math.random() * 550);
num21 = Math.floor(Math.random() * 400);
num22 = num21 + 40;
_root.pwrup3._x = num1;
_root.pwrup3._y = num22;
}
}
}
};
Symbol 258 MovieClip Frame 40
gotoAndPlay (1);
Symbol 258 MovieClip Frame 46
if (_root.invin == 0) {
dmges = 20 - (_root.defence / 10);
_root.hp = dmges;
if (_root.hp <= 0) {
_root.ball.gotoAndPlay(2);
}
}
Symbol 258 MovieClip Frame 55
_visible = false;
Symbol 291 MovieClip Frame 40
num = Math.floor(Math.random() * 5);
if (num < 4) {
gotoAndPlay (41);
} else if (num == 4) {
gotoAndPlay (63);
} else if (num == 5) {
gotoAndPlay (1);
}
num2 = Math.floor(Math.random() * 10);
if (num2 == 1) {
if (_root.onedecoy == 0) {
gotoAndPlay (62);
} else if (_root.onedecoy == 1) {
gotoAndPlay (1);
} else if (num2 > 1) {
gotoAndPlay (1);
}
}
Symbol 291 MovieClip Frame 51
num1 = Math.floor(Math.random() * 550);
num2 = Math.floor(Math.random() * 440);
if (num1 > 500) {
num1 = 500;
}
if (num1 < 50) {
num1 = 50;
}
if (num2 > 400) {
num2 = 400;
}
if (num2 < 80) {
num2 = 80;
}
this._x = num1;
this._y = num2;
Symbol 291 MovieClip Frame 61
gotoAndPlay (1);
Symbol 291 MovieClip Frame 62
_root.onedecoy = 1;
_root.attachMovie("decoy1", "dc1", 1);
num5 = Math.floor(Math.random() * 550);
num61 = Math.floor(Math.random() * 400);
num62 = num61 + 40;
_root.dc1._x = num5;
_root.dc1._y = num62;
_root.dc1.mass = 10;
_root.dc1.vx = 5;
_root.dc1.vy = 5;
_root.dc1.move();
gotoAndPlay (1);
Symbol 291 MovieClip Frame 73
if (_root.ball.vx < 0) {
num1 = _root.ball._x + 30;
num2 = _root.ball._y;
} else if (_root.ball.vx > 0) {
num1 = _root.ball._x - 30;
num2 = _root.ball._y;
}
this._x = num1;
this._y = num2;
if (_root.ball.vx < 0) {
this.vx = -15;
} else if (_root.ball.vx > 0) {
this.vx = 15;
}
Symbol 291 MovieClip Frame 83
gotoAndPlay (1);
Symbol 298 Button
on (release) {
_level0.gotoAndStop(3);
}
Symbol 316 Button
on (release) {
_level0.gotoAndPlay(_root.level + 3);
}
Symbol 327 Button
on (release) {
if (_root.unused > 0) {
_root.str = _root.str + 5;
_root.used = _root.used + 1;
_root.unused = _root.unused - 1;
}
}
Symbol 328 Button
on (release) {
if (_root.unused > 0) {
_root.hp = _root.hp + 50;
_root.used = _root.used + 1;
_root.unused = _root.unused - 1;
}
}
Symbol 331 Button
on (release) {
if ((_root.unused > 0) && (_root.defence < 30)) {
_root.defence = _root.defence + 5;
_root.used = _root.used + 1;
_root.unused = _root.unused - 1;
}
}