Frame 1
stop();
checkLoadedTimer = setInterval(_root, "checkLoaded", 10);
checkLoaded = function () {
var _local2 = _root;
var _local1;
_local1 = Math.round((_local2.getBytesLoaded() / _local2.getBytesTotal()) * 100);
loader.bar.gotoAndStop(_local1);
if (_local1 == 100) {
clearInterval(checkLoadedTimer);
_local2.gotoAndPlay("loaded");
}
};
Frame 2
onLoaded = function () {
chewy_mc.startgame();
};
Instance of Symbol 148 MovieClip "chewy_mc" in Frame 2
onClipEvent (load) {
hexencode = function (thevalue) {
var _local1 = thevalue;
if (_local1 >= 10) {
return(chr((65 + _local1) - 10));
}
return(chr(48 + _local1));
};
hexdecode = function (thecharacter) {
var _local1 = ord(thecharacter);
if (_local1 >= 97) {
return((10 + _local1) - 97);
}
if (_local1 >= 65) {
return((10 + _local1) - 65);
}
return(_local1 - 48);
};
urlencode = function (astring) {
var thestring = String(astring);
var _local2 = new String("");
var _local3 = 0;
while (_local3 < thestring.length) {
var _local1 = ord(thestring.charAt(_local3));
if (((((((_local1 >= 48) && (_local1 <= 57)) || ((_local1 >= 65) && (_local1 <= 90))) || ((_local1 >= 97) && (_local1 <= 122))) || (_local1 == 95)) || (_local1 == 45)) || (_local1 == 46)) {
_local2 = _local2.concat(chr(_local1));
} else if (_local1 == 32) {
_local2 = _local2.concat("+");
} else {
_local2 = _local2.concat("%");
var firstdigit = 0;
while (_local1 >= 16) {
firstdigit++;
_local1 = _local1 - 16;
}
_local2 = _local2.concat(hexencode(firstdigit));
_local2 = _local2.concat(hexencode(_local1));
}
_local3++;
}
return(_local2);
};
urldecode = function (astring) {
var thestring = String(astring);
var _local2 = new String("");
var _local1 = 0;
while (_local1 < thestring.length) {
var _local3 = thestring.charAt(_local1);
if (_local3 == "%") {
var hex = thestring.substr(_local1 + 1, 2);
_local1 = _local1 + 2;
var charactercode = ((hexdecode(hex.charAt(0)) * 16) + hexdecode(hex.charAt(1)));
_local2 = _local2.concat(chr(charactercode));
} else if (_local3 == "+") {
_local2 = _local2.concat(" ");
} else {
_local2 = _local2.concat(_local3);
}
_local1++;
}
return(_local2);
};
md5hash = function (thedata, thepassword, decode) {
var md5key = new Array(255);
var _local1 = new Array(255);
var data = new String(thedata);
var password = new String(thepassword);
var pwd_length = password.length;
if (decode) {
data = urldecode(data);
}
var i;
var x;
var i = 0;
while (i <= 255) {
md5key[i] = ord(password.charAt(i % pwd_length));
_local1[i] = i;
i++;
}
var x = 0;
var i = 0;
while (i <= 255) {
x = ((x + _local1[i]) + md5key[i]) % 256;
var temp_swap = _local1[i];
_local1[i] = _local1[x];
_local1[x] = temp_swap;
i++;
}
var cipher = new String("");
var _local2 = 0;
var _local3 = 0;
var i = 0;
while (i < data.length) {
_local2 = (_local2 + 1) % 256;
_local3 = (_local3 + _local1[_local2]) % 256;
var temp = _local1[_local2];
_local1[_local2] = _local1[_local3];
_local1[_local3] = temp;
var k = _local1[(_local1[_local2] + _local1[_local3]) % 256];
var cipherby = (ord(data.charAt(i)) ^ k);
if (cipherby != 0) {
cipher = cipher.concat(urlencode(chr(cipherby)));
} else {
cipher = cipher.concat("%00");
}
i++;
}
if (decode) {
cipher = urldecode(cipher);
}
return(cipher);
};
initSounds = function () {
var _local2 = ["fireball", "hitbybag", "baghit", "bonus", "eat", "chew", "hittop", "floorraise", "loop", "death"];
var _local3;
var _local1 = 0;
while (_local1 < _local2.length) {
_local3 = (_root[_local2[_local1] + "_sound"] = new Sound());
_local3.attachSound(_local2[_local1]);
_local1++;
}
_root.chew_sound.onSoundComplete = function () {
this.completed = true;
};
_root.chew_sound.completed = true;
_root.loop_sound.start(0, 10000);
};
initSounds();
play_chewyshootsafireball_sound = function () {
_root.fireball_sound.start();
};
play_chewyhitbybag_sound = function () {
_root.hitbybag_sound.start();
};
play_baghitbyfireball_sound = function () {
_root.baghit_sound.start();
};
play_bonusbombhitbyfireball_sound = function () {
_root.bonus_sound.start();
};
play_chewyeatsachewit_sound = function () {
var _local1 = _root;
_local1.eat_sound.start();
if (_local1.chew_sound.completed) {
_local1.chew_sound.completed = false;
_local1.chew_sound.start();
}
};
play_chewyhitsthetop_sound = function () {
_root.hittop_sound.start();
};
start_floorraising_noise = function () {
_root.floorraise_sound.start();
};
stop_floorraising_noise = function () {
};
play_death_sound = function () {
_root.death_sound.start();
};
SCREEN_WIDTH = 400;
SCREEN_HEIGHT = 520;
CHEWY_SCALE = 33.3333333333333;
START_Y = 478;
CHEWY_WIDTH = (270.8 * CHEWY_SCALE) / 100;
CHEWY_HEIGHT = (377 * CHEWY_SCALE) / 100;
CHEWY_Y_ADJUST = 60;
CHEWY_X_ADJUST = 0;
CHEWIT_SCALE = 50;
MIN_X = 10;
MAX_X = 390;
MAX_BAGS = 16;
MAX_FLAMES = 8;
MAX_CHEWITS = 32;
ANIMATION_START_FRAME = 0;
ANIMATION_END_FRAME = 1;
ANIMATION_CURRENT_FRAME = 2;
ANIMATION_FRAMETIME = 3;
ANIMATION_SPEED = 4;
IDLE_ANIMATION = 0;
WALK_ANIMATION = 1;
HIT_ANIMATION = 2;
CHEW_IDLE_ANIMATION = 3;
CHEW_WALK_ANIMATION = 4;
SUCK_IDLE_ANIMATION = 5;
SUCK_WALK_ANIMATION = 6;
FIRE_IDLE_ANIMATION = 7;
FIRE_WALK_ANIMATION = 8;
CHEWY_STATE_OK = 0;
CHEWY_STATE_HIT = 1;
CHEWY_STATE_CHEWING = 2;
CHEWY_STATE_FIRING = 3;
GAMESTATE_NOT_PLAYING = 0;
GAMESTATE_PLAYING = 1;
GAMESTATE_GAME_OVER_FADE = 2;
GAMESTATE_GAME_OVER = 3;
GAMESTATE_TITLE_SCREEN = 4;
GAMESTATE_INTRO_SCREEN = 5;
GAMESTATE_GAME_OVER_HISCORE_ENTRY = 6;
GAMESTATE_GAME_OVER_HISCORES = 7;
GAMESTATE_PAUSED = 8;
GAMESTATE_PAUSED_WAIT = 9;
GAMESTATE_PLAYING_WAIT = 10;
CHEWY_FACING_LEFT = 0;
CHEWY_FACING_RIGHT = 1;
HIT_TIME_MAXIMUM = 20;
TOPSPEED = 240;
_alpha = 0;
_parent.gamestate = GAMESTATE_NOT_PLAYING;
_xscale = CHEWY_SCALE;
_yscale = CHEWY_SCALE;
resettime = function () {
_parent.starttime = getTimer();
_parent.lasttime = 0;
};
grabtime = function () {
var _local1 = _parent;
_local1.thistime = getTimer() - _local1.starttime;
if (_local1.lasttime > 0) {
_local1.delta = _local1.thistime - _local1.lasttime;
} else {
_local1.delta = 1;
}
_local1.delta = _local1.delta / 61.25;
_local1.lasttime = _local1.thistime;
};
getthistime = function () {
return(_parent.thistime - _parent.starttime);
};
scaletime = function () {
var _local1 = getthistime() / (TOPSPEED * 1000);
if (_local1 < 0) {
_local1 = 0;
}
if (_local1 > 1) {
_local1 = 1;
}
return(_local1);
};
newbagx = function () {
var _local1 = 40;
return((MIN_X + _local1) + (((MAX_X - (2 * _local1)) - MIN_X) * Math.random()));
};
getpoints = function () {
var _local1 = 1;
var _local2 = 20;
return(Math.Floor(_local1 + ((_local2 - _local1) * easeinfastout(scaletime()))) * 10);
};
updatescore = function (thescore) {
var _local1 = _parent;
if ((currentbonusbbomb < bonusbombsat.length) && (thescore >= bonusbombsat[currentbonusbomb])) {
_local1.bonusbomb._visible = true;
_local1.bonusbomb.bombtime = 0;
_local1.bonusbomb._x = newbagx();
_local1.bonusbomb._y = -32;
currentbonusbomb++;
}
_local1.scoretext.text = "Score " + thescore;
myformat2 = new TextFormat();
myformat2.color = 65535;
myformat2.font = "MarkerFeltWide";
myformat2.align = "left";
myformat2.size = 18;
_local1.scoretext.embedFonts = true;
_local1.scoretext.setTextFormat(myformat2);
_local1.scoretext.embedFonts = true;
myformat1 = new TextFormat();
myformat1.color = 16777215 /* 0xFFFFFF */;
myformat1.font = "MarkerFeltWide";
myformat1.align = "left";
myformat1.size = 18;
_local1.scoretext.embedFonts = true;
_local1.scoretext.setTextFormat(0, 5, myformat1);
_local1.scoretext.embedFonts = true;
};
addchewitscore = function (c, s, combo) {
var _local1 = _parent;
var _local2 = c;
myformat2 = new TextFormat();
myformat2.color = 16777215 /* 0xFFFFFF */;
myformat2.font = "MarkerFeltWide";
myformat2.align = "center";
myformat2.size = 12;
_local1["chewitscore" + _local2]._visible = true;
_local1["chewitscore" + _local2].scoretime = 0;
_local1["chewitscore" + _local2].text = "+" + s;
_local1["chewitscore" + _local2].embedFonts = true;
_local1["chewitscore" + _local2].setTextFormat(myformat2);
_local1["chewitscore" + _local2].embedFonts = true;
_local1["chewitscore" + _local2]._x = _local1["chewit" + _local2]._x - (_local1["chewitscore" + _local2]._width / 2);
_local1["chewitscore" + _local2]._y = _local1["chewit" + _local2]._y - (_local1["chewitscore" + _local2]._height / 2);
if (combo > 0) {
_local1.comboscore._visible = true;
_local1.comboscore.scoretime = 0;
_local1.comboscore.text = (combo + 1) + "x combo!";
myformat1 = new TextFormat();
myformat1.color = 16711680 /* 0xFF0000 */;
myformat1.font = "MarkerFeltWide";
myformat1.align = "center";
myformat1.size = 14;
_local1.comboscore.embedFonts = true;
_local1.comboscore.setTextFormat(myformat1);
_local1.comboscore.embedFonts = true;
_local1.comboscore._x = _local1["chewit" + _local2]._x - (_local1.comboscore._width / 2);
_local1.comboscore._y = _local1["chewitscore" + _local2]._y + (_local1["chewitscore" + _local2]._height / 2);
}
};
setdebugtext = function (thetext) {
var _local1 = _parent;
_local1.debugtext.text = "" + thetext;
myformat2 = _local1.debugtext.getTextFormat();
myformat2.color = 16777215 /* 0xFFFFFF */;
myformat2.font = "MarkerFeltWide";
myformat2.align = "left";
myformat2.size = 18;
_local1.debugtext.setTextFormat(myformat2);
};
chewy_start_y = function () {
return((START_Y - (CHEWY_HEIGHT / 2)) + CHEWY_Y_ADJUST);
};
setfloorpos = function () {
_parent.floor_mc._y = ((START_Y - 4) + base_y) - chewy_start_y();
};
updatefloor = function () {
var _local1 = _parent;
var _local2 = 1;
if (base_y > desired_base_y) {
if (!_local1.floorsoundplaying) {
start_floorraising_noise();
_local1.floorsoundplaying = true;
}
base_y = base_y - (_local2 * _local1.delta);
if (base_y < desired_base_y) {
base_y = desired_base_y;
}
if (chewystate != CHEWY_STATE_HIT) {
_y = base_y;
}
setfloorpos();
} else if (_local1.floorsoundplaying) {
stop_floorraising_noise();
_local1.floorsoundplaying = false;
}
};
fastineaseout = function (n) {
var _local1 = 1 - n;
return(1 - (_local1 * _local1));
};
easeinfastout = function (n) {
return(n * n);
};
easeineaseout = function (n) {
var _local1 = n;
if (_local1 < 0.5) {
return(2 * (_local1 * _local1));
}
return(((2 * _local1) * (2 - _local1)) - 1);
};
getbagrate = function () {
return(40 - (38 * scaletime()));
};
bagfallrate = function () {
return((4 + (20 * easeineaseout(scaletime()))) * _parent.delta);
};
bagcollison = function (c) {
var _local2 = c;
var _local3 = _parent;
var _local1 = 0;
while (_local1 < hitarray.length) {
if (_local3["bag" + _local2].hittest(hitarray[_local1][0] + _x, hitarray[_local1][1] + _y)) {
return(true);
}
_local1++;
}
return(false);
};
getmd5password = function () {
var _local1 = 17;
var _local3 = [120, 80, 68, 11, 30, 24, 230, 225, 208, 142, 255, 210, 198, 67, 114, 64, 37, 53, 51, 18, 228, 206, 212];
var _local2 = new String("");
i = 0;
while (i < 23) {
_local2 = _local2.concat(chr(_local3[i] ^ _local1));
_local1 = (_local1 + 19) & 255;
i++;
}
return(_local2);
};
gethiscores = function () {
var _local1 = _parent;
var _local2 = getmd5password();
var _local3 = (("hashed" + score) + "-") + _local1.hiscoreentry.myname.text;
var encrypted = md5hash(_local3, _local2, false);
_local1.serverconnection.submit = encrypted;
_local1.serverconnection.sendandload("hiscores.php", _local1.serverconnection, "POST");
_local1.gamestate = GAMESTATE_GAME_OVER_HISCORES;
timeinstate = 0;
};
updatebags = function () {
var _local2 = _parent;
var BAG_START_Y = -40;
if (((chewystate == CHEWY_STATE_OK) || (chewystate == CHEWY_STATE_CHEWING)) || (chewystate == CHEWY_STATE_FIRING)) {
if (nobags == 0) {
nextbagtime = 0;
}
nextbagtime = nextbagtime - _local2.delta;
if (nextbagtime < 0) {
if (!_local2["bag" + nextbagno]._visible) {
_local2["bag" + nextbagno]._visible = true;
_local2["bag" + nextbagno].canhitchewy = true;
_local2["bag" + nextbagno]._x = newbagx();
_local2["bag" + nextbagno]._y = BAG_START_Y;
nextbagno++;
nextbagtime = getbagrate();
if (nextbagno >= MAX_BAGS) {
nextbagno = 0;
}
nobags++;
}
}
}
var BAG_OFF_BOTTOM_Y = SCREEN_HEIGHT;
var _local1 = 0;
while (_local1 < MAX_BAGS) {
if (_local2["bag" + _local1]._visible) {
_local2["bag" + _local1]._y = _local2["bag" + _local1]._y + bagfallrate();
if (_local2["bag" + _local1]._y > BAG_OFF_BOTTOM_Y) {
_local2["bag" + _local1]._visible = false;
nobags--;
var _local3 = 16;
desired_base_y = desired_base_y - _local3;
}
}
_local1++;
}
};
updateflames = function () {
var _local2 = _parent;
var _local3 = 24;
var FLAME_OFF_TOP_Y = 0;
var START_FLAME_FRAME = 5;
var MAX_FLAME_FRAME = 8;
var FLAME_FRAME_TIME = 2;
var _local1 = 0;
while (_local1 < MAX_FLAMES) {
if (_local2["flame" + _local1]._visible) {
_local2["flame" + _local1]._y = _local2["flame" + _local1]._y - (_local3 * _local2.delta);
_local2["flame" + _local1].flametime = _local2["flame" + _local1].flametime + _local2.delta;
if (_local2["flame" + _local1]._y < FLAME_OFF_TOP_Y) {
_local2["flame" + _local1]._visible = false;
}
_local2["flame" + _local1].frametime = _local2["flame" + _local1].frametime + _local2.delta;
if (_local2["flame" + _local1].frametime > FLAME_ANIM_FRAME) {
_local2["flame" + _local1].frametime = _local2["flame" + _local1].frametime - FLAME_ANIM_FRAME;
_local2["flame" + _local1].flameframe++;
if (_local2["flame" + _local1].flameframe > MAX_FLAME_FRAME) {
_local2["flame" + _local1].flameframe > START_FLAME_FRAME;
}
}
_local2["flame" + _local1].gotoAndStop(_local2["flame" + _local1].flameframe);
}
_local1++;
}
};
throwchewits = function (b, distancescale) {
var _local1 = _parent;
var _local2 = b;
var _local3 = distancescale;
createchewit(_local1["bag" + _local2]._x, _local1["bag" + _local2]._y);
if (Math.random() > (0.1 + (0.69 * _local3))) {
createchewit(_local1["bag" + _local2]._x, _local1["bag" + _local2]._y);
if (Math.random() > (0.1 + (0.79 * _local3))) {
createchewit(_local1["bag" + _local2]._x, _local1["bag" + _local2]._y);
if (Math.random() > (0.1 + (0.89 * _local3))) {
createchewit(_local1["bag" + _local2]._x, _local1["bag" + _local2]._y);
}
}
}
};
updatebomb = function () {
var _local1 = _parent;
var BOMB_FALL_RATE = 5;
var BOMB_FLASH_RATE = 2;
var BOMB_OFF_BOTTOM = 520;
if (_local1.bonusbomb._visible) {
_local1.bonusbomb.bombtime = _local1.bonusbomb.bombtime + _local1.delta;
var flashtime = (_local1.bonusbomb.bombtime / BOMB_FLASH_RATE);
var flashamount = ((Math.Sin(flashtime) / 2) + 0.5);
var MAX_ALPHA = 80;
var MIN_ALPHA = 30;
_local1.bonusbomb._alpha = MIN_ALPHA + ((MAX_ALPHA - MIN_ALPHA) * flashamount);
_local1.bonusbomb.startalpha = _local1.bonusbomb._alpha;
var shotbomb = false;
var f = 0;
while (f < MAX_FLAMES) {
if (_local1["flame" + f]._visible && (_local1["flame" + f].hittest(_local1.bonusbomb))) {
shotbomb = true;
}
f++;
}
if (shotbomb) {
play_bonusbombhitbyfireball_sound();
_local1.bonusbomb._visible = false;
var f = 0;
while (f < MAX_FLAMES) {
_local1["flame" + f]._visible = false;
f++;
}
var points = getpoints();
var _local2 = 0;
while (_local2 < MAX_CHEWITS) {
if (_local1["chewit" + _local2]._visible && (!_local1["chewit" + _local2].suckedin)) {
_local1["chewit" + _local2]._visible = false;
_local1["chewitscore" + _local2].bombshot = true;
score = score + points;
addchewitscore(_local2, points, 0);
}
_local2++;
}
var _local3 = 0;
while (_local3 < MAX_BAGS) {
if (_local1["bag" + _local3]._visible) {
throwchewits(_local3, -1);
_local1["bag" + _local3]._visible = false;
}
_local3++;
}
updatescore(score);
} else {
_local1.bonusbomb._y = _local1.bonusbomb._y + (BOMB_FALL_RATE * _local1.delta);
if (_local1.bonusbomb._y > BOMB_OFF_BOTTOM) {
_local1.bonusbomb._visible = false;
}
}
}
};
updatechewits = function () {
var _local1 = _parent;
var CHEWIT_BOUNCE_LEFT = 30;
var CHEWIT_BOUNCE_RIGHT = 372;
var CHEWIT_DROP_SPEED = -1.8;
var CHEWIT_OFF_BOTTOM = 500;
var _local3 = 8;
var CHEWIT_COMBOSCORE_FADE = 12;
var CHEWIT_SCORE_DELTA_Y = (70 / _local3);
var _local2 = 0;
while (_local2 < MAX_CHEWITS) {
if (_local1["chewit" + _local2]._visible && (!_local1["chewit" + _local2].suckedin)) {
_local1["chewit" + _local2]._rotation = _local1["chewit" + _local2]._rotation + (_local1["chewit" + _local2].rotaterate * _local1.delta);
_local1["chewit" + _local2].delta_y = _local1["chewit" + _local2].delta_y + (CHEWIT_DROP_SPEED * _local1.delta);
_local1["chewit" + _local2]._y = _local1["chewit" + _local2]._y - (_local1["chewit" + _local2].delta_y * _local1.delta);
_local1["chewit" + _local2]._x = _local1["chewit" + _local2]._x + (_local1["chewit" + _local2].delta_x * _local1.delta);
if (_local1["chewit" + _local2]._x < CHEWIT_BOUNCE_LEFT) {
if (_local1["chewit" + _local2].delta_x < 0) {
_local1["chewit" + _local2].delta_x = -_local1["chewit" + _local2].delta_x;
}
}
if (_local1["chewit" + _local2]._x > CHEWIT_BOUNCE_RIGHT) {
if (_local1["chewit" + _local2].delta_x > 0) {
_local1["chewit" + _local2].delta_x = -_local1["chewit" + _local2].delta_x;
}
}
if (_local1["chewit" + _local2]._y > CHEWIT_OFF_BOTTOM) {
_local1["chewit" + _local2]._visible = false;
}
}
if (_local1["chewitscore" + _local2]._visible) {
_local1["chewitscore" + _local2].scoretime = _local1["chewitscore" + _local2].scoretime + _local1.delta;
var fadetime = ((_local3 - _local1["chewitscore" + _local2].scoretime) / _local3);
if (fadetime < 0) {
_local1["chewitscore" + _local2]._visible = false;
} else {
var fadetime = (_local1["chewitscore" + _local2].scoretime / _local3);
_local1["chewitscore" + _local2]._alpha = 100 - (easeinfastout(fadetime) * 100);
_local1["chewitscore" + _local2].startalpha = _local1["chewitscore" + _local2]._alpha;
_local1["chewitscore" + _local2]._y = _local1["chewitscore" + _local2]._y - (CHEWIT_SCORE_DELTA_Y * _local1.delta);
}
}
_local2++;
}
if (_local1.comboscore._visible) {
_local1.comboscore.scoretime = _local1.comboscore.scoretime + _local1.delta;
var fadetime = ((CHEWIT_COMBOSCORE_FADE - _local1.comboscore.scoretime) / CHEWIT_COMBOSCORE_FADE);
if (fadetime < 0) {
_local1.comboscore._visible = false;
} else {
var fadetime = (_local1.comboscore.scoretime / CHEWIT_COMBOSCORE_FADE);
_local1.comboscore._alpha = 100 - (easeinfastout(fadetime) * 100);
_local1.comboscore.startalpha = _local1.comboscore._alpha;
_local1.comboscore._y = _local1.comboscore._y - (CHEWIT_SCORE_DELTA_Y * _local1.delta);
}
}
};
createchewit = function (atx, aty) {
var _local2 = _parent;
var CHEWIT_DELTAX_SCALE = 12;
var CHEWIT_DELTAY_MIN = 10;
var CHEWIT_DELTAY_MAX = 16;
var CHEWIT_ROTATE_RATE_MAX = 60;
if (_local2["chewit" + nextchewitno]._visible) {
var _local1 = 0;
while (_local1 < MAX_CHEWITS) {
if (!_local2["chewit" + _local1]._visible) {
nextchewitno = _local1;
}
_local1++;
}
}
if (!_local2["chewit" + nextchewitno]._visible) {
_local2["chewit" + nextchewitno]._visible = true;
_local2["chewit" + nextchewitno].suckedin = false;
_local2["chewit" + nextchewitno]._rotation = Math.random() * 100;
_local2["chewit" + nextchewitno]._x = atx;
_local2["chewit" + nextchewitno]._y = aty;
_local2["chewit" + nextchewitno]._xscale = CHEWIT_SCALE;
_local2["chewit" + nextchewitno]._yscale = CHEWIT_SCALE;
var _local3 = (Math.random() - 0.5) / 0.5;
_local2["chewit" + nextchewitno].delta_x = _local3 * CHEWIT_DELTAX_SCALE;
_local2["chewit" + nextchewitno].delta_y = CHEWIT_DELTAY_MIN + ((CHEWIT_DELTAY_MAX - CHEWIT_DELTAY_MIN) * Math.Random());
_local3 = (Math.random() - 0.5) / 0.5;
_local2["chewit" + nextchewitno].rotaterate = CHEWIT_ROTATE_RATE_MAX * _local3;
nextchewitno++;
if (nextchewitno >= MAX_CHEWITS) {
nextchewitno = 0;
}
}
};
playgame = function () {
var _local1 = _parent;
mouse.hide();
_local1.gamestate = GAMESTATE_PLAYING;
_local1.floorsoundplaying = false;
chewystate = CHEWY_STATE_OK;
score = 0;
lives = 3;
_alpha = 100;
resettime();
nobags = 0;
hitarray = new Array(new Array(0, 0), new Array(0, (-CHEWY_HEIGHT) * 0.66), new Array((-CHEWY_WIDTH) * 0.24, (-CHEWY_HEIGHT) * 0.3), new Array(CHEWY_WIDTH * 0.24, (-CHEWY_HEIGHT) * 0.3));
animations = new Array(new Array(1, 10, 1, 0, 1), new Array(11, 20, 11, 0, 1), new Array(61, 70, 61, 0, 1), new Array(41, 50, 41, 0, 1), new Array(51, 60, 51, 0, 1), new Array(81, 90, 81, 0, 1), new Array(91, 100, 91, 0, 1), new Array(24, 30, 24, 0, 0), new Array(34, 40, 34, 0, 0));
bonusbombsat = new Array(100, 300, 500, 750, 1250, 2000, 3000, 5000, 7500, 10000, 15000, 20000, 30000, 50000, 75000, 100000, 150000, 250000, 500000, 1000000);
currentbonusbomb = 0;
chewyfacing = CHEWY_FACING_LEFT;
nextbagno = 0;
nextflameno = 0;
nextchewitno = 0;
nextbagtime = 0;
nextflametime = 0;
_x = (SCREEN_WIDTH / 2);
_y = chewy_start_y();
base_y = _y;
desired_base_y = base_y;
lastwalkpos = _x;
timeinstate = 0;
setfloorpos();
var BAG_SCALE = 50;
_local1.floor_mc._visible = true;
_local1.sky_mc._visible = true;
_local1.sky_mc._x = 90;
_local1.sky_mc._y = 10.3;
var b = 0;
while (b < MAX_BAGS) {
_local1.attachMovie("bagsource" + (b % 3), "bag" + b, 20 + b);
_local1["bag" + b]._visible = false;
_local1["bag" + b]._xscale = BAG_SCALE;
_local1["bag" + b]._yscale = BAG_SCALE;
b++;
}
var _local3 = 0;
while (_local3 < MAX_FLAMES) {
_local1.attachMovie("explode", "flame" + _local3, 60 + _local3);
_local1["flame" + _local3]._visible = false;
_local1["flame" + _local3]._xscale = 60;
_local1["flame" + _local3]._yscale = 60;
_local1["flame" + _local3].flametime = 0;
_local1["flame" + _local3].flameframe = 0;
_local1["flame" + _local3].frametime = 0;
_local3++;
}
var NO_CHEWIT_TYPES = 12;
var _local2 = 0;
while (_local2 < MAX_CHEWITS) {
var chewitno = (_local2 % NO_CHEWIT_TYPES);
_local1.attachMovie("chewit" + chewitno, "chewit" + _local2, 100 + _local2);
_local1.createTextField("chewitscore" + _local2, (100 + _local2) + MAX_CHEWITS, 0, 0, 40, 40);
_local1["chewitscore" + _local2].type = "dynamic";
_local1["chewit" + _local2]._visible = false;
_local1["chewitscore" + _local2]._visible = false;
_local2++;
}
_local1.createTextField("comboscore", 101 + (MAX_CHEWITS * 2), 0, 0, 80, 40);
_local1.comboscore.type = "dynamic";
_local1.comboscore._visible = false;
_local1.comboscore.type = "dynamic";
_local1.attachMovie("lifeicon", "life2", 42);
_local1.attachMovie("lifeicon", "life1", 41);
_local1.attachMovie("lifeicon", "life0", 40);
_local1.attachMovie("bonusbomb", "bonusbomb", 102 + (MAX_CHEWITS * 2));
_local1.bonusbomb._visible = false;
_local1.createTextField("scoretext", 43, 22, 482, 150, 50);
_local1.createTextField("debugtext", 44, 168, 484, 150, 50);
updatescore(score);
var l = 0;
while (l < 3) {
_local1["life" + l]._x = 352 - (l * 30);
_local1["life" + l]._y = 478;
_local1["life" + l]._yscale = 120;
_local1["life" + l]._xscale = 120;
_local1["life" + l]._visible = true;
l++;
}
};
startgame = function () {
var _local3 = _parent;
hiscores = new Array(new Array("", ""), new Array("", ""), new Array("", ""), new Array("", ""), new Array("", ""), new Array("", ""), new Array("", ""), new Array("", ""), new Array("", ""), new Array("", ""));
_local3.serverconnection = new LoadVars();
_local3.serverconnection.onLoad = function (success) {
if (success) {
var _local1 = 0;
while (_local1 < 10) {
var _local3 = new String(_parent.serverconnection["hi" + _local1]);
var _local2 = 0;
while ((_local3.charAt(_local2) != "-") && (_local2 < _local3.length)) {
_local2++;
}
if (_local2 < _local3.length) {
var thename = _local3.substr(0, _local2);
var thescore = _local3.substr(_local2 + 1);
hiscores[_local1][0] = thename;
hiscores[_local1][1] = thescore;
_parent.hiscorescreen["hiscore" + _local1].position.text = (_local1 + 1) + ".";
_parent.hiscorescreen["hiscore" + _local1].score.text = thescore;
_parent.hiscorescreen["hiscore" + _local1].name.text = thename;
} else {
hiscores[_local1][0] = "";
hiscores[_local1][1] = "";
_parent.hiscorescreen["hiscore" + _local1].position.text = "";
_parent.hiscorescreen["hiscore" + _local1].score.text = "";
_parent.hiscorescreen["hiscore" + _local1].name.text = "";
}
_local1++;
}
positiontext = (Number(_parent.serverconnection.pos) + 1) + ".";
_parent.hiscorescreen["hiscore-1"].position.text = positiontext;
myformat1 = _parent.hiscorescreen["hiscore-1"].position.getTextFormat();
myformat1.color = 65535;
_parent.hiscorescreen["hiscore-1"].position.embedFonts = true;
_parent.hiscorescreen["hiscore-1"].position.setTextFormat(myformat1);
_parent.hiscorescreen["hiscore-1"].position.embedFonts = true;
}
};
_local3.gamestate = GAMESTATE_TITLE_SCREEN;
_local3.attachMovie("titlescreen_mc", "titlescreen", 40);
_local3.titlescreen._x = 0;
_local3.titlescreen._y = -20;
_local3.titlescreen._visible = true;
};
}
onClipEvent (mouseDown) {
switch (_parent.gamestate) {
case GAMESTATE_TITLE_SCREEN :
break;
case GAMESTATE_INTRO_SCREEN :
break;
case GAMESTATE_PLAYING :
case GAMESTATE_PLAYING_WAIT :
if (!((((chewystate == CHEWY_STATE_OK) || (chewystate == CHEWY_STATE_CHEWING)) || (chewystate == CHEWY_STATE_FIRING)) && (nextflametime < 0))) {
break;
}
var NEXT_FLAME_TIME = 1;
var FLAME_EMIT_POSITION = 40;
if (_parent["flame" + nextflameno]._visible) {
break;
}
play_chewyshootsafireball_sound();
chewystate = CHEWY_STATE_FIRING;
animations[FIRE_IDLE_ANIMATION][ANIMATION_CURRENT_FRAME] = animations[FIRE_IDLE_ANIMATION][ANIMATION_START_FRAME];
animations[FIRE_WALK_ANIMATION][ANIMATION_CURRENT_FRAME] = animations[FIRE_WALK_ANIMATION][ANIMATION_START_FRAME];
animations[FIRE_IDLE_ANIMATION][ANIMATION_FRAMETIME] = 0;
animations[FIRE_WALK_ANIMATION][ANIMATION_FRAMETIME] = 0;
timeinstate = 0;
_parent["flame" + nextflameno].flametime = 0;
_parent["flame" + nextflameno].flameframe = 0;
_parent["flame" + nextflameno].frametime = 0;
_parent["flame" + nextflameno]._visible = true;
_parent["flame" + nextflameno]._x = _x;
_parent["flame" + nextflameno]._y = (_y - FLAME_EMIT_POSITION) - CHEWY_Y_ADJUST;
nextflameno++;
nextflametime = NEXT_FLAME_TIME;
if (nextflameno < MAX_FLAMES) {
break;
}
nextflameno = 0;
}
}
onClipEvent (enterFrame) {
var INITIAL_HIT_BOUNCE_DELTA_Y = 8;
var BOUNCE_DROP_SPEED = -1.8;
switch (_parent.gamestate) {
case GAMESTATE_PAUSED :
grabtime();
if ((!Key.isDown(32)) && (!Key.isDown(80))) {
_parent.gamestate = GAMESTATE_PAUSED_WAIT;
}
break;
case GAMESTATE_PAUSED_WAIT :
grabtime();
if (Key.isDown(32) || (Key.isDown(80))) {
_parent.gamestate = GAMESTATE_PLAYING_WAIT;
mouse.hide();
}
break;
case GAMESTATE_PLAYING :
case GAMESTATE_PLAYING_WAIT :
timeinstate = timeinstate + _parent.delta;
grabtime();
var a = 0;
while (a < animations.length) {
animations[a][ANIMATION_FRAMETIME] = animations[a][ANIMATION_FRAMETIME] + (_parent.delta * animations[a][ANIMATION_SPEED]);
if (animations[a][ANIMATION_FRAMETIME] > 1) {
animations[a][ANIMATION_CURRENT_FRAME]++;
if (animations[a][ANIMATION_CURRENT_FRAME] > animations[a][ANIMATION_END_FRAME]) {
animations[a][ANIMATION_CURRENT_FRAME] = animations[a][ANIMATION_START_FRAME];
}
animations[a][ANIMATION_FRAMETIME] = animations[a][ANIMATION_FRAMETIME] - 1;
}
a++;
}
if (chewystate == CHEWY_STATE_FIRING) {
var a = FIRE_IDLE_ANIMATION;
while (a <= FIRE_WALK_ANIMATION) {
animations[a][ANIMATION_FRAMETIME] = animations[a][ANIMATION_FRAMETIME] + _parent.delta;
if (animations[a][ANIMATION_FRAMETIME] > 1) {
animations[a][ANIMATION_CURRENT_FRAME]++;
if (animations[a][ANIMATION_CURRENT_FRAME] > animations[a][ANIMATION_END_FRAME]) {
timeinstate = 0;
chewystate = CHEWY_STATE_OK;
animations[a][ANIMATION_CURRENT_FRAME] = animations[a][ANIMATION_START_FRAME];
}
animations[a][ANIMATION_FRAMETIME] = 0;
}
a++;
}
}
var CHEW_TIME = 12;
if ((chewystate == CHEWY_STATE_CHEWING) && (timeinstate > CHEW_TIME)) {
timeinstate = 0;
chewystate = CHEWY_STATE_OK;
}
switch (chewystate) {
case CHEWY_STATE_OK :
case CHEWY_STATE_CHEWING :
case CHEWY_STATE_FIRING :
var b = 0;
while (b < MAX_BAGS) {
if (_parent["bag" + b]._visible) {
if (_parent["bag" + b].canhitchewy && (bagcollison(b))) {
play_chewyhitbybag_sound();
chewystate = CHEWY_STATE_HIT;
var CHEWY_BOUNCE_DELTA_X = 6;
if (_parent["bag" + b]._x > _x) {
chewy_facing = CHEWY_FACING_LEFT;
delta_x = -CHEWY_BOUNCE_DELTA_X;
} else {
chewy_facing = CHEWY_FACING_RIGHT;
delta_x = CHEWY_BOUNCE_DELTA_X;
}
delta_y = INITIAL_HIT_BOUNCE_DELTA_Y;
initial_delta_y = INITIAL_HIT_BOUNCE_DELTA_Y;
bounce_speed = BOUNCE_DROP_SPEED;
timeinstate = 0;
_parent["bag" + b]._visible = false;
nobags--;
lives--;
if (lives >= 0) {
_parent["life" + lives]._visible = false;
}
var b2 = 0;
while (b2 < MAX_BAGS) {
if (_parent["bag" + b2]._visible) {
_parent["bag" + b2].canhitchewy = false;
}
b2++;
}
}
var FLAME_WIDTH = 9;
var f = 0;
while (f < MAX_FLAMES) {
if (_parent["flame" + f]._visible) {
if (_parent["bag" + b].hittest(_parent["flame" + f]._x - FLAME_WIDTH, _parent["flame" + f]._y) || (_parent["bag" + b].hittest(_parent["flame" + f]._x + FLAME_WIDTH, _parent["flame" + f]._y))) {
play_baghitbyfireball_sound();
var TOP_TIME = 10;
var distancescale = (_parent["flame" + f].flametime / TOP_TIME);
if (distancescale > 1) {
distancescale = 1;
}
throwchewits(b, distancescale);
_parent["bag" + b]._visible = false;
_parent["flame" + f]._visible = false;
nobags--;
}
}
f++;
}
}
b++;
}
nextflametime = nextflametime - _parent.delta;
var REENABLE_BAGS_TIME = 12;
if ((timeinstate > REENABLE_BAGS_TIME) && (timeinstate < (REENABLE_BAGS_TIME + 0.3))) {
var b = 0;
while (b < MAX_BAGS) {
if (!_parent["bag" + b].canhitchewy) {
_parent["bag" + b].canhitchewy = true;
}
b++;
}
}
var desired_x = _parent._xmouse;
MOVERATE = 15;
if (_x <= desired_x) {
if (desired_x > (MAX_X - (CHEWY_WIDTH / 2))) {
desired_x = MAX_X - (CHEWY_WIDTH / 2);
}
_x = (_x + (MOVERATE * _parent.delta));
if (_x >= desired_x) {
_x = desired_x;
}
}
if (_x > desired_x) {
if (desired_x < (MIN_X + (CHEWY_WIDTH / 2))) {
desired_x = MIN_X + (CHEWY_WIDTH / 2);
}
_x = (_x - (MOVERATE * _parent.delta));
if (_x < desired_x) {
_x = desired_x;
}
}
var MOUTHDISTANCE_X = 12;
var MOUTHDISTANCE_Y = 24;
var mouthposition_x = _x;
var mouthposition_y = ((_y - MOUTHDISTANCE_Y) - CHEWY_Y_ADJUST);
if (chewyfacing == CHEWY_FACING_LEFT) {
mouthposition_x = mouthposition_x - MOUTHDISTANCE_X;
} else {
mouthposition_x = mouthposition_x + MOUTHDISTANCE_X;
}
var onesuckedin = 0;
var c = 0;
while (c < MAX_CHEWITS) {
if (_parent["chewit" + c]._visible) {
if (_parent["chewit" + c].suckedin) {
_parent["chewit" + c].sucktime = _parent["chewit" + c].sucktime + _parent.delta;
onesuckedin = 1;
_parent["chewit" + c]._x = _parent["chewit" + c]._x + (mouthposition_x - _parent["chewit" + c].last_mx);
_parent["chewit" + c]._y = _parent["chewit" + c]._y + (mouthposition_y - _parent["chewit" + c].last_my);
}
var dist_x = (mouthposition_x - _parent["chewit" + c]._x);
var dist_y = (mouthposition_y - _parent["chewit" + c]._y);
var thisdistance = ((dist_x * dist_x) + (dist_y * dist_y));
if (_parent["chewit" + c].suckedin) {
var MOVE_SCALE = 0.4;
_parent["chewit" + c]._x = _parent["chewit" + c]._x + ((dist_x * _parent.delta) * MOVE_SCALE);
_parent["chewit" + c]._y = _parent["chewit" + c]._y + ((dist_y * _parent.delta) * MOVE_SCALE);
_parent["chewit" + c].last_mx = mouthposition_x;
_parent["chewit" + c].last_my = mouthposition_y;
_parent["chewit" + c]._rotation = _parent["chewit" + c]._rotation + (_parent["chewit" + c].rotaterate * _parent.delta);
var scalechew = ((CHEWIT_SCALE * thisdistance) / _parent["chewit" + c].suck_distance);
if (scalechew > CHEWIT_SCALE) {
scalechew = CHEWIT_SCALE;
}
_parent["chewit" + c]._xscale = scalechew;
_parent["chewit" + c]._yscale = scalechew;
var MAX_SUCK_TIME = 2;
if ((scalechew < 4) || (_parent["chewit" + c].sucktime < MAX_SUCK_TIME)) {
play_chewyeatsachewit_sound();
var points = getpoints();
var combono = 0;
var c2 = 0;
while (c2 < MAX_CHEWITS) {
if (((c != c2) && (_parent["chewitscore" + c2]._visible)) && (!_parent["chewitscore" + c2].bombshot)) {
combono++;
}
c2++;
}
score = score + (points * (1 + combono));
addchewitscore(c, points * (1 + combono), combono);
updatescore(score);
_parent["chewit" + c]._visible = false;
_parent["chewitscore" + c].bombshot = false;
}
} else {
var CHOMP_TOLERANCE_X2 = 1024;
var CHOMP_TOLERANCE_Y2 = 144;
var distancex = (_parent["chewit" + c]._x - mouthposition_x);
var distancey = (_parent["chewit" + c]._y - mouthposition_y);
var distancex2 = (distancex * distancex);
var distancey2 = (distancey * distancey);
if ((distancex2 < CHOMP_TOLERANCE_X2) && (distancey2 < CHOMP_TOLERANCE_Y2)) {
var SWALLOW_ROTATE_RATE = 10;
_parent["chewit" + c].suckedin = true;
_parent["chewit" + c].sucktime = 0;
_parent["chewit" + c].suck_distance = thisdistance;
_parent["chewit" + c].last_mx = mouthposition_x;
_parent["chewit" + c].last_my = mouthposition_y;
if (_parent["chewit" + c].rotaterate > 0) {
_parent["chewit" + c].rotaterate = SWALLOW_ROTATE_RATE;
} else {
_parent["chewit" + c].rotaterate = -SWALLOW_ROTATE_RATE;
}
chewystate = CHEWY_STATE_CHEWING;
timeinstate = 0;
}
}
}
c++;
}
WALK_TOLERANCE = 4;
if (Math.abs(lastwalkpos - _x) > WALK_TOLERANCE) {
if (lastwalkpos > _x) {
chewyfacing = CHEWY_FACING_RIGHT;
} else {
chewyfacing = CHEWY_FACING_LEFT;
}
lastwalkpos = _x;
if (chewystate == CHEWY_STATE_CHEWING) {
this.gotoAndStop(animations[CHEW_WALK_ANIMATION][ANIMATION_CURRENT_FRAME]);
} else if (chewystate == CHEWY_STATE_FIRING) {
this.gotoAndStop(animations[FIRE_WALK_ANIMATION][ANIMATION_CURRENT_FRAME]);
} else if (onesuckedin == 1) {
this.gotoAndStop(animations[SUCK_WALK_ANIMATION][ANIMATION_CURRENT_FRAME]);
} else {
this.gotoAndStop(animations[WALK_ANIMATION][ANIMATION_CURRENT_FRAME]);
}
} else if (chewystate == CHEWY_STATE_CHEWING) {
this.gotoAndStop(animations[CHEW_IDLE_ANIMATION][ANIMATION_CURRENT_FRAME]);
} else if (chewystate == CHEWY_STATE_FIRING) {
this.gotoAndStop(animations[FIRE_IDLE_ANIMATION][ANIMATION_CURRENT_FRAME]);
} else if (onesuckedin == 1) {
this.gotoAndStop(animations[SUCK_IDLE_ANIMATION][ANIMATION_CURRENT_FRAME]);
} else {
this.gotoAndStop(animations[IDLE_ANIMATION][ANIMATION_CURRENT_FRAME]);
}
break;
case CHEWY_STATE_HIT :
this.gotoAndStop(animations[HIT_ANIMATION][ANIMATION_CURRENT_FRAME]);
delta_y = delta_y + (bounce_speed * _parent.delta);
_y = (_y - (delta_y * _parent.delta));
_x = (_x + (delta_x * _parent.delta));
if (_x > (MAX_X - (CHEWY_WIDTH / 2))) {
_x = (MAX_X - (CHEWY_WIDTH / 2));
delta_x = 0;
}
if (_x < (MIN_X + (CHEWY_WIDTH / 2))) {
_x = (MIN_X + (CHEWY_WIDTH / 2));
delta_x = 0;
}
if (_y > base_y) {
_y = base_y;
initial_delta_y = initial_delta_y / 2;
if (initial_delta_y > (INITIAL_HIT_BOUNCE_DELTA_Y / 16)) {
delta_y = initial_delta_y;
} else {
delta_y = 0;
bounce_speed = 0;
}
}
if (timeinstate > HIT_TIME_MAXIMUM) {
_y = base_y;
_alpha = 100;
timeinstate = 0;
if (lives < 0) {
play_death_sound();
_parent.gamestate = GAMESTATE_GAME_OVER_FADE;
} else {
chewystate = CHEWY_STATE_OK;
}
} else {
var segment = Math.round((timeinstate * 10) / HIT_TIME_MAXIMUM);
if ((segment % 2) == 1) {
_alpha = 0;
} else {
_alpha = 100;
}
}
}
if (chewyfacing == CHEWY_FACING_LEFT) {
_xscale = CHEWY_SCALE;
} else {
_xscale = (-CHEWY_SCALE);
}
updatebags();
updatebomb();
updateflames();
updatechewits();
updatefloor();
if (_parent.gamestate == GAMESTATE_PLAYING) {
if (Key.isDown(32) || (Key.isDown(80))) {
_parent.gamestate = GAMESTATE_PAUSED;
mouse.show();
}
} else if (_parent.gamestate == GAMESTATE_PLAYING_WAIT) {
if ((!Key.isDown(32)) && (!Key.isDown(80))) {
_parent.gamestate = GAMESTATE_PLAYING;
}
}
var FLOOR_MAXIMUM_HEIGHT = 130;
if (base_y < FLOOR_MAXIMUM_HEIGHT) {
if (base_y >= FLOOR_MAXIMUM_HEIGHT) {
score = Math.floor(300 * Math.random()) * 10;
updatescore();
}
play_chewyhitsthetop_sound();
lives = 0;
_parent.gamestate = GAMESTATE_GAME_OVER_FADE;
timeinstate = 0;
_parent.life0._visible = false;
_parent.life1._visible = false;
_parent.life2._visible = false;
}
break;
case GAMESTATE_GAME_OVER_FADE :
if (_parent.floorsoundplaying) {
stop_floorraising_noise();
_parent.floorsoundplaying = false;
}
timeinstate = timeinstate + _parent.delta;
var fadeamount = (100 - ((100 * timeinstate) / 20));
if (fadeamount < 0) {
fadeamount = 0;
}
_alpha = fadeamount;
var b = 0;
while (b < MAX_BAGS) {
_parent["bag" + b]._alpha = fadeamount;
b++;
}
var f = 0;
while (f < MAX_FLAMES) {
_parent["flame" + f]._alpha = fadeamount;
f++;
}
var c = 0;
while (c < MAX_CHEWITS) {
_parent["chewit" + c]._alpha = fadeamount;
_parent["chewitscore" + c]._alpha = (_parent["chewitscore" + c].startalpha * fadeamount) / 100;
c++;
}
_parent.comboscore._alpha = (_parent.comboscore.startalpha * fadeamount) / 100;
_parent.bonusbomb._alpha = (_parent.bonusbomb.startalpha * fadeamount) / 100;
if (fadeamount == 0) {
mouse.show();
_parent.gamestate = GAMESTATE_GAME_OVER_HISCORE_ENTRY;
timeinstate = 0;
_parent.scoretext._visible = false;
_parent.floor_mc._visible = false;
_parent.sky_mc._visible = false;
}
break;
case GAMESTATE_GAME_OVER_HISCORE_ENTRY :
_parent.attachMovie("hiscoreentry_mc", "hiscoreentry", 40);
_parent.hiscoreentry.myname.text = "";
_parent.gamestate = GAMESTATE_GAME_OVER;
timeinstate = 0;
break;
case GAMESTATE_GAME_OVER_HISCORES :
var thename = _parent.hiscoreentry.myname.text;
_parent.attachMovie("hiscorescreen_mc", "hiscorescreen", 40);
_parent.hiscorescreen._x = 0;
_parent.hiscorescreen._y = 0;
_parent.hiscorescreen._visible = true;
var HISCORE_START_X = 38;
var HISCORE_START_Y = 107;
var HISCORE_DELTA_Y = 30;
var MAX_HIGHSCORES = 10;
var h = 0;
while (h < MAX_HIGHSCORES) {
_parent.hiscorescreen.attachMovie("highscore_mc", "hiscore" + h, 42 + h);
_parent.hiscorescreen["hiscore" + h]._x = HISCORE_START_X;
_parent.hiscorescreen["hiscore" + h]._y = HISCORE_START_Y + (HISCORE_DELTA_Y * h);
_parent.hiscorescreen["hiscore" + h].score.text = hiscores[h][1];
if (hiscores[h][0] != "") {
_parent.hiscorescreen["hiscore" + h].position.text = (h + 1) + ".";
} else {
_parent.hiscorescreen["hiscore" + h].position.text = "";
}
_parent.hiscorescreen["hiscore" + h].name.text = hiscores[h][0];
_parent.hiscorescreen["hiscore" + h].score.embedFonts = true;
_parent.hiscorescreen["hiscore" + h].name.embedFonts = true;
_parent.hiscorescreen["hiscore" + h].position.embedFonts = true;
h++;
}
var YOUR_SCORE_GAP = 9;
_parent.hiscorescreen.attachMovie("highscore_mc", "hiscore-1", 41);
_parent.hiscorescreen["hiscore-1"]._x = HISCORE_START_X;
_parent.hiscorescreen["hiscore-1"]._y = (HISCORE_START_Y + (HISCORE_DELTA_Y * hiscores.length)) + YOUR_SCORE_GAP;
if (thename == "") {
thename = "(you)";
}
_parent.hiscorescreen["hiscore-1"].position.text = positiontext;
myformat1 = _parent.hiscorescreen["hiscore-1"].position.getTextFormat();
myformat1.color = 65535;
_parent.hiscorescreen["hiscore-1"].position.embedFonts = true;
_parent.hiscorescreen["hiscore-1"].position.setTextFormat(myformat1);
_parent.hiscorescreen["hiscore-1"].position.embedFonts = true;
_parent.hiscorescreen["hiscore-1"].name.text = thename;
myformat1 = _parent.hiscorescreen["hiscore-1"].name.getTextFormat();
myformat1.color = 65535;
_parent.hiscorescreen["hiscore-1"].name.embedFonts = true;
_parent.hiscorescreen["hiscore-1"].name.setTextFormat(myformat1);
_parent.hiscorescreen["hiscore-1"].name.embedFonts = true;
_parent.hiscorescreen["hiscore-1"].score.text = score;
myformat1 = _parent.hiscorescreen["hiscore-1"].score.getTextFormat();
myformat1.color = 65535;
_parent.hiscorescreen["hiscore-1"].score.embedFonts = true;
_parent.hiscorescreen["hiscore-1"].score.setTextFormat(myformat1);
_parent.hiscorescreen["hiscore-1"].score.embedFonts = true;
_parent.gamestate = GAMESTATE_GAME_OVER;
timeinstate = 0;
}
}
Frame 10
stop();
onLoaded();
coverup.swapDepths(9999);
Symbol 22 MovieClip Frame 1
stop();
Symbol 54 Button
on (release) {
_root.gamestate = GAMESTATE_INTRO_SCREEN;
_root.titlescreen._visible = false;
_root.attachMovie("howtoplay_mc", "introscreen", 40);
_root.introchewy_mc.gotoandstop(1);
_root.introscreen._x = 0;
_root.introscreen._y = -20;
_root.introscreen._visible = true;
}
Symbol 69 Button
on (release) {
_root.gamestate = GAMESTATE_PLAYING;
_root.introscreen._visible = false;
_root.chewy_mc.playgame();
}
Symbol 72 Button
on (release) {
_root.chewy_mc.gethiscores();
}
Symbol 79 Button
on (release) {
_root.gamestate = GAMESTATE_PLAYING;
_root.hiscorescreen._visible = false;
_root.chewy_mc.playgame();
}