Frame 121
gotoAndStop ("instructions");
function spawnball(linkname, xp, yp) {
duplicateMovieClip ("objectnull", "obj" + objcount, 1000 + objcount);
_root["obj" + objcount].attachMovie(linkname, "att", 1);
objcount++;
return(objcount - 1);
}
function initobject(id, xp, yp) {
_root["obj" + id].pos[0] = xp;
_root["obj" + id].pos[1] = yp;
trace("yup");
}
function initgame() {
trace("initgame");
objcount = 0;
_root.score = 0;
_root.spawnball("entball_link");
_global.ent = _root.obj0;
_root.spawnball("killball_link");
_root.spawnball("spawnerball_link");
_global.spawner = _root.obj2;
}
function removeballs() {
var _local2 = 0;
while (_local2 < objcount) {
removeMovieClip(_root["obj" + _local2]);
_local2++;
}
trace("removeBalls");
objcount = 0;
}
function gameover() {
removeballs();
_root.lastscore = _root.score;
if (_root.score > _root.bestscore) {
_root.bestscore = score;
}
_root.newgame();
}
function newgame() {
trace("newgame");
initgame();
_root.gotoAndPlay("lp");
}
_global.ball_init_radius = 8;
_global.ball_init_speed = 1.7;
_global.killball_grow_speed = 0.001;
_global.turn_angle = 0.1;
_global.spawn_frequency = 250;
_global.zoomball_mod_amount = 4;
_global.slowball_mod_amount = 4;
_global.mod_fade_rate = 50;
_global.sizeball_mod_amount = 2;
_global.speedball_amount = 0.1;
_global.ENTBALL = 0;
_global.KILLBALL = 1;
_global.SPAWNERBALL = 2;
_global.ZOOMBALL = 3;
_global.SLOWBALL = 4;
_global.POWERUP_SHIELD = 100;
_global.POWERUP_TELEPORT = 101;
_global.objcount = 0;
_root.bestscore = new Number(0);
_root.lastscore = new Number(0);
_root.score = new Number(0);
var _root.score_readout:Object = "score:";
var _root.lastscore_readout:Object = "last score:";
var _root.bestscore_readout:Object = "best score:";
var _root.menutoggle:Boolean = false;
Instance of Symbol 3 MovieClip "objectnull" in Frame 121
onClipEvent (load) {
function ballbehaviour() {
pos[0] = pos[0] + (vel[0] * (speed * speedmod));
pos[1] = pos[1] + (vel[1] * (speed * speedmod));
boundarycollision();
projecttoworld();
}
function boundarycollision() {
if (pos[0] < radius) {
pos[0] = radius;
vel[0] = -vel[0];
}
if (pos[0] > (_root.world._width - radius)) {
pos[0] = _root.world._width - radius;
vel[0] = -vel[0];
}
if (pos[1] < radius) {
pos[1] = radius;
vel[1] = -vel[1];
}
if (pos[1] > (_root.world._height - radius)) {
pos[1] = _root.world._height - radius;
vel[1] = -vel[1];
}
}
function projecttoworld() {
_x = (pos[0] + _root.world._x);
_y = (pos[1] + _root.world._y);
}
function ballcollision(other) {
var _local1 = new Array();
var _local3 = new Number();
var _local2 = new Boolean();
_local2 = false;
_local1[0] = pos[0] - other.pos[0];
_local1[1] = pos[1] - other.pos[1];
_local3 = Math.sqrt(Math.abs(_local1[0] * _local1[0]) + Math.abs(_local1[1] * _local1[1]));
var _local5 = radius + other.radius;
if (_local3 < _local5) {
_local2 = true;
}
return(_local2);
}
function respawn() {
var _local2 = Math.random();
if (_local2 < 0.5) {
pos[0] = (Math.random() * (_root.world._width - (radius * 2))) + radius;
pos[1] = 0;
} else {
pos[0] = 0;
pos[1] = (Math.random() * (_root.world._height - (radius * 2))) + radius;
}
}
var pos = new Array();
var speed = new Number();
speed = ball_init_speed;
var speedmod = new Number();
speedmod = 1;
pos[0] = _root.world._x + (_root.world._width / 2);
pos[1] = _root.world._y + (_root.world._height / 2);
var bearing = new Number();
bearing = Math.random() * 60;
vel = new Array();
vel[0] = Math.sin(bearing) * speed;
vel[1] = Math.cos(bearing) * speed;
var radius = new Number();
radius = ball_init_radius;
}
Instance of Symbol 3 MovieClip in Frame 121
onClipEvent (load) {
_root.initgame();
}
onClipEvent (enterFrame) {
_root.score_readout = "score: " + _root.score;
_root.bestscore_readout = "best score: " + _root.bestscore;
_root.lastscore_readout = "last score: " + _root.lastscore;
}
Frame 125
gotoAndPlay ("lp");
Instance of Symbol 3 MovieClip in Symbol 4 MovieClip [sizeball_link] Frame 1
onClipEvent (load) {
function update() {
if (pp.ballcollision(ent)) {
pp.respawn();
ent.radius = ent.radius + 1;
ent._width = ent.radius * sizeball_mod_amount;
ent._height = ent.radius * sizeball_mod_amount;
}
pp.ballbehaviour();
}
pp = _parent._parent;
ent = _root.obj0;
var age = new Number();
age = 0;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
pp.speed = Math.random() * ball_init_speed;
pp.pos[0] = spawner.pos[0];
pp.pos[1] = spawner.pos[1];
}
onClipEvent (enterFrame) {
update();
}
Instance of Symbol 3 MovieClip in Symbol 7 MovieClip [slowball_link] Frame 1
onClipEvent (load) {
function update() {
if (pp.ballcollision(ent)) {
pp.respawn();
ent.speedmod = ent.speedmod - slowball_mod_amount;
if (ent.speedmod < 0) {
ent.speedmod = 0;
}
}
pp.ballbehaviour();
}
pp = _parent._parent;
ent = _root.obj0;
var age = new Number();
age = 0;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
pp.speed = Math.random() * ball_init_speed;
pp.pos[0] = spawner.pos[0];
pp.pos[1] = spawner.pos[1];
}
onClipEvent (enterFrame) {
update();
}
Instance of Symbol 3 MovieClip in Symbol 10 MovieClip [speedball_link] Frame 1
onClipEvent (load) {
function update() {
if (pp.ballcollision(ent)) {
pp.respawn();
ent.speed = ent.speed + speedball_amount;
}
pp.ballbehaviour();
}
pp = _parent._parent;
ent = _root.obj0;
var age = new Number();
age = 0;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
pp.speed = Math.random() * ball_init_speed;
pp.pos[0] = spawner.pos[0];
pp.pos[1] = spawner.pos[1];
}
onClipEvent (enterFrame) {
update();
}
Instance of Symbol 3 MovieClip in Symbol 13 MovieClip [zoomball_link] Frame 1
onClipEvent (load) {
function update() {
if (pp.ballcollision(ent)) {
pp.respawn();
ent.speedmod = ent.speedmod + zoomball_mod_amount;
}
pp.ballbehaviour();
}
pp = _parent._parent;
ent = _root.obj0;
var age = new Number();
age = 0;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
pp.speed = Math.random() * ball_init_speed;
pp.pos[0] = spawner.pos[0];
pp.pos[1] = spawner.pos[1];
}
onClipEvent (enterFrame) {
update();
}
Instance of Symbol 3 MovieClip in Symbol 16 MovieClip [killball_link] Frame 1
onClipEvent (load) {
function update() {
if (pp.ballcollision(ent)) {
_root.gameover();
}
pp.ballbehaviour();
grow();
}
function grow() {
pp.radius = pp.radius + killball_grow_speed;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
}
pp = _parent._parent;
ent = _root.obj0;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
pp.pos[0] = 10;
pp.pos[1] = 10;
}
onClipEvent (enterFrame) {
update();
}
Instance of Symbol 3 MovieClip "codenull" in Symbol 19 MovieClip [entball_link] Frame 1
onClipEvent (load) {
function update() {
pp.ballbehaviour();
keypresses();
pp.speedmod = pp.speedmod - ((pp.speedmod - pp.speed) / mod_fade_rate);
}
function keypresses() {
if (Key.isDown(39)) {
pp.bearing = Math.atan2(pp.vel[0], pp.vel[1]);
pp.bearing = pp.bearing - turn_angle;
pp.vel[0] = Math.sin(pp.bearing) * pp.speed;
pp.vel[1] = Math.cos(pp.bearing) * pp.speed;
}
if (Key.isDown(37)) {
pp.bearing = Math.atan2(pp.vel[0], pp.vel[1]);
pp.bearing = pp.bearing + turn_angle;
pp.vel[0] = Math.sin(pp.bearing) * pp.speed;
pp.vel[1] = Math.cos(pp.bearing) * pp.speed;
}
}
pp = _parent._parent;
var speedmod = new Number();
speedmod = 0;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
}
onClipEvent (enterFrame) {
update();
}
Instance of Symbol 3 MovieClip in Symbol 22 MovieClip [spawnerball_link] Frame 1
onClipEvent (load) {
function update() {
if (pp.ballcollision(ent)) {
pp.respawn();
pp.speed = Math.random() * ball_init_speed;
_root.score++;
age = 0;
}
age++;
if (age > spawn_frequency) {
var _local2 = random(4);
if (_local2 == 0) {
_root.spawnball("zoomball_link", pp.pos[0], pp.pos[1]);
}
if (_local2 == 1) {
_root.spawnball("sizeball_link", pp.pos[0], pp.pos[1]);
}
if (_local2 == 2) {
_root.spawnball("slowball_link", pp.pos[0], pp.pos[1]);
}
if (_local2 == 3) {
_root.spawnball("speedball_link", pp.pos[0], pp.pos[1]);
}
age = 0;
}
pp.ballbehaviour();
}
pp = _parent._parent;
var age = new Number();
age = 0;
pp._width = pp.radius * 2;
pp._height = pp.radius * 2;
pp.respawn();
pp.pos[0] = Math.sin(pp.bearing) * pp.speed;
pp.pos[1] = Math.cos(pp.bearing) * pp.speed;
pp.speed = Math.random() * ball_init_speed;
}
onClipEvent (enterFrame) {
update();
}
Symbol 33 Button
on (press) {
getURL ("http://www.albinoblacksheep.com", "_blank");
}
Symbol 34 Button
on (press) {
getURL ("http://www.papermothgames.com", "_blank");
}
Symbol 48 MovieClip Frame 120
stop();
Symbol 59 Button
on (press) {
_root.menutoggle = !_root.menutoggle;
if (_root.menutoggle) {
_root.newgame();
} else {
_root.gotoAndStop("instructions");
_root.removeballs();
}
}