Frame 1
stop();
Frame 2
stop();
d = 1;
var my_cm = new ContextMenu();
my_cm.hideBuiltInItems();
this.menu = my_cm;
fscommand ("showmenu", "fasle");
Frame 3
function makeMenu() {
_root.instructions._visible = false;
menusound = createEmptyMovieClip("menusound", _root.d++);
_root.menusound = new Sound(menusound);
_root.menusound.attachSound("menu");
_root.menusound.start(0, 100000000);
_root.attachMovie("menus", "menus", _root.d++);
_root.menus._x = 0;
_root.menus._y = 0;
_root.attachMovie("instructions", "instructions", _root.d++);
_root.instructions._x = 35;
_root.instructions._y = 45;
_root.instructions._visible = false;
}
stop();
makeMenu();
Frame 4
function damageIckibod() {
if (!_root.ickibod.blinking) {
_root.ickibod.blinking = true;
if (_root.stats.health._currentframe == 3) {
dieIckibod();
} else {
_root.ickibod.timer = getTimer();
_root.stats.health.gotoAndStop(_root.stats.health._currentframe + 1);
}
}
}
function dieIckibod() {
if (!_root.ickibod.dieing) {
_root.ickibod.dietime = getTimer();
_root.ickiboddie.start(0, 0);
}
_root.ickibod.dieing = true;
}
function dieingIckibod() {
if ((_root.lives - 1) < 0) {
stopAllSounds();
_root.gameoversound = new Sound(this);
_root.gameoversound.attachSound("gameover-sound");
_root.gameoversound.start(0, 1);
_root.stats.removeMovieClip();
displayGameOver();
}
if ((_root.ickibod.dieing && ((getTimer() - _root.ickibod.timer) > 2000)) && (!_root.gameover)) {
_root.ickibod._alpha = _root.ickibod._alpha - 5;
_root.ickibod._xscale = 100;
_root.ickibod.gotoAndStop(5);
if ((_root.ickibod._alpha <= 0) && ((getTimer() - _root.ickibod.dietime) > _root.ickiboddie.duration)) {
_root.lives--;
_root.gamescored = _root.gamescored + 20;
destroyStage();
createLevel();
}
}
}
function displayGameOver() {
_root.gameover = true;
_root.attachMovie("gameover", "gameovermc", _root.d++);
_root.gameovermc._x = 0;
_root.gameovermc._y = 0;
}
function blinkIckibod() {
now = getTimer();
if ((now - _root.ickibod.timer) < 2000) {
_root.ickibod.blink++;
if ((_root.ickibod.blink % 4) == 1) {
_root.ickibod._visible = false;
} else {
_root.ickibod._visible = true;
}
} else {
_root.ickibod._visible = true;
_root.ickibod.blinking = false;
}
}
function detectKeys(vel, jump, fall) {
if (!_root.ickibod.dieing) {
if (((Key.isDown(65) && (!jump)) && (!fall)) && (!_root.ickibod.duck)) {
_root.jump = true;
_root.ickibod.jumpheight = _root.jumpheight;
}
if ((Key.isDown(83) && (!_root.ickibod.duck)) && (!_root.ickibod.shoot)) {
shoot(true);
}
if ((Key.isDown(39) && (!Key.isDown(37))) && (!_root.ickibod.duck)) {
moveCharacter(vel, jump, 1);
_root.ickibod.dir = 1;
} else if ((Key.isDown(37) && (!Key.isDown(39))) && (!_root.ickibod.duck)) {
moveCharacter(-vel, jump, 0);
_root.ickibod.dir = 0;
} else if (((((Key.isDown(40) && (!Key.isDown(39))) && (!Key.isDown(37))) && (!jump)) && (!fall)) && (!_root.ickibod.shoot)) {
_root.ickibod._xscale = 100;
_root.ickibod.gotoAndStop(6);
_root.ickibod.duck = true;
} else if ((!jump) && (!_root.ickibod.shoot)) {
_root.ickibod.gotoAndStop(1);
_root.ickibod._xscale = 100;
_root.ickibod.duck = false;
}
if (!Key.isDown(40)) {
_root.ickibod.duck = false;
}
}
}
function shoot(firing) {
now = getTimer();
bulletspeed = _root.bulletspeed;
if (((now - _root.ickibod.lastfired) > _root.firerate) && (firing)) {
_root.ickibodshoot.start(0, 0);
_root.ickibod.gotoAndStop(3);
if (!_root.ickibod.dir) {
_root.ickibod._xscale = -100;
} else {
_root.ickibod._xscale = 100;
}
_root.ickibod.shoot = true;
}
if (_root.ickibod.fire._currentframe == 8) {
if (_root.ickibod.bulletcount > _root.ickibod.maxbullets) {
_root.ickibod.bulletcount = 0;
}
_root.attachMovie("ammo", "bullet" + _root.ickibod.bulletcount, _root.d++);
_root.gamescoreb = _root.gamescoreb + 10;
Coords = {};
if (_root.ickibod.dir) {
Coords.x = _root.ickibod._x + (_root.ickibod._width / 2);
Coords.y = _root.ickibod._y + (_root.ickibod._height / 2);
_root["bullet" + _root.ickibod.bulletcount].speed = bulletspeed;
} else {
Coords.x = _root.ickibod._x - (_root.ickibod._width / 2);
Coords.y = _root.ickibod._y + (_root.ickibod._height / 2);
_root["bullet" + _root.ickibod.bulletcount]._xscale = -100;
_root["bullet" + _root.ickibod.bulletcount].speed = -bulletspeed;
}
_root["bullet" + _root.ickibod.bulletcount]._x = Coords.x;
_root["bullet" + _root.ickibod.bulletcount]._y = Coords.y;
_root.ickibod.bulletcount++;
_root.ickibod.lastfired = getTimer();
}
if (_root.ickibod.fire._currentframe == 8) {
_root.ickibod.shoot = false;
if (_root.jump) {
_root.ickibod.gotoAndStop(4);
_root.ickibod.jumper.gotoAndStop(4);
}
}
}
function moveBullets(ymod) {
j = 0;
while (j <= _root.ickibod.maxbullets) {
if (_root["bullet" + j]._x == undefined) {
} else {
_root["bullet" + j]._x = _root["bullet" + j]._x + _root["bullet" + j].speed;
_root["bullet" + j]._x = _root["bullet" + j]._x + _root.xmod;
_root["bullet" + j]._y = _root["bullet" + j]._y - ymod;
Coords = {};
Coords.x = _root["bullet" + j]._x;
if ((Coords.x > _root.stagewidth) || (0 > Coords.x)) {
_root["bullet" + j].removeMovieClip();
}
i = 0;
while (i < _root["foreground" + _root.level].rats.length) {
if (_root["bullet" + j].hitTest(_root["foreground" + _root.level]["rat" + i])) {
_root.enemycurrent++;
_root.ratdie.start(0, 0);
_root["foreground" + _root.level]["rat" + i].dead = true;
_root["bullet" + j].removeMovieClip();
}
i++;
}
i = 0;
while (i < _root["foreground" + _root.level].bats.length) {
if (_root["bullet" + j].hitTest(_root["foreground" + _root.level]["bat" + i])) {
_root.enemycurrent++;
_root.batdie.start(0, 0);
_root["foreground" + _root.level]["bat" + i].dead = true;
_root["bullet" + j].removeMovieClip();
}
i++;
}
i = 0;
while (i < _root["foreground" + _root.level].skulls.length) {
if (_root["bullet" + j].hitTest(_root["foreground" + _root.level]["skull" + i])) {
_root.enemycurrent++;
_root.skulldie.start(0, 0);
_root["foreground" + _root.level]["skull" + i].dead = true;
_root["bullet" + j].removeMovieClip();
}
i++;
}
if ((_root["bullet" + j].hitTest(_root.bossmc) && (!_root.bossmc.dead)) && (_root.bossmc._alpha > 90)) {
_root["bullet" + j].removeMovieClip();
_root.bossmc.health = _root.bossmc.health - 1;
if (_root.bossmc.health <= 0) {
_root.bossmc.dead = true;
} else {
_root.bosshit.start(0, 0);
}
}
i = 0;
while (i < _root["foreground" + _root.level].slugs.length) {
if (_root["bullet" + j].hitTest(_root["foreground" + _root.level]["slug" + i])) {
_root.enemycurrent++;
_root.slugdie.start(0, 0);
_root["foreground" + _root.level]["slug" + i].dead = true;
_root["bullet" + j].removeMovieClip();
}
i++;
}
i = 0;
while (i < _root["foreground" + _root.level].rabbits.length) {
if (_root["bullet" + j].hitTest(_root["foreground" + _root.level]["rabbit" + i])) {
_root.enemycurrent++;
_root.rabbitdie.start(0, 0);
_root["foreground" + _root.level]["rabbit" + i].dead = true;
_root["bullet" + j].removeMovieClip();
}
i++;
}
i = 0;
while (i < _root["foreground" + _root.level].dodges.length) {
if (_root["bullet" + j].hitTest(_root["foreground" + _root.level]["dodge" + i])) {
_root.enemycurrent++;
_root.dodgedie.start(0, 0);
_root["foreground" + _root.level]["dodge" + i].dead = true;
_root["bullet" + j].removeMovieClip();
}
i++;
}
}
j++;
}
j = 0;
while (j <= _root.maxsbullets) {
if (_root["sbullet" + j]._x == undefined) {
} else {
if (_root["sbullet" + j].dir) {
_root["sbullet" + j]._x = _root["sbullet" + j]._x - 10;
} else {
_root["sbullet" + j]._x = _root["sbullet" + j]._x + 10;
}
_root["sbullet" + j]._x = _root["sbullet" + j]._x + _root.xmod;
_root["sbullet" + j]._y = _root["sbullet" + j]._y - ymod;
if ((((_root["sbullet" + j]._x > (_root.stagewidth + 10)) || (_root["sbullet" + j]._x < -10)) || (_root["sbullet" + j]._y < -10)) || (_root["sbullet" + j]._y > (_root.stageheight + 10))) {
_root["sbullet" + j].removeMovieClip();
}
if (_root.ickibod.hitbox.hitTest(_root["sbullet" + j])) {
_root["sbullet" + j].removeMovieClip();
damageIckibod();
}
}
j++;
}
_root.xmod = 0;
if (enemycurrent > enemies) {
enemycurrent = enemies;
}
}
function jumpCharacter(jump, fall) {
if (_root.jump && (!_root.ickibod.duck)) {
topposition = 100;
bottomposition = 300;
bguse = Math.abs(_root["bg" + _root.level]._height - _root.stageheight);
percent = (_root["foreground" + _root.level]._y - _root["foreground" + _root.level].origy) / _root["foreground" + _root.level]._height;
if (percent > 1) {
percent = 1;
}
if (percent < 0) {
percent = 0;
}
if (_root.ickibod.dir) {
_root.ickibod._xscale = 100;
} else {
_root.ickibod._xscale = -100;
}
_root["bg" + _root.level]._y = (bguse * percent) - bguse;
if (!fall) {
if (_root.ickibod.shoot) {
_root.ickibod.gotoAndStop(3);
} else {
_root.ickibod.gotoAndStop(4);
_root.ymod = 0;
if (_root.ickibod.jumper._currentframe == 4) {
_root.ickibod.jumper.stop();
}
}
} else if (_root.ickibod.shoot) {
_root.ickibod.gotoAndStop(3);
} else {
_root.ickibod.gotoAndStop(4);
_root.ickibod.jumper.gotoAndStop(4);
}
if (ground(_root.jump, _root.fall)) {
_root.jump = false;
_root.fall = false;
_root.ickibod.jumper.play();
_root.ymod = 0;
return(undefined);
}
if (((_root.ickibod._y + _root.jumpheight) <= topposition) && (_root.ickibod.jumpheight <= 0)) {
toohigh = true;
} else {
toohigh = false;
}
if (((((_root.ickibod._y + _root.ickibod._y) + _root.jumpheight) >= bottomposition) && (fall)) && (percent != 0)) {
toolow = true;
} else {
toolow = false;
}
if (((((_root.ickibod.jumper._currentframe > 3) || (_root.ickibod.shoot)) && (!toohigh)) && (!toolow)) || (_root.boss)) {
_root.ickibod._y = _root.ickibod._y + _root.ickibod.jumpheight;
_root.ymod = 0;
_root.ickibod.jumpheight++;
} else if ((((_root.ickibod.jumper._currentframe > 3) || (_root.ickibod.shoot)) && (toohigh)) && (!_root.boss)) {
_root["foreground" + _root.level]._y = _root["foreground" + _root.level]._y - _root.ickibod.jumpheight;
_root.ymod = _root.ickibod.jumpheight;
_root.ickibod.jumpheight++;
} else if ((((_root.ickibod.jumper._currentframe > 3) || (_root.ickibod.shoot)) && (toolow)) && (!_root.boss)) {
_root["foreground" + _root.level]._y = _root["foreground" + _root.level]._y - _root.ickibod.jumpheight;
_root.ymod = _root.ickibod.jumpheight;
_root.ickibod.jumpheight++;
}
if ((_root["foreground" + _root.level]._y < _root["foreground" + _root.level].origy) && (!_root.boss)) {
_root.ymod = _root["foreground" + _root.level].origy - _root["foreground" + _root.level]._y;
_root["foreground" + _root.level]._y = _root["foreground" + _root.level].origy;
}
if (_root.ickibod.jumpheight > (_root.jumpheight * -1)) {
_root.ickibod.jumpheight = _root.jumpheight * -1;
}
if (_root.ickibod.jumpheight > 0) {
_root.fall = true;
}
} else {
_root.ymod = 0;
}
if (_root.ickibod._y > (_root.stageheight + _root.ickibod._height)) {
dieIckibod();
}
}
function moveCharacter(vel, jump, dir) {
fginc = Math.abs(vel);
position = 325;
fguse = Math.abs(_root["foreground" + _root.level]._width - _root.stagewidth);
bguse = Math.abs(_root["bg" + _root.level]._width - _root.stagewidth);
positionleft = ((((_root.ickibod._x - (_root.ickibod._width / 2)) + vel) <= position) && (_root["bg" + _root.level]._x != 0)) && (_root["bg" + _root.level]._x != (-bguse));
positionright = ((((_root.ickibod._x + (_root.ickibod._width / 2)) + vel) >= position) && (_root["bg" + _root.level]._x != 0)) && (_root["bg" + _root.level]._x != (-bguse));
atbeggining = (((_root.ickibod._x + (_root.ickibod._width / 2)) + vel) < position) && (_root["bg" + _root.level]._x == 0);
atend = (((_root.ickibod._x - (_root.ickibod._width / 2)) + vel) > position) && (_root["bg" + _root.level]._x == (-bguse));
if (((!jump) && (!_root.ickibod.shoot)) && (!_root.ickibod.duck)) {
_root.ickibod.gotoAndStop(2);
}
if (((_root.ickibod._x - (_root.ickibod._width / 2)) + vel) <= 0) {
_root.ickibod.x = 0 + (_root.ickibod._width / 2);
vel = 0;
}
if (((_root.ickibod._x + (_root.ickibod._width / 2)) + vel) >= _root.stagewidth) {
_root.ickibod.x = _root.stagewidth - (_root.ickibod._width / 2);
vel = 0;
}
if ((positionleft && (!dir)) || (positionright && (dir))) {
vel = 0;
}
if (atbeggining || (atend)) {
fginc = 0;
_root.xmod = 0;
}
percent = Math.abs(_root["foreground" + _root.level]._x) / fguse;
if (percent > 1) {
percent = 1;
}
if (dir) {
_root.ickibod._xscale = 100;
_root.ickibod._x = _root.ickibod._x + vel;
if ((_root["foreground" + _root.level]._x - fginc) <= (-fguse)) {
_root["foreground" + _root.level]._x = -fguse;
fginc = 0;
_root.xmod = 0;
}
_root["foreground" + _root.level]._x = _root["foreground" + _root.level]._x - fginc;
_root.xmod = -fginc;
} else {
_root.ickibod._xscale = -100;
_root.ickibod._x = _root.ickibod._x + vel;
if ((_root["foreground" + _root.level]._x + fginc) >= 0) {
_root["foreground" + _root.level]._x = 0;
fginc = 0;
_root.xmod = 0;
}
_root["foreground" + _root.level]._x = _root["foreground" + _root.level]._x + fginc;
_root.xmod = fginc;
}
_root["bg" + _root.level]._x = bguse * (-percent);
}
function getNearestPlatform() {
nearest = 0;
nearesthyp = 10000000000;
i = 1;
while (i < _root["foreground" + _root.level].platforms) {
minCoords = getPlatformBounds(i, "min", true);
ickyx = _root.ickibod._x;
ickyy = _root.ickibod._y;
xcomp = Math.pow(ickyx - minCoords.x, 2);
ycomp = Math.pow(ickyy - minCoords.y, 2);
if (Math.sqrt(xcomp + ycomp) < nearesthyp) {
nearest = i;
nearesthyp = Math.sqrt(xcomp + ycomp);
}
i++;
}
minCoords = getPlatformBounds(nearest, "min", true);
_root.ickibod._x = minCoords.x + (_root["foreground" + _root.level]["sg" + nearest]._width / 2);
_root.ickibod._y = (minCoords.y - (_root["foreground" + _root.level]["sg" + nearest]._height / 2)) - _root.ickibod._height;
}
function getPlatformBounds(segment, maxormin, global) {
clip = _root["foreground" + _root.level]["sg" + segment].getBounds();
minCoords = {};
maxCoords = {};
minCoords.x = clip.xMin;
maxCoords.x = clip.xMax;
minCoords.y = clip.yMin;
maxCoords.y = clip.yMax;
if (global) {
_root["foreground" + _root.level]["sg" + segment].localToGlobal(minCoords);
_root["foreground" + _root.level]["sg" + segment].localToGlobal(maxCoords);
}
if (maxormin == "max") {
return(maxCoords);
}
return(minCoords);
}
function ground(jump, fall) {
sgfindings = 0;
if (!_root.ickibod.duck) {
i = 1;
while (i <= _root["foreground" + _root.level].platforms) {
minCoords = getPlatformBounds(i, "min", true);
maxCoords = getPlatformBounds(i, "max", true);
if ((!((((_root.ickibod._x > minCoords.x) && (_root.ickibod._x < maxCoords.x)) && (((_root.ickibod._y + _root.ickibod._height) + 20) > minCoords.y)) && ((_root.ickibod._y + _root.ickibod._height) < (maxCoords.y - (_root["foreground" + _root.level]["sg" + i]._height / 2))))) && (!jump)) {
sgfindings++;
}
if (((((_root.ickibod._x > minCoords.x) && (_root.ickibod._x < maxCoords.x)) && (((_root.ickibod._y + _root.ickibod._height) + 20) > minCoords.y)) && ((_root.ickibod._y + _root.ickibod._height) < (maxCoords.y - (_root["foreground" + _root.level]["sg" + i]._height / 2)))) && (fall)) {
_root.jump = false;
_root.fall = false;
_root.ickibod._y = (minCoords.y - _root.ickibod._height) - 10;
return(true);
}
i++;
}
if (sgfindings != _root["platforms" + _root.level]) {
} else {
_root.jump = true;
_root.fall = true;
_root.ickibod.jumpheight = 0;
}
}
}
function moveDodges() {
i = 0;
while (i < _root["foreground" + _root.level].dodges.length) {
dodge = _root["foreground" + _root.level]["dodge" + i];
dodgewidth = _root["foreground" + _root.level]["dodge" + i]._width;
dodgex = _root["foreground" + _root.level]["dodge" + i]._x;
minCoords = getPlatformBounds(_root["foreground" + _root.level].dodges[i], "min", false);
maxCoords = getPlatformBounds(_root["foreground" + _root.level].dodges[i], "max", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].dodges[i]]._x;
maxCoords.x = maxCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].dodges[i]]._x;
if (_root["foreground" + _root.level]["dodge" + i]._xscale > 0) {
dvel = _root.dodgespeed;
} else {
dvel = -_root.dodgespeed;
}
if (_root["foreground" + _root.level]["dodge" + i].dead) {
dvel = 0;
_root["foreground" + _root.level]["dodge" + i].gotoAndStop(2);
}
if (_root["foreground" + _root.level]["dodge" + i].dead) {
_root["foreground" + _root.level]["dodge" + i]._alpha = _root["foreground" + _root.level]["dodge" + i]._alpha - 5;
if (_root["foreground" + _root.level]["dodge" + i]._alpha <= 0) {
_root["foreground" + _root.level]["dodge" + i].removeMovieClip();
}
}
if (_root.ickibod.hitbox.hitTest(_root["foreground" + _root.level]["dodge" + i]) && (!_root["foreground" + _root.level]["dodge" + i].dead)) {
damageIckibod();
}
_root["foreground" + _root.level]["dodge" + i]._x = _root["foreground" + _root.level]["dodge" + i]._x + dvel;
if ((dvel > 0) && ((dodgex + dodgewidth) > maxCoords.x)) {
_root["foreground" + _root.level]["dodge" + i]._xscale = -100;
}
if ((dvel < 0) && ((dodgex - dodgewidth) < minCoords.x)) {
_root["foreground" + _root.level]["dodge" + i]._xscale = 100;
}
i++;
}
}
function moveRabbits() {
i = 0;
while (i < _root["foreground" + _root.level].rabbits.length) {
rabbit = _root["foreground" + _root.level]["rabbit" + i];
rabbitwidth = _root["foreground" + _root.level]["rabbit" + i]._width;
rabbitx = _root["foreground" + _root.level]["rabbit" + i]._x;
minCoords = getPlatformBounds(_root["foreground" + _root.level].rabbits[i], "min", false);
maxCoords = getPlatformBounds(_root["foreground" + _root.level].rabbits[i], "max", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].rabbits[i]]._x;
maxCoords.x = maxCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].rabbits[i]]._x;
if (_root["foreground" + _root.level]["rabbit" + i]._xscale > 0) {
rbvel = _root.rabbitspeed;
} else {
rbvel = -_root.rabbitspeed;
}
if (_root["foreground" + _root.level]["rabbit" + i].dead) {
rbvel = 0;
_root["foreground" + _root.level]["rabbit" + i].gotoAndStop(2);
}
if (_root["foreground" + _root.level]["rabbit" + i].dead) {
_root["foreground" + _root.level]["rabbit" + i]._alpha = _root["foreground" + _root.level]["rabbit" + i]._alpha - 5;
if (_root["foreground" + _root.level]["rabbit" + i]._alpha <= 0) {
_root["foreground" + _root.level]["rabbit" + i].removeMovieClip();
}
}
if (_root.ickibod.hitbox.hitTest(_root["foreground" + _root.level]["rabbit" + i]) && (!_root["foreground" + _root.level]["rabbit" + i].dead)) {
damageIckibod();
}
_root["foreground" + _root.level]["rabbit" + i]._x = _root["foreground" + _root.level]["rabbit" + i]._x + rbvel;
if ((rbvel > 0) && ((rabbitx + rabbitwidth) > maxCoords.x)) {
_root["foreground" + _root.level]["rabbit" + i]._xscale = -100;
}
if ((rbvel < 0) && ((rabbitx - rabbitwidth) < minCoords.x)) {
_root["foreground" + _root.level]["rabbit" + i]._xscale = 100;
}
i++;
}
}
function moveSlugs() {
i = 0;
while (i < _root["foreground" + _root.level].slugs.length) {
slug = _root["foreground" + _root.level]["slug" + i];
slugwidth = _root["foreground" + _root.level]["slug" + i]._width;
slugx = _root["foreground" + _root.level]["slug" + i]._x;
minCoords = getPlatformBounds(_root["foreground" + _root.level].slugs[i], "min", false);
maxCoords = getPlatformBounds(_root["foreground" + _root.level].slugs[i], "max", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].slugs[i]]._x;
maxCoords.x = maxCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].slugs[i]]._x;
if (_root["foreground" + _root.level]["slug" + i]._xscale > 0) {
sgvel = _root.slugspeed;
} else {
sgvel = -_root.slugspeed;
}
if (_root["foreground" + _root.level]["slug" + i].dead) {
sgvel = 0;
_root["foreground" + _root.level]["slug" + i].gotoAndStop(2);
}
if (_root["foreground" + _root.level]["slug" + i].dead) {
_root["foreground" + _root.level]["slug" + i]._alpha = _root["foreground" + _root.level]["slug" + i]._alpha - 5;
if (_root["foreground" + _root.level]["slug" + i]._alpha <= 0) {
_root["foreground" + _root.level]["slug" + i].removeMovieClip();
}
}
if (_root.ickibod.hitbox.hitTest(_root["foreground" + _root.level]["slug" + i]) && (!_root["foreground" + _root.level]["slug" + i].dead)) {
damageIckibod();
}
_root["foreground" + _root.level]["slug" + i]._x = _root["foreground" + _root.level]["slug" + i]._x + sgvel;
if ((sgvel > 0) && ((slugx + slugwidth) > maxCoords.x)) {
_root["foreground" + _root.level]["slug" + i]._xscale = -100;
}
if ((sgvel < 0) && ((slugx - slugwidth) < minCoords.x)) {
_root["foreground" + _root.level]["slug" + i]._xscale = 100;
}
i++;
}
}
function moveRats() {
i = 0;
while (i < _root["foreground" + _root.level].rats.length) {
rat = _root["foreground" + _root.level]["rat" + i];
ratwidth = _root["foreground" + _root.level]["rat" + i]._width;
ratx = _root["foreground" + _root.level]["rat" + i]._x;
minCoords = getPlatformBounds(_root["foreground" + _root.level].rats[i], "min", false);
maxCoords = getPlatformBounds(_root["foreground" + _root.level].rats[i], "max", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].rats[i]]._x;
maxCoords.x = maxCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].rats[i]]._x;
if (_root["foreground" + _root.level]["rat" + i]._xscale > 0) {
rvel = _root.ratspeed;
} else {
rvel = -_root.ratspeed;
}
if (_root["foreground" + _root.level]["rat" + i].dead) {
rvel = 0;
_root["foreground" + _root.level]["rat" + i].gotoAndStop(2);
}
if (_root["foreground" + _root.level]["rat" + i].dead && (_root["foreground" + _root.level]["rat" + i].dieing._currentframe == 10)) {
_root["foreground" + _root.level]["rat" + i]._alpha = _root["foreground" + _root.level]["rat" + i]._alpha - 5;
if (_root["foreground" + _root.level]["rat" + i]._alpha <= 0) {
_root["foreground" + _root.level]["rat" + i].removeMovieClip();
}
}
if (_root.ickibod.hitbox.hitTest(_root["foreground" + _root.level]["rat" + i]) && (!_root["foreground" + _root.level]["rat" + i].dead)) {
damageIckibod();
}
_root["foreground" + _root.level]["rat" + i]._x = _root["foreground" + _root.level]["rat" + i]._x + rvel;
if ((rvel > 0) && ((ratx + ratwidth) > maxCoords.x)) {
_root["foreground" + _root.level]["rat" + i]._xscale = -100;
}
if ((rvel < 0) && ((ratx - ratwidth) < minCoords.x)) {
_root["foreground" + _root.level]["rat" + i]._xscale = 100;
}
i++;
}
}
function moveSkulls() {
onstage = 0;
i = 0;
while (i < _root["foreground" + _root.level].skulls.length) {
skull = _root["foreground" + _root.level]["skull" + i];
skullwidth = _root["foreground" + _root.level]["skull" + i]._width;
skullx = _root["foreground" + _root.level]["skull" + i]._x;
minCoords = getPlatformBounds(_root["foreground" + _root.level].skulls[i], "min", false);
maxCoords = getPlatformBounds(_root["foreground" + _root.level].skulls[i], "max", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].skulls[i]]._x;
maxCoords.x = maxCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].skulls[i]]._x;
sCoords = {};
sCoords.y = skull.idle.head.mouth._y;
sCoords.x = skull.idle.head.mouth._x;
_root["foreground" + _root.level]["skull" + i].idle.head.localToGlobal(sCoords);
if ((getTimer() - skull.lastfired) > 200) {
skull.idle.head.mouth.gotoAndStop(1);
}
if (((((((getTimer() - skull.lastfired) > 1500) && (!skull.dead)) && (sCoords.x > 0)) && (sCoords.x < _root.stagewidth)) && (sCoords.y > 0)) && (sCoords.y < _root.stageheight)) {
_root.attachMovie("sbullet", "sbullet" + _root.sbulletcount, _root.d++);
skull.idle.head.mouth.gotoAndStop(2);
_root["sbullet" + _root.sbulletcount]._x = sCoords.x;
_root["sbullet" + _root.sbulletcount]._y = sCoords.y;
_root["sbullet" + _root.sbulletcount].sound = new Sound(_root["sbullet" + _root.sbulletcount]);
_root["sbullet" + _root.sbulletcount].sound.attachSound("skull-shoot");
_root["sbullet" + _root.sbulletcount].sound.start(0, 0);
if (skull._xscale > 0) {
_root["sbullet" + _root.sbulletcount].dir = 1;
} else {
_root["sbullet" + _root.sbulletcount].dir = 0;
}
skull.lastfired = getTimer();
_root.sbulletcount++;
if (_root.sbulletcount > _root.maxsbullets) {
_root.sbulletcount = 0;
}
} else if (!((((sCoords.x > 0) && (sCoords.x < _root.stagewidth)) && (sCoords.y > 0)) && (sCoords.y < _root.stageheight))) {
skull.lastfired = getTimer();
}
if (skull._xscale > 0) {
svel = -_root.skullspeed;
} else {
svel = _root.skullspeed;
}
if (skull.dead) {
skull.gotoAndStop(2);
svel = 0;
skull._alpha = skull._alpha - 5;
if (skull._alpha <= 0) {
skull.removeMovieClip();
}
}
skull._x = skull._x + svel;
if ((svel > 0) && ((skullx + skullwidth) > maxCoords.x)) {
skull._xscale = 100;
}
if ((svel < 0) && ((skullx - skullwidth) < minCoords.x)) {
skull._xscale = -100;
}
if (_root.ickibod.hitbox.hitTest(skull) && (!skull.dead)) {
damageIckibod();
}
skullPlace = {};
skullPlace.x = skull._x;
skullPlace.y = skull._y;
_root["foreground" + _root.level].localToGlobal(skullPlace);
if (((((!skull.dead) && (skullPlace.x > -50)) && (skullPlace.x < (_root.stagewidth + 50))) && (skullPlace.y > -50)) && (skullPlace.y < (_root.stageheight + 50))) {
onstage++;
}
i++;
}
if (onstage > 0) {
_root.skullidle.setVolume(100);
} else {
_root.skullidle.setVolume(0);
}
}
function moveBats() {
i = 0;
while (i <= _root["foreground" + _root.level].bats.length) {
bat = _root["foreground" + _root.level]["bat" + i];
fly = 125;
Coords = {};
bvel = _root["foreground" + _root.level]["bat" + i].bvel;
Coords.x = _root["foreground" + _root.level]["bat" + i]._x;
Coords.y = _root["foreground" + _root.level]["bat" + i]._y;
batorigy = _root["foreground" + _root.level]["bat" + i].origy;
_root["foreground" + _root.level].localToGlobal(Coords);
if ((bat._y < (batorigy - fly)) && (bvel < 0)) {
_root["foreground" + _root.level]["bat" + i].bvel = _root["foreground" + _root.level]["bat" + i].bvel * -1;
}
if ((bat._y > (batorigy + fly)) && (bvel > 0)) {
_root["foreground" + _root.level]["bat" + i].bvel = _root["foreground" + _root.level]["bat" + i].bvel * -1;
}
if (Coords.x < (_root.ickibod._x + (_root.ickibod._width / 2))) {
bat._yscale = -100;
} else {
bat._yscale = 100;
}
if (_root.ickibod.hitbox.hitTest(bat) && (!bat.dead)) {
damageIckibod();
}
if (bat.dead) {
bat._alpha = bat._alpha - 5;
bat.gotoAndStop(2);
bat._y = bat._y + Math.abs(_root["foreground" + _root.level]["bat" + i].bvel);
if (bat._alpha <= 0) {
bat.removeMovieClip();
}
} else {
bat._y = bat._y + _root["foreground" + _root.level]["bat" + i].bvel;
}
i++;
}
}
function sawBlades() {
sawonstage = 0;
i = 0;
while (i <= _root["foreground" + _root.level].saws.length) {
sawwidth = _root["foreground" + _root.level]["saw" + i]._width / 2;
sawheight = _root["foreground" + _root.level]["saw" + i]._height / 2;
sawx = _root["foreground" + _root.level]["saw" + i]._x;
sawy = _root["foreground" + _root.level]["saw" + i]._y;
minCoords = getPlatformBounds(_root["foreground" + _root.level].saws[i], "min", false);
maxCoords = getPlatformBounds(_root["foreground" + _root.level].saws[i], "max", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].saws[i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].saws[i]]._y;
maxCoords.x = maxCoords.x + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].saws[i]]._x;
maxCoords.y = maxCoords.y + _root["foreground" + _root.level]["sg" + _root["foreground" + _root.level].saws[i]]._y;
_root["foreground" + _root.level]["saw" + i]._rotation = _root["foreground" + _root.level]["saw" + i]._rotation + 10;
if (((sawy + sawheight) <= minCoords.y) && ((sawx - sawwidth) <= maxCoords.x)) {
_root["foreground" + _root.level]["saw" + i].moveupright = true;
_root["foreground" + _root.level]["saw" + i].moveupleft = false;
} else if (((sawy - sawheight) <= maxCoords.y) && ((sawx - sawwidth) >= maxCoords.x)) {
_root["foreground" + _root.level]["saw" + i].movedownright = true;
_root["foreground" + _root.level]["saw" + i].moveupright = false;
} else if (((sawy - sawheight) >= maxCoords.y) && ((sawx + sawwidth) >= minCoords.x)) {
_root["foreground" + _root.level]["saw" + i].movedownleft = true;
_root["foreground" + _root.level]["saw" + i].movedownright = false;
} else if (((sawy + sawheight) >= minCoords.y) && ((sawx + sawwidth) <= minCoords.x)) {
_root["foreground" + _root.level]["saw" + i].moveupleft = true;
_root["foreground" + _root.level]["saw" + i].movedownleft = false;
}
if (_root["foreground" + _root.level]["saw" + i].moveupright) {
sawx = sawx + _root.sawspeed;
} else if (_root["foreground" + _root.level]["saw" + i].movedownright) {
sawy = sawy + _root.sawspeed;
} else if (_root["foreground" + _root.level]["saw" + i].movedownleft) {
sawx = sawx - _root.sawspeed;
} else if (_root["foreground" + _root.level]["saw" + i].moveupleft) {
sawy = sawy - _root.sawspeed;
}
if (_root.ickibod.hitbox.hitTest(_root["foreground" + _root.level]["saw" + i])) {
damageIckibod();
}
sawPlace = {};
sawPlace.x = sawx;
sawPlace.y = sawy;
_root["foreground" + _root.level].localToGlobal(sawPlace);
if ((((sawPlace.x > -50) && (sawPlace.x < (_root.stagewidth + 50))) && (sawPlace.y > -50)) && (sawPlace.y < (_root.stageheight + 50))) {
sawonstage++;
}
_root["foreground" + _root.level]["saw" + i]._x = sawx;
_root["foreground" + _root.level]["saw" + i]._y = sawy;
i++;
}
if (sawonstage > 0) {
_root.sawsound.setVolume(60);
} else {
_root.sawsound.setVolume(0);
}
}
function moveBoss() {
if (_root.boss) {
now = getTimer();
if (_root.bossmc.dead && (!_root.bossdied)) {
_root.bossmc.warping = false;
_root.bossmc.dewarp = false;
_root.bossmc.gotoAndStop(2);
}
if (_root.bossdied && (_root.goldenbucket._x == undefined)) {
_root.bossmc.removeMovieClip();
_root.attachMovie("goldenbucket", "goldenbucket", _root.d++);
_root.goldenbucket._x = _root.stagewidth / 2;
_root.goldenbucket._y = _root.stageheight / 2;
}
if (_root.ickibod.hitbox.hitTest(_root.goldenbucket)) {
_root.destroyStage();
_root.gotoAndStop("endofgame");
_root.boss = false;
_root.gameend = true;
}
if ((_root.bossmc._alpha <= 0) && (!_root.bossmc.dead)) {
plat = Math.round(Math.random() * 3) + 2;
minCoords = getPlatformBounds(plat, "min", true);
maxCoords = getPlatformBounds(plat, "max", true);
_root.bossmc._x = minCoords.x + ((maxCoords.x - minCoords.x) / 2);
_root.bossmc._y = (minCoords.y - _root.bossmc._height) + 10;
_root.bossmc.warping = true;
if ((_root.stagewidth / 2) > _root.bossmc._x) {
_root.bossmc._xscale = -100;
bdir = -1;
} else {
_root.bossmc._xscale = 100;
bdir = 1;
}
}
if ((_root.ickibod.hitbox.hitTest(_root.bossmc) && (!_root.bossmc.warping)) && (!_root.bossmc.dewarp)) {
damageIckibod();
}
if (_root.bossmc.warping) {
_root.bossmc._alpha = _root.bossmc._alpha + 5;
if (_root.bossmc._alpha >= 100) {
_root.bossmc.warping = false;
_root.bossmc.fire = true;
}
}
if (_root.bossmc.dewarp && ((now - _root.firetime) > 1000)) {
_root.bossmc._alpha = _root.bossmc._alpha - 5;
if (_root.bossmc._alpha <= 0) {
_root.bossmc.dewarp = false;
}
}
if (_root.bossmc.fire) {
_root.bossmc.fireme = true;
_root.cat.start(0, 1);
_root.zooka.start(0, 1);
_root.attachMovie("b-bullet", "bbullet" + _root.bbullets, _root.d++);
_root["bbullet" + _root.bbullets].gotoAndStop(Math.round(Math.random() * 2) + 1);
_root["bbullet" + _root.bbullets].dir = bdir;
_root["bbullet" + _root.bbullets]._xscale = 100 * bdir;
_root["bbullet" + _root.bbullets]._x = (_root.bossmc._x - ((_root.bossmc._width / 2) * bdir)) - ((_root["bbullet" + _root.bbullets]._width / 2) * bdir);
_root["bbullet" + _root.bbullets]._y = _root.bossmc._y + 40;
_root["bbullet" + _root.bbullets]._y = Coords.y;
_root.bbullets++;
if (_root.bbullets > _root.maxbbullets) {
_root.bbullets = 0;
}
_root.bossmc.fire = false;
_root.firetime = getTimer();
}
}
i = 0;
while (i <= _root.maxbbullets) {
_root["bbullet" + i]._x = _root["bbullet" + i]._x - (20 * _root["bbullet" + i].dir);
if ((_root["bbullet" + i]._x > 700) || (_root["bbullet" + i]._x < -100)) {
_root.bossmc.dewarp = true;
_root["bbullet" + i].removeMovieClip();
}
if (_root.ickibod.hitbox.hitTest(_root["bbullet" + i])) {
_root["bbullet" + i].removeMovieClip();
_root.bossmc.dewarp = true;
damageIckibod();
}
i++;
}
}
function nextLevel() {
if ((_root.ickibod.hitTest(_root["foreground" + _root.level].bucket) && (_root.exit._x == undefined)) && (enemies == enemycurrent)) {
stopAllSounds();
destroyStage();
createEmptyMovieClip("nocandys", _root.d++);
_root.nocandy = new Sound(nocandys);
_root.nocandy.attachSound("no-candy");
_root.nocandy.start(0, 1);
_root.attachMovie("exit-" + _root.level, "exit", _root.d++);
_root.exit.startime = getTimer();
}
if ((_root.ickibod.hitTest(_root["foreground" + _root.level].bucket) && (_root.exit._x == undefined)) && (enemies != enemycurrent)) {
_root.stats.kill._visible = true;
} else {
_root.stats.kill._visible = false;
}
if ((getTimer() - _root.exit.startime) > 5000) {
stopAllSounds();
destroyStage();
_root.level++;
if (_root.level == 4) {
_root.boss = true;
}
_root.inlevel = false;
initializeLevel();
}
}
function initalizeLevel() {
if (!_root.inlevel) {
if (_root["intro-" + _root.level]._x == undefined) {
stopAllSounds();
destroyStage();
_root.attachMovie("intro-" + _root.level, "intro-" + _root.level, _root.d++);
_root["intro-" + _root.level]._x = 0;
_root["intro-" + _root.level]._y = 0;
_root["intro-" + _root.level].placed = getTimer();
}
if ((_root["intro-" + _root.level]._x == 0) && ((getTimer() - _root["intro-" + _root.level].placed) > 2500)) {
_root.inlevel = true;
createLevel();
}
}
}
function createLevel() {
origy = new Array(50, -350, -800, -250);
saws1 = new Array(3, 13, 14, 19, 21);
rats1 = new Array(4, 11, 13, 23);
bats1 = new Array(3, 7, 21, 23);
skulls1 = new Array(2, 6, 15);
slugs1 = [];
dodges1 = [];
rabbits1 = [];
platforms1 = 24;
saws2 = new Array(6, 13, 16, 22);
rats2 = new Array(3, 7, 16);
bats2 = new Array(3, 10, 18, 22);
skulls2 = new Array(14, 25);
slugs2 = [2, 11, 23];
dodges2 = [4, 8, 24];
rabbits2 = [];
platforms2 = 28;
saws3 = [5, 10, 15, 17, 24];
rats3 = [2, 16];
bats3 = [3, 7, 11, 23, 25];
skulls3 = [6, 14];
slugs3 = [15];
dodges3 = [10];
rabbits3 = [3, 12, 21];
platforms3 = 28;
saws4 = [];
rats4 = [];
bats4 = [];
skulls4 = [];
slugs4 = [];
dodges4 = [];
rabbits4 = [];
platforms4 = 5;
_root.attachMovie("bg" + _root.level, "bg" + _root.level, _root.d++);
_root["bg" + _root.level]._x = 0;
_root["bg" + _root.level]._y = _root.stageheight - _root["bg" + _root.level]._height;
_root.attachMovie("foreground" + _root.level, "foreground" + _root.level, _root.d++);
_root["foreground" + _root.level]._x = 0;
_root.attachMovie("logo", "logo", 100000);
_root.logo._x = 0;
_root.logo._y = 0;
_root.logo._alpha = 50;
_root["foreground" + _root.level].origy = (_root["foreground" + _root.level]._y = (_root.stageheight - _root["foreground" + _root.level]._height) - origy[_root.level - 1]);
_root["foreground" + _root.level].saws = this["saws" + _root.level];
_root["foreground" + _root.level].rats = this["rats" + _root.level];
_root["foreground" + _root.level].bats = this["bats" + _root.level];
_root["foreground" + _root.level].skulls = this["skulls" + _root.level];
_root["foreground" + _root.level].slugs = this["slugs" + _root.level];
_root["foreground" + _root.level].dodges = this["dodges" + _root.level];
_root["foreground" + _root.level].rabbits = this["rabbits" + _root.level];
_root["foreground" + _root.level].platforms = this["platforms" + _root.level];
stopAllSounds();
sawsoundmc = createEmptyMovieClip("sawsoundmc", _root.d++);
_root.sawsound = new Sound(sawsoundmc);
_root.sawsound.attachSound("saw-sound");
_root.sawsound.start(0, 10000000);
_root.sawsound.setVolume(0);
skullsoundmc = createEmptyMovieClip("skullsoundmc", _root.d++);
_root.skullidle = new Sound(skullsoundmc);
_root.skullidle.attachSound("skull-idle");
_root.skullidle.start(0, 10000000);
_root.skullidle.setVolume(0);
levelsoundmc = createEmptyMovieClip("levelsoundmc", _root.d++);
_root.levelsound = new Sound(levelsoundmc);
_root.levelsound.attachSound("level-" + _root.level);
_root.levelsound.start(0, 10000000);
_root.levelsound.setVolume(80);
ickiboddiemc = createEmptyMovieClip("ickiboddiemc", _root.d++);
_root.ickiboddie = new Sound(ickiboddiemc);
_root.ickiboddie.attachSound("ickibod-die");
ratdiemc = createEmptyMovieClip("ratdiemc", _root.d++);
_root.ratdie = new Sound(ratdiemc);
_root.ratdie.attachSound("rat-die");
rabbitdiemc = createEmptyMovieClip("rabbitdiemc", _root.d++);
_root.rabbitdie = new Sound(rabiitdiemc);
_root.rabbitdie.attachSound("rabbit-die");
dodgediemc = createEmptyMovieClip("dodgediemc", _root.d++);
_root.dodgedie = new Sound(dodgediemc);
_root.dodgedie.attachSound("dodge-die");
cat = createEmptyMovieClip("cat", _root.d++);
_root.cat = new Sound(cat);
_root.cat.attachSound("cat");
bossdie = createEmptyMovieClip("bossdie", _root.d++);
_root.bossdie = new Sound(bossdie);
_root.bossdie.attachSound("boss-die");
bosshit = createEmptyMovieClip("bosshit", _root.d++);
_root.bosshit = new Sound(bosshit);
_root.bosshit.attachSound("boss-hit");
zooka = createEmptyMovieClip("zooka", _root.d++);
_root.zooka = new Sound(zooka);
_root.zooka.attachSound("zooka");
batdiemc = createEmptyMovieClip("batdiemc", _root.d++);
_root.batdie = new Sound(batdiemc);
_root.batdie.attachSound("bat-die");
slugdiemc = createEmptyMovieClip("slugdiemc", _root.d++);
_root.slugdie = new Sound(slugdiemc);
_root.slugdie.attachSound("slug-die");
skulldiemc = createEmptyMovieClip("skulldiemc", _root.d++);
_root.skulldie = new Sound(skulldiemc);
_root.skulldie.attachSound("skull-die");
ickibodshoot = createEmptyMovieClip("ickibodshoot", _root.d++);
_root.ickibodshoot = new Sound(ickibodshoot);
_root.ickibodshoot.attachSound("ickibod-shoot");
_root.ickibodshoot.setVolume(100);
_root.attachMovie("ickibod", "ickibod", _root.d++);
_root.ickibod.hitbox._visible = false;
_root.ickibod._x = 30;
_root.ickibod.lastfired = (_root.ickibod.timer = getTimer() - 1000);
_root.ickibod.maxbullets = 10;
_root.ickibod.bulletcount = 0;
_root.ickibod.jumpheight = 0;
_root.ickibod.dieing = false;
_root.ickibod.dir = 1;
_root.ickibod.blink = 0;
if (_root.boss) {
_root.attachMovie("boss", "bossmc", _root.d++);
_root.bossmc._x = -200;
_root.bossmc._alpha = 0;
_root.bossmc.health = 7;
_root.bossmc.dead = false;
_root.ickibod._x = _root.stagewidth / 2;
_root.ickibod._y = _root.stageheight / 2;
}
i = 0;
while (i < this["saws" + _root.level].length) {
minCoords = getPlatformBounds(this["saws" + _root.level][i], "min", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + this["saws" + _root.level][i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + this["saws" + _root.level][i]]._y;
_root["foreground" + _root.level].attachMovie("saw", "saw" + i, _root.d++);
_root["foreground" + _root.level]["saw" + i]._x = minCoords.x - (_root["foreground" + _root.level]["saw" + i]._width / 2);
_root["foreground" + _root.level]["saw" + i]._y = minCoords.y - (_root["foreground" + _root.level]["saw" + i]._height / 2);
i++;
}
enemies = 0;
enemycurrent = 0;
i = 0;
while (i < this["rats" + _root.level].length) {
enemies++;
minCoords = getPlatformBounds(this["rats" + _root.level][i], "min", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + this["rats" + _root.level][i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + this["rats" + _root.level][i]]._y;
_root["foreground" + _root.level].attachMovie("rat", "rat" + i, _root.d++);
_root["foreground" + _root.level]["rat" + i]._x = minCoords.x + (_root["foreground" + _root.level]["rat" + i]._width / 2);
_root["foreground" + _root.level]["rat" + i]._y = minCoords.y - _root["foreground" + _root.level]["rat" + i]._height;
i++;
}
i = 0;
while (i < this["bats" + _root.level].length) {
enemies++;
bvel = _root.batspeed;
minCoords = getPlatformBounds(this["bats" + _root.level][i], "max", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + this["bats" + _root.level][i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + this["bats" + _root.level][i]]._y;
_root["foreground" + _root.level].attachMovie("bat", "bat" + i, _root.d++);
_root["foreground" + _root.level]["bat" + i]._rotation = -90;
_root["foreground" + _root.level]["bat" + i]._x = minCoords.x + _root["foreground" + _root.level]["bat" + i]._width;
_root["foreground" + _root.level]["bat" + i]._y = minCoords.y - _root["foreground" + _root.level]["bat" + i]._height;
_root["foreground" + _root.level]["bat" + i].bvel = bvel;
_root["foreground" + _root.level]["bat" + i].origy = _root["foreground" + _root.level]["bat" + i]._y;
i++;
}
i = 0;
while (i < this["skulls" + _root.level].length) {
enemies++;
minCoords = getPlatformBounds(this["skulls" + _root.level][i], "min", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + this["skulls" + _root.level][i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + this["skulls" + _root.level][i]]._y;
_root["foreground" + _root.level].attachMovie("skull", "skull" + i, _root.d++);
_root["foreground" + _root.level]["skull" + i]._x = minCoords.x + _root["foreground" + _root.level]["skull" + i]._width;
_root["foreground" + _root.level]["skull" + i]._y = (minCoords.y - (_root["foreground" + _root.level]["skull" + i]._height / 2)) + 1;
_root["foreground" + _root.level]["skull" + i].lastfired = getTimer();
i++;
}
i = 0;
while (i < this["slugs" + _root.level].length) {
enemies++;
minCoords = getPlatformBounds(this["slugs" + _root.level][i], "min", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + this["slugs" + _root.level][i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + this["slugs" + _root.level][i]]._y;
_root["foreground" + _root.level].attachMovie("slug", "slug" + i, _root.d++);
_root["foreground" + _root.level]["slug" + i]._x = minCoords.x + _root["foreground" + _root.level]["slug" + i]._width;
_root["foreground" + _root.level]["slug" + i]._y = (minCoords.y - _root["foreground" + _root.level]["slug" + i]._height) + 6;
i++;
}
i = 0;
while (i < this["dodges" + _root.level].length) {
enemies++;
minCoords = getPlatformBounds(this["dodges" + _root.level][i], "min", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + this["dodges" + _root.level][i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + this["dodges" + _root.level][i]]._y;
_root["foreground" + _root.level].attachMovie("dodge", "dodge" + i, _root.d++);
_root["foreground" + _root.level]["dodge" + i]._x = minCoords.x + _root["foreground" + _root.level]["dodge" + i]._width;
_root["foreground" + _root.level]["dodge" + i]._y = (minCoords.y - _root["foreground" + _root.level]["dodge" + i]._height) + 3;
i++;
}
i = 0;
while (i < this["rabbits" + _root.level].length) {
enemies++;
minCoords = getPlatformBounds(this["rabbits" + _root.level][i], "min", false);
minCoords.x = minCoords.x + _root["foreground" + _root.level]["sg" + this["rabbits" + _root.level][i]]._x;
minCoords.y = minCoords.y + _root["foreground" + _root.level]["sg" + this["rabbits" + _root.level][i]]._y;
_root["foreground" + _root.level].attachMovie("rabbit", "rabbit" + i, _root.d++);
_root["foreground" + _root.level]["rabbit" + i]._x = minCoords.x + _root["foreground" + _root.level]["rabbit" + i]._width;
_root["foreground" + _root.level]["rabbit" + i]._y = (minCoords.y - _root["foreground" + _root.level]["rabbit" + i]._height) + 3;
i++;
}
_root.attachMovie("stats", "stats", _root.d + 10000);
_root.stats._x = 640;
_root.stats._y = 360;
}
function destroyStage() {
stopAllSounds();
for (i in _root) {
_root[i].removeMovieClip();
}
}
stop();
starttime = getTimer();
gamescore = 0;
gamescored = 0;
gamescoreb = 0;
gameend = false;
boss = false;
bossdied = false;
vel = 7;
jump = false;
fall = false;
jumpheight = -15;
gameover = false;
inlevel = false;
lives = 9;
stagewidth = 650;
stageheight = 400;
level = 1;
bossdie = false;
sawspeed = 10;
ratspeed = 3;
batspeed = 8;
slugspeed = 3;
dodgespeed = 5;
skullspeed = 4;
rabbitspeed = 7;
bulletspeed = 15;
firerate = 1000;
maxsbullets = 50;
sbulletcount = 0;
bbullets = 0;
maxbbullets = 5;
onEnterFrame = function () {
initalizeLevel();
nextLevel();
if (_root.level == 4) {
_root.boss = true;
}
if (((_root.inlevel && (_root.exit._x == undefined)) && (!gameover)) && (!gameend)) {
detectKeys(vel, jump, fall);
jumpCharacter(jump, fall);
ground(jump, fall);
sawBlades();
blinkIckibod();
dieingIckibod();
shoot(false);
moveBullets(_root.ymod, 0, null);
moveRats();
moveBats();
moveSkulls();
moveSlugs();
moveDodges();
moveRabbits();
moveBoss();
}
};
Frame 5
stop();
_root.gamescore = Math.floor((((getTimer() - _root.starttime) / 1000) + _root.gamescoreb) + _root.gamescored);
Instance of Symbol 497 MovieClip in Frame 5
//component parameters
onClipEvent (construct) {
_game_name = "Rhythm_Day";
score_var = "_root.score";
}
Symbol 74 MovieClip Frame 4
stop();
Symbol 75 MovieClip [ickibod] Frame 1
stop();
Symbol 226 MovieClip Frame 10
stop();
Symbol 227 MovieClip [rat] Frame 1
stop();
Symbol 246 MovieClip Frame 8
stop();
Symbol 247 MovieClip [bat] Frame 1
stop();
Symbol 254 MovieClip Frame 1
stop();
Symbol 263 MovieClip [skull] Frame 1
stop();
Symbol 275 MovieClip Frame 1
stop();
Symbol 279 MovieClip [stats] Frame 1
this.kill._visible = false;
Symbol 299 MovieClip Frame 5
stop();
Symbol 300 MovieClip [slug] Frame 1
stop();
Symbol 314 MovieClip Frame 7
stop();
Symbol 315 MovieClip [dodge] Frame 1
stop();
Symbol 339 Button
on (release) {
_root.instructions._visible = false;
_root.menus.playbutton._x = _root.menus.playbutton.origx;
_root.menus.qualitybutton._x = _root.menus.qualitybutton.origx;
_root.menus.instructionsbutton._x = _root.menus.instructionsbutton.origx;
_root.menus.linky._x = _root.menus.linky.origx;
}
Symbol 361 MovieClip Frame 6
stop();
Symbol 362 MovieClip [rabbit] Frame 1
stop();
Symbol 369 Button
on (release) {
_root.gotoAndStop("menuframe");
_root.destroyStage();
}
Symbol 374 MovieClip [logo] Frame 1
this.onRelease = function () {
getURL ("http://www.freeworldgroup.com", "_blank");
};
Symbol 380 Button
on (release) {
if (_root._quality == "LOW") {
_root._quality = "MEDIUM";
} else if (_root._quality == "MEDIUM") {
_root._quality = "HIGH";
} else if (_root._quality == "HIGH") {
_root._quality = "LOW";
}
}
Symbol 386 Button
on (release) {
_root.instructions._visible = true;
this.playbutton.origx = this.playbutton._x;
this.qualitybutton.origx = this.qualitybutton._x;
this.instructionsbutton.origx = this.instructionsbutton._x;
this.linky.origx = this.linky._x;
this.playbutton._x = -200;
this.qualitybutton._x = -200;
this.instructionsbutton._x = -200;
this.linky._x = -200;
}
Symbol 392 Button
on (release) {
_root.play();
}
Symbol 398 Button
on (release) {
getURL ("http://www.freeworldgroup.com/", "_blank");
}
Symbol 404 Button
on (release) {
getURL ("http://www.freeworldgroup.com/score/index.asp?game=ickibod", "_blank");
}
Symbol 409 Button
on (release) {
getURL ("http://www.freeworldgroup.com/koalafiles.htm", "_blank");
}
Symbol 434 MovieClip Frame 1
stop();
onEnterFrame = function () {
if (_root.bossmc.fireme) {
play();
}
};
Symbol 434 MovieClip Frame 6
stop();
_root.bossmc.fireme = false;
onEnterFrame = function () {
if (_root.bossmc._alpha <= 0) {
gotoAndStop (1);
}
};
Symbol 441 MovieClip Frame 1
_root.bossdie.start(0, 1);
Symbol 441 MovieClip Frame 35
stop();
_root.bossdied = true;
Symbol 442 MovieClip [boss] Frame 1
stop();
Symbol 446 MovieClip [b-bullet] Frame 1
stop();
Symbol 451 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
bar._xscale = PercentLoaded;
} else {
gotoAndStop ("loaded");
}
Symbol 451 MovieClip Frame 2
gotoAndPlay (1);
Symbol 451 MovieClip Frame 3
_root.play();
Symbol 459 Button
on (release) {
getURL ("http://www.freeworldgroup.com/", "_blank");
}
Symbol 460 MovieClip Frame 33
_root.gotoAndStop("menuframe");
Symbol 467 Button
on (release) {
_root.gotoAndStop("menuframe");
destroyStage();
}
Symbol 475 Button
on (release) {
gotoAndStop ("submit");
}
Symbol 480 Button
on (release) {
gotoAndStop (1);
}
Symbol 491 Button
on (release) {
gotoAndStop ("submited");
}
Symbol 496 Button
on (release) {
viewHighscore();
}
Symbol 497 MovieClip Frame 1
stop();
_global.game_name = "ickibod";
var highscore = _root.gamescore;
_global.viewHighscore = function () {
getURL ("http://www.freeworldgroup.com/score/index.asp?game=" + game_name, "_blank");
};
if (highscore == 0) {
this._visible = false;
}
trace(game_name);
trace(highscore);
trace("http://www.freeworldgroup.com/score/index.asp?game=" + game_name);
Symbol 497 MovieClip Frame 3
function sendData() {
send_var.game = game_name;
send_var.score = highscore;
send_var.name = name_txt.text;
if (send_var.name == "") {
send_var.name = "guest" + int(Math.random() * 1000);
}
send_var.sendAndLoad("http://www.freeworldgroup.com/score/score.asp", load_var, "POST");
gotoAndStop ("sending");
}
stop();
gold_txt.text = highscore;
send_var = new LoadVars();
load_var = new LoadVars();
ok_btn.onRelease = sendData;
load_var.onLoad = function () {
gotoAndStop ("done");
};
Instance of Symbol 477 MovieClip in Symbol 497 MovieClip Frame 3
on (release) {
}