Frame 10
function getmushroom() {
i = 1000;
while (i <= 1050) {
if (_root["bullet" + _root.bulletask].hitTest(_root.mushrooms["mr" + i])) {
_root.mushrooms["mr" + i].life = _root.mushrooms["mr" + i].life - 1;
_root.score = _root.score - 1;
_root.mushrooms["mr" + i].gotoAndStop(_root.mushrooms["mr" + i].life + 2);
if (_root.mushrooms["mr" + i].life < 0) {
_root.mrdie.start();
_root.mushroomsleft--;
_root.score = _root.score - 50;
_root.mushrooms["mr" + i].removeMovieClip();
}
_root["bullet" + _root.bulletask].removeMovieClip();
}
i++;
}
}
function getbug() {
i = 2000;
while (i <= 2050) {
if (_root["bullet" + _root.bulletask].hitTest(_root.enemies["enemy" + i])) {
trace("HIT BUG " + i);
_root.enemies["enemy" + i].removeMovieClip();
_root.killbug.start();
_root.death._x = _root["bullet" + _root.bulletask]._x;
_root.death._y = _root["bullet" + _root.bulletask]._y;
_root["bullet" + _root.bulletask].removeMovieClip();
_root.death.gotoAndPlay(2);
_root.score = _root.score + 100;
break;
}
i++;
}
}
function removemr() {
trace("Hit by no. " + _root.enemynumber);
mr = 1000;
while (mr <= 1050) {
if (_root.enemies["enemy" + _root.enemynumber].hitTest(_root.mushrooms["mr" + mr])) {
_root.mushrooms["mr" + mr].removeMovieClip();
_root.eat.start();
_root.mushroomsleft--;
break;
}
mr++;
}
}
function createenemy() {
_root.enemycount++;
trace(enemycount);
if ((_root.enemycount > 2025) && (_root.enemylevel > 6)) {
_root.enemylevel = _root.enemylevel - 5;
_root.lu.gotoAndPlay(2);
trace("level up");
_root.enemycount = 2000;
}
side = random(4) + 1;
xspeed = 0;
yspeed = 0;
if (side == 1) {
x = 56 + (random(23) * 20);
y = 0;
yspeed = 2;
rot = 0;
}
if (side == 2) {
x = 570;
y = 40 + (random(17) * 20);
xspeed = -2;
rot = 90;
}
if (side == 3) {
x = 56 + (random(23) * 20);
y = 440;
yspeed = -2;
rot = 180;
}
if (side == 4) {
x = 0;
y = 40 + (random(17) * 20);
xspeed = 2;
rot = 270;
}
_root.enemies.e_master.duplicateMovieClip(["enemy" + _root.enemycount], _root.enemycount, {_x:x, _y:y});
_root.enemies["enemy" + _root.enemycount].xspeed = xspeed;
_root.enemies["enemy" + _root.enemycount].yspeed = yspeed;
_root.enemies["enemy" + _root.enemycount]._rotation = rot;
_root.enemies["enemy" + _root.enemycount].enemyid = _root.enemycount;
_root.enemies["enemy" + _root.enemycount].image.gotoAndStop(1 + random(3));
}
enemycount = 2000;
score = 0;
mushroomsleft = 0;
shoot = new Sound();
shoot.attachSound("shoot2");
mrdie = new Sound();
mrdie.attachSound("mushroomdie");
eat = new Sound();
eat.attachSound("eat");
killbug = new Sound();
killbug.attachSound("killbug");
stop();
Instance of Symbol 16 MovieClip "control" in Frame 10
onClipEvent (enterFrame) {
r = random(10);
if (r == 1) {
_root.createenemy();
}
}
Frame 25
grid = new Array();
mr = 1000;
score = 0;
enemycount = 2000;
enemylevel = 100;
mushroomsleft = 0;
do {
rx = random(23) * 20;
ry = random(17) * 20;
gg = (ry * 17) + rx;
if (grid[gg] != 1) {
trace(grid[gg]);
grid[gg] = 1;
trace(grid[gg]);
_root.mushroomsleft++;
mr++;
_root.mushrooms.m_mast.duplicateMovieClip(["mr" + mr], mr, {_x:rx, _y:ry});
_root.mushrooms["mr" + mr].life = 10;
}
} while (mushroomsleft < 50);
stop();
Instance of Symbol 16 MovieClip "control" in Frame 25
onClipEvent (enterFrame) {
if (_root.mushroomsleft == 0) {
_root.gotoAndStop("end");
}
if (_root.score < 0) {
_root.score = 0;
}
r = random(_root.enemylevel);
if (r == 1) {
_root.createenemy();
}
}
Instance of Symbol 71 MovieClip "player" in Frame 25
onClipEvent (load) {
_root.player.legs.legs2.l1.gotoAndStop(1);
_root.player.legs.legs2.l2.gotoAndStop(1);
_root.player.legs.legs2.l3.gotoAndStop(1);
_root.player.legs.legs2.l4.gotoAndStop(1);
rateofchange = 1;
rateofstop = 1.2;
xspeed = 0;
yspeed = 0;
maxspeed = 7;
bulletcount = 0;
xbulletspeed = 0;
ybulletspeed = -15;
maxbullets = 30;
bulletpause = 3;
wait = 0;
legsmoving = false;
}
onClipEvent (enterFrame) {
if ((xspeed < 0.1) && (xspeed > -0.1)) {
if ((yspeed < 0.1) && (yspeed > -0.1)) {
legsmoving = false;
_root.player.legs.legs2.l1.gotoAndStop(1);
_root.player.legs.legs2.l2.gotoAndStop(1);
_root.player.legs.legs2.l3.gotoAndStop(1);
_root.player.legs.legs2.l4.gotoAndStop(1);
}
}
if ((pressed == true) && (legsmoving == false)) {
legsmoving = true;
_root.player.legs.legs2.l1.gotoAndPlay(1);
_root.player.legs.legs2.l2.gotoAndPlay(5);
_root.player.legs.legs2.l3.gotoAndPlay(10);
_root.player.legs.legs2.l4.gotoAndPlay(15);
}
pressed = false;
if (Key.isDown(37) && (xspeed > (-maxspeed))) {
xbulletspeed = -15;
ybulletspeed = 0;
brot = 270;
pressed = true;
xspeed = xspeed - rateofchange;
}
if (Key.isDown(39) && (xspeed < maxspeed)) {
xbulletspeed = 15;
ybulletspeed = 0;
brot = 90;
pressed = true;
xspeed = xspeed + rateofchange;
}
if (Key.isDown(38) && (yspeed > (-maxspeed))) {
xbulletspeed = 0;
ybulletspeed = -15;
brot = 0;
pressed = true;
yspeed = yspeed - rateofchange;
}
if (Key.isDown(40) && (yspeed < maxspeed)) {
xbulletspeed = 0;
ybulletspeed = 15;
brot = 180;
pressed = true;
yspeed = yspeed + rateofchange;
}
if (_root.mushrooms.hitTest(_x + xspeed, _y, true)) {
xspeed = 0;
}
if (_root.mushrooms.hitTest(_x, _y + yspeed, true)) {
yspeed = 0;
}
_x = (_x + xspeed);
_y = (_y + yspeed);
if (pressed == false) {
if (xspeed != 0) {
xspeed = xspeed / rateofstop;
}
if (yspeed != 0) {
yspeed = yspeed / rateofstop;
}
}
if ((xspeed < 0.01) && (xspeed > -0.01)) {
xspeed = 0;
}
if ((yspeed < 0.01) && (yspeed > -0.01)) {
yspeed = 0;
}
if (_x < (0 + (_width / 2))) {
_x = (0 + (_width / 2));
xspeed = 0;
}
if (_x > (550 - (_width / 2))) {
_x = (550 - (_width / 2));
xspeed = 0;
}
if (_y < (0 + (_height / 2))) {
_y = (0 + (_height / 2));
yspeed = 0;
}
if (_y > (400 - (_height / 2))) {
_y = (400 - (_height / 2));
yspeed = 0;
}
if (Key.isDown(32) && (wait > bulletpause)) {
wait = 0;
_root.shoot.start();
_root.bulletmaster.duplicateMovieClip(["bullet" + bulletcount], bulletcount, {_x:_x, _y:_y});
_root["bullet" + bulletcount].yspeed = ybulletspeed;
_root["bullet" + bulletcount].xspeed = xbulletspeed;
_root["bullet" + bulletcount].bulletid = bulletcount;
_root["bullet" + bulletcount]._rotation = brot;
bulletcount = bulletcount + 1;
if (bulletcount > maxbullets) {
bulletcount = 0;
}
}
wait = wait + 1;
}
Instance of Symbol 73 MovieClip "bulletmaster" in Frame 25
onClipEvent (load) {
}
onClipEvent (enterFrame) {
if (_root.mushrooms.hitTest(_x, _y, true)) {
_root.bulletask = this.bulletid;
_root.getmushroom();
}
if (_root.enemies.hitTest(_x, _y, true)) {
_root.bulletask = this.bulletid;
_root.getbug();
}
_y = (_y + yspeed);
_x = (_x + xspeed);
}
Frame 41
_root.mst.score = _root.score;
_root.mst.game = "Bugs";
_root.mst.loadVariables("record_score.php", "GET");
stop();
Frame 65
gotoAndPlay ("game");
Symbol 9 MovieClip Frame 1
stop();
Symbol 9 MovieClip Frame 2
stop();
Symbol 15 MovieClip Frame 1
stop();
Instance of Symbol 16 MovieClip "e_master" in Symbol 17 MovieClip Frame 1
onClipEvent (enterFrame) {
_x = (_x + xspeed);
_y = (_y + yspeed);
if (_root.mushrooms.hitTest(_x, _y, true)) {
_rotation = (_rotation - 180);
_root.enemynumber = enemyid;
_root.removemr();
xspeed = -xspeed;
yspeed = -yspeed;
}
if ((((this._x < -10) || (this._x > 580)) || (this._y < -20)) || (this._y > 540)) {
this.removeMovieClip();
}
}
Symbol 20 MovieClip Frame 1
stop();
Symbol 31 Button
on (release) {
gotoAndPlay ("clear");
}
Symbol 38 Button
on (release) {
getURL ("http://www.hairybulletgames.com", "_blank");
}
Symbol 46 Button
on (release) {
_root.sl._visible = false;
_root.slonmc._y = 5;
_root.sloffmc._y = -100;
}
Symbol 51 Button
on (release) {
_root.sl._visible = true;
_root.sloffmc._y = 5;
_root.slonmc._y = -100;
}
Symbol 61 MovieClip Frame 1
bonus = _root.mushroomsleft * 50;
_root.score = _root.score + bonus;
Symbol 61 MovieClip Frame 18
stop();
Symbol 62 MovieClip Frame 1
stop();
Symbol 73 MovieClip Frame 2
stop();
Symbol 74 Button
on (release) {
gotoAndPlay (1);
}
Symbol 81 MovieClip Frame 52
stop();