Frame 1
fscommand ("fullscreen", "true");
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
Frame 2
factor = _root.getBytesLoaded() / _root.getBytesTotal();
percent.text = Math.floor(factor * 100) + "%";
if (factor >= 1) {
_root.gotoAndStop("Splash");
}
Frame 3
_root.gotoAndPlay("loader");
Frame 9
myURL = _url;
okDomain = "keepdsmile.com";
okDomain1 = "uploads.ungrounded.net";
okDomain2 = "newgrounds.com";
okDomain3 = "www.newgrounds.com";
if ((((myURL.indexOf(okDomain) != -1) || (myURL.indexOf(okDomain1) != -1)) || (myURL.indexOf(okDomain2) != -1)) || (myURL.indexOf(okDomain3) != -1)) {
} else {
_root.gotoAndStop("error");
}
Frame 25
stop();
Frame 79
if (false) {
}
Symbol 21 MovieClip Frame 1
stop();
Symbol 39 MovieClip Frame 1
stop();
Symbol 39 MovieClip Frame 26
stop();
Symbol 43 MovieClip Frame 1
stop();
Symbol 43 MovieClip Frame 20
stop();
Symbol 52 MovieClip [platform] Frame 1
stop();
Symbol 74 MovieClip Frame 14
this.gotoAndPlay(1);
Symbol 74 MovieClip Frame 21
_parent.removeMovieClip();
Symbol 86 MovieClip Frame 14
this.gotoAndPlay(1);
Symbol 86 MovieClip Frame 21
_parent.removeMovieClip();
Symbol 94 MovieClip Frame 14
this.gotoAndPlay(1);
Symbol 94 MovieClip Frame 21
_parent.removeMovieClip();
Symbol 95 MovieClip [baddy] Frame 1
stop();
hitArea._visible = false;
Symbol 95 MovieClip [baddy] Frame 7
stop();
Symbol 95 MovieClip [baddy] Frame 13
stop();
Symbol 100 MovieClip [flag] Frame 1
stop();
Symbol 100 MovieClip [flag] Frame 20
where.levelComplete();
stop();
Symbol 107 Button
on (release) {
this.gotoAndStop("Game");
}
Symbol 129 MovieClip Frame 20
this.removeMovieClip();
Symbol 130 MovieClip Frame 1
function spin() {
newTrail = OrbTrail.duplicateMovieClip("OrbTrail" + L, L);
x = Xradius * Math.cos((i * 3.141593) / 180);
y = Yradius * Math.sin((i * 3.141593) / 180);
scale = (((y + Yradius) / Yradius) * 50) + 50;
ascale = (((y + Yradius) / Yradius) * 50) + 50;
newTrail._x = x;
newTrail._y = y;
newTrail._xscale = scale / 3;
newTrail._yscale = scale / 3;
newTrail._alpha = ascale;
newTrail._visible = 1;
Orb._x = x;
Orb._y = y;
Orb._xscale = scale / 2;
Orb._yscale = scale / 2;
Orb._alpha = ascale;
Orb._visible = 1;
i = i + 5;
if (i >= 360) {
i = 0;
}
L++;
}
L = 0;
Xradius = 50;
Yradius = 25;
OrbTrail._visible = 0;
Symbol 130 MovieClip Frame 2
spin();
Symbol 130 MovieClip Frame 3
gotoAndPlay (2);
Symbol 131 MovieClip Frame 1
e1._y = 0;
e2._y = 0;
e3._y = 0;
e1.i = 0;
e2.i = 120;
e3.i = 240;
e1._rotation = 0;
e2._rotation = 120;
e3._rotation = 240;
Symbol 133 MovieClip [ice cube] Frame 1
stop();
Symbol 133 MovieClip [ice cube] Frame 26
stop();
Symbol 158 MovieClip Frame 1
stop();
Symbol 158 MovieClip Frame 14
stop();
Symbol 173 MovieClip Frame 1
stop();
Symbol 173 MovieClip Frame 9
this.gotoAndPlay(2);
Symbol 183 MovieClip Frame 1
stop();
Symbol 189 MovieClip Frame 1
stop();
Symbol 194 Button
on (release, keyPress "<Space>") {
playClicked();
}
Symbol 200 Button
on (release, keyPress "<Space>") {
_parent.loadNext();
}
Symbol 205 Button
on (release) {
_parent.startOver();
}
Symbol 211 MovieClip Frame 1
function playClicked() {
if (_parent.game.loaded) {
_parent.startLevel();
}
}
function startedLoading() {
this.gotoAndStop(1);
status.gotoAndStop("Loading");
playButton._alpha = 50;
}
function finishedLoading() {
status.gotoAndStop("Loaded");
playButton._alpha = 100;
}
function gameOver() {
this._visible = true;
_parent.gameClip._visible = false;
this.gotoAndStop("Lose");
}
function showStats() {
var _local1 = _parent;
var _local2 = this;
_local2._visible = true;
_local1.gameClip._visible = false;
if (_local1.game.level == _local1.game.numLevels) {
_local2.gotoAndStop("Win");
} else {
_local2.gotoAndStop("Stats");
}
}
stop();
Symbol 215 Button
on (release) {
if (!soundOn) {
soundOn = true;
playSound("music");
} else {
stopAllSounds();
soundOn = false;
}
}
Symbol 217 Button
on (release) {
getURL ("http://keepdsmile.com", "_blank");
}
Symbol 218 Button
on (release) {
stopAllSounds();
_root.gotoAndStop("Splash");
}
Symbol 229 MovieClip Frame 1
stop();
Symbol 229 MovieClip Frame 5
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 25
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 40
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 54
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 73
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 86
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 107
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 115
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 116
this.gotoAndStop(1);
Symbol 229 MovieClip Frame 121
this.gotoAndStop(1);
Symbol 230 MovieClip Frame 2
function startLevel() {
hero.x = hero.startx;
hero.y = hero.starty;
hero.xmov = 0;
hero.ymov = 0;
hero.clip._x = hero.x;
hero.clip._y = hero.y;
game.inPlay = true;
game.flagCaptured = false;
waitingScreen._visible = false;
gameClip._visible = true;
}
function loadNext() {
var _local1 = ++game.level;
loadLevel(_local1);
}
function startOver() {
hero.lives = game.numLives - 1;
display.num = hero.lives;
game.level = 0;
_global.score = 0;
loadNext();
}
function levelLoaded() {
display.num2 = _global.score;
display.num = hero.lives;
waitingScreen.finishedLoading();
game.loaded = true;
game.platforms = {};
game.platforms.column = [];
var info = levelXML.firstChild;
game.flag = {};
game.flag.x = Number(info.attributes.flagx);
game.flag.y = Number(info.attributes.flagy);
placeFlag();
var tempBlocks = info.firstChild.childNodes;
var i = 0;
while (i < tempBlocks.length) {
var _local2 = tempBlocks[i].attributes;
var ob = new Object();
for (j in _local2) {
var nan = isNaN(Number(_local2[j]));
if (nan) {
ob[j] = _local2[j];
if (ob[j].toLowerCase() == "true") {
ob[j] = true;
} else if (ob[j].toLowerCase() == "false") {
ob[j] = false;
}
} else {
ob[j] = Number(_local2[j]);
}
}
var depth = (++game.depth);
var item = ob.item;
var name = ("platform" + depth);
var clip = gameClip.overlay.attachMovie("platform", name, depth);
ob.clip = clip;
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (ob.graphic == null) {
ob.clip.gotoAndStop("cube");
} else {
ob.clip.gotoAndStop(ob.graphic);
}
ob.width = ob.clip.vertical._x;
ob.clip.vertical._visible = false;
ob.height = ob.clip.horizontal._y;
ob.clip.horizontal._visible = false;
ob.clip.me = ob;
if (ob.mover == "yes") {
makeMover(ob.clip);
}
game.platforms.column.push(ob);
i++;
}
var temp = info.firstChild.nextSibling.childNodes;
var groundWidth = 233;
game.grounds = [];
var i = 0;
while (i < temp.length) {
var atts = temp[i].attributes;
var xstart = Number(atts.xstart);
var _local1 = Number(atts.xend);
var ob = {x1:xstart, x2:_local1};
game.grounds.push(ob);
var _local3 = Math.ceil((_local1 - xstart) / groundWidth);
var nowx = xstart;
var j = 0;
while (j < _local3) {
var depth = (++game.depth);
var name = ("ground" + depth);
var clip = gameClip.overlay.attachMovie("ground", name, depth);
clip._y = game.floor;
clip._x = nowx;
if (_local3 == 1) {
clip._width = _local1 - xstart;
}
if (j == (_local3 - 1)) {
var cornerx = endx;
var depth = (++game.depth);
var name = ("corner" + depth);
var clip = gameClip.overlay.attachMovie("corner", name, depth);
clip._x = (_local1 - clip._width) + 15;
clip._y = game.floor;
}
if (j == 0) {
var cornerx = (xstart + 26);
var depth = (++game.depth);
var name = ("corner" + depth);
var clip = gameClip.overlay.attachMovie("corner", name, depth);
clip._x = cornerx;
clip._y = game.floor;
clip._xscale = -100;
}
if (j != (_local3 - 2)) {
var nowx = (nowx + groundWidth);
} else {
var nowx = (_local1 - groundWidth);
}
j++;
}
i++;
}
var temp = info.firstChild.nextSibling.nextSibling.childNodes;
game.baddies = [];
var i = 0;
while (i < temp.length) {
var atts = temp[i].attributes;
var x = Number(atts.x);
var y = Number(atts.y);
var speed = Number(atts.speed);
var breadth = Number(atts.breadth);
if (atts.graphic == null) {
var graphic = "bear";
} else {
var graphic = atts.graphic;
}
if ((atts.start_direction == "left") || (atts.start_direction == "down")) {
var dir = -1;
} else {
var dir = 1;
}
var depth = (++game.depth);
var name = ("baddy" + depth);
var clip = gameClip.overlay.attachMovie("baddy", name, depth);
var ob = {graphic:graphic, homex:x, homey:y, speed:speed, breadth:breadth, dir:dir, clip:clip};
clip.me = ob;
game.baddies.push(ob);
clip._x = x;
clip._y = y;
addBaddyFXN(ob);
i++;
}
var temp = info.firstChild.nextSibling.nextSibling.nextSibling.childNodes;
game.collectables = [];
var i = 0;
while (i < temp.length) {
var atts = temp[i].attributes;
var x = Number(atts.x);
var y = Number(atts.y);
var type = atts.type;
var graphic = atts.graphic;
var depth = (++game.depth);
var name = ("collectable" + depth);
var clip = gameClip.overlay.attachMovie(type, name, depth);
clip._x = x;
clip._y = y;
if (type == "ice cube") {
clip._xscale = (clip._yscale = 50);
}
if (graphic == "element") {
clip.gotoAndStop("display1");
} else {
clip.gotoAndStop("display");
}
var ob = {x:x, y:y, type:type, clip:clip, graphic:graphic};
game.collectables.push(ob);
i++;
}
}
function levelComplete() {
game.inPlay = false;
if (hero.lives >= 0) {
waitingScreen.showStats();
} else {
waitingScreen.gameOver();
}
for (i in gameClip.overlay) {
var _local1 = typeof(gameClip.overlay[i]);
if (_local1 == "movieclip") {
if (gameClip.overlay[i]._name != "man") {
gameClip.overlay[i].removeMovieClip();
}
}
}
}
function levelRestart() {
_global.doubleJump = 0;
_global.jumpCount = 0;
hero.clip.animation.elm.gotoAndStop(1);
hero.inDoubleJump = false;
for (i in gameClip.overlay) {
var _local1 = typeof(gameClip.overlay[i]);
if (_local1 == "movieclip") {
if (gameClip.overlay[i]._name != "man") {
gameClip.overlay[i].removeMovieClip();
}
}
}
levelLoaded();
}
function placeFlag() {
var _local2 = ++game.depth;
var _local3 = "flag" + _local2;
var _local1 = gameClip.overlay.attachMovie("flag", _local3, _local2);
_local1._x = game.flag.x;
_local1._y = game.flag.y;
_local1.where = this;
_local1.flag.num.text = game.level;
game.flag.clip = _local1;
}
function playSound(name) {
if (soundOn) {
soundFX.gotoAndPlay(name);
}
}
function moveBaddy(ob) {
var _local1 = ob;
var _local3 = _local1.x + (_local1.dir * _local1.speed);
var _local2 = _local1.y + (_local1.dir * _local1.speed);
if (_local1.graphic == "bee") {
if ((_local1.dir < 0) && (_local2 < _local1.miny)) {
_local1.dir = _local1.dir * -1;
_local2 = _local1.y;
} else if ((_local1.dir > 0) && (_local2 > _local1.maxy)) {
_local1.dir = _local1.dir * -1;
_local2 = _local1.y;
}
_local1.y = _local2;
_local1.clip._y = _local1.y;
} else if (_local1.graphic != "bee") {
if ((_local1.dir < 0) && (_local3 < _local1.minx)) {
_local1.dir = _local1.dir * -1;
_local3 = _local1.x;
_local1.clip._xscale = (-_local1.dir) * 100;
} else if ((_local1.dir > 0) && (_local3 > _local1.maxx)) {
_local1.dir = _local1.dir * -1;
_local3 = _local1.x;
_local1.clip._xscale = (-_local1.dir) * 100;
}
_local1.x = _local3;
_local1.clip._x = _local1.x;
}
}
function addBaddyFXN(ob) {
var _local1 = ob;
_local1.minx = _local1.homex - (_local1.breadth / 2);
_local1.maxx = _local1.homex + (_local1.breadth / 2);
_local1.miny = _local1.homey - (_local1.breadth / 2);
_local1.maxy = _local1.homey + (_local1.breadth / 2);
_local1.x = _local1.homex;
_local1.y = _local1.homey;
_local1.clip.gotoAndStop(_local1.graphic);
_local1.clip.onEnterFrame = function () {
moveBaddy(this.me);
};
}
function loadLevel(num) {
var _local1 = num;
waitingScreen.startedLoading();
game.loaded = false;
if (_local1 == 1) {
level1 = new XML("<level flagx='4587.4' flagy='331' ><blocks><block x='860' y='205' type='cloud' graphic='cloud' container='false' /><block x='1070' y='120' type='cloud' graphic='cloud' container='false' /><block x='1295' y='120' type='solid' graphic='block' container='false' /><block item='life' containerCounter='1' x='1445' y='120' type='solid' graphic='cube' container='true' /><block x='1395' y='120' type='solid' graphic='cube' container='false' /><block x='1345' y='120' type='solid' graphic='cube' container='false' /><block x='2145' y='205' type='solid' graphic='cube' container='false' /><block containerCounter='5' x='2145' y='20' type='solid' graphic='cube' container='true' /><block x='200' y='210' type='solid' graphic='ice platform' container='false' /><block x='3195' y='215' type='cloud' graphic='cloud' container='false' /><block x='3815' y='215' type='cloud' graphic='cloud' container='false' /><block x='3985' y='115' type='cloud' graphic='cloud' container='false' /><block x='3660' y='-80' type='cloud' graphic='cloud' container='false' /><block x='3515' y='-175' type='cloud' graphic='cloud' container='false' /><block containerCounter='15' x='3530' y='-330' type='solid' graphic='cube' container='true' /><block x='3810' y='15' type='cloud' graphic='cloud' container='false' /></blocks><grounds><ground xstart='0' xend='1374.35' /><ground xstart='1504.65' xend='1977.85' /><ground xstart='2098.15' xend='2255.85' /><ground xstart='2376.15' xend='3122.8' /><ground xstart='3343.1' xend='3606.8' /><ground xstart='3757.1' xend='4800' /></grounds><baddies><baddy x='608.6' y='329.95' breadth='100' start_direction='left' speed='2' /><baddy x='1760.35' y='331.55' breadth='100' start_direction='right' speed='2' /><baddy x='2869.8' y='328.95' breadth='150' start_direction='left' speed='3' /><baddy x='2482.85' y='329.95' breadth='150' start_direction='right' speed='3' /><baddy graphic='bear' x='3520.75' y='331.9' breadth='100' start_direction='left' speed='4' /><baddy graphic='bear' x='4250' y='331.95' breadth='200' start_direction='left' speed='4' /></baddies><collectables><collectable x='257.6' type='ice cube'y='190.5' type='ice cube' /><collectable x='913' type='ice cube'y='197.3' type='ice cube' /><collectable x='1121.8' type='ice cube'y='101.75' type='ice cube' /><collectable x='309.95' type='ice cube'y='190' type='ice cube' /><collectable x='360.95' type='ice cube'y='189' type='ice cube' /><collectable x='1543.9' type='ice cube'y='30' type='ice cube' /><collectable x='1607.9' type='ice cube'y='-16' type='ice cube' /><collectable x='1666.9' type='ice cube'y='12' type='ice cube' /><collectable x='1711.9' type='ice cube'y='56' type='ice cube' /><collectable x='1736.9' type='ice cube'y='111' type='ice cube' /><collectable x='2667.85' type='ice cube'y='290.95' type='ice cube' /><collectable x='2717.8' type='ice cube'y='290.95' type='ice cube' /><collectable x='2762.8' type='ice cube'y='291.95' type='ice cube' /><collectable x='3242.8' type='ice cube'y='192' type='ice cube' /></collectables></level>");
levelXML = level1;
}
if (_local1 == 2) {
level2 = new XML("<level flagx='4555.3' flagy='331' ><blocks><block x='130' y='200' type='solid' graphic='cube' container='false' /><block x='177.35' y='151.95' type='solid' graphic='cube' container='false' /><block item='life' containerCounter='1' x='225' y='105' type='solid' graphic='cube' container='true' /><block x='270' y='55' type='solid' graphic='cube' container='false' /><block x='420' y='30' type='solid' graphic='ice platform' container='false' /><block x='2485' y='225' type='solid' graphic='tree' container='false' /><block x='2820' y='165' type='solid' graphic='tree' container='false' /><block x='3190' y='95' type='solid' graphic='tree' container='false' /><block x='3545' y='170' type='solid' graphic='tree' container='false' /><block x='3900' y='240' type='solid' graphic='tree' container='false' /><block x='3275' y='-30' type='cloud' graphic='cloud' container='false' /><block x='3275' y='-145' type='cloud' graphic='cloud' container='false' /><block x='3275' y='-250' type='cloud' graphic='cloud' container='false' /><block containerCounter='10' x='3295' y='-405' type='solid' graphic='cube' container='true' /></blocks><grounds><ground xstart='0' xend='128' /><ground xstart='278.3' xend='1118.9' /><ground xstart='1179.2' xend='1317.95' /><ground xstart='1378.25' xend='1532.95' /><ground xstart='1643.25' xend='1965'/><ground xstart='2085' xend='2380'/><ground xstart='4200' xend='4800' /></grounds><baddies><baddy x='548' y='29' breadth='100' start_direction='left' speed='3' /><baddy x='877.95' y='327.95' breadth='100' start_direction='left' speed='3' /><baddy x='960.95' y='328.95' breadth='100' start_direction='left' speed='3' /><baddy graphic='bug' x='1818.85' y='332.95' breadth='150' start_direction='left' speed='5' /><baddy graphic='bug' x='3330' y='108' breadth='120' start_direction='left' speed='5' /><baddy graphic='bug' x='4082.7' y='259' breadth='130' start_direction='left' speed='6' /><baddy x='2243.85' y='333.95' breadth='150' start_direction='left' speed='4' /></baddies><collectables><collectable x='157' type='ice cube'y='185' type='ice cube' /><collectable x='200' type='ice cube'y='138' type='ice cube' /><collectable x='250' type='ice cube'y='87' type='ice cube' /><collectable x='304' type='ice cube'y='43' type='ice cube' /><collectable x='673.95' type='ice cube'y='-24' type='ice cube' /><collectable x='721.95' type='ice cube'y='-62' type='ice cube' /><collectable x='779.95' type='ice cube'y='-43' type='ice cube' /><collectable x='830.95' type='ice cube'y='20' type='ice cube' /><collectable x='866.95' type='ice cube'y='92' type='ice cube' /><collectable x='867.95' type='ice cube'y='172.95' type='ice cube' /><collectable x='1259.95' type='ice cube'y='282' type='ice cube' /><collectable x='1552.95' type='ice cube'y='288' type='ice cube' /><collectable x='1598.9' type='ice cube'y='289' type='ice cube' /><collectable x='1645.9' type='ice cube'y='291' type='ice cube' /><collectable x='1947.85' type='ice cube'y='291.95' type='ice cube' /><collectable x='2027.85' type='ice cube'y='247' type='ice cube' /><collectable x='2103.85' type='ice cube'y='300.95' type='ice cube' /><collectable x='2880.8' type='ice cube'y='136' type='ice cube' /><collectable x='2921.8' type='ice cube'y='137' type='ice cube' /><collectable x='2967.8' type='ice cube'y='138' type='ice cube' /><collectable x='3009.8' type='ice cube'y='139' type='ice cube' /><collectable x='3049.8' type='ice cube'y='143' type='ice cube' /><collectable x='3591.8' type='ice cube'y='133' type='ice cube' /><collectable x='3629.8' type='ice cube'y='136' type='ice cube' /><collectable x='3677.8' type='ice cube'y='135' type='ice cube' /><collectable x='3716.8' type='ice cube'y='135' type='ice cube' /><collectable x='3757.75' type='ice cube'y='137' type='ice cube' /></collectables></level>");
levelXML = level2;
}
if (_local1 == 3) {
level3 = new XML("<level flagx='4327.2' flagy='-477.8' ><blocks><block x='1192.35' y='-43.05' type='solid' graphic='cube' container='false' /><block x='1247.35' y='-43.05' type='solid' graphic='cube' container='false' /><block item='life' containerCounter='1' x='1302.35' y='-43.05' type='solid' graphic='cube' container='true' /><block x='1357.35' y='-43.05' type='solid' graphic='cube' container='false' /><block x='1412.35' y='-43.05' type='solid' graphic='cube' container='false' /><block mover='true' x='1790' y='130' type='solid' graphic='ice platform' container='false' /><block x='1027.35' y='-233.05' type='cloud' graphic='cloud' container='false' /><block x='890' y='-430' type='cloud' graphic='cloud' container='false' /><block x='370' y='-205' type='solid' graphic='cloud' container='false' /><block x='1120' y='-600' type='solid' graphic='ice platform' container='false' /><block mover='true' x='1505' y='-610' type='cloud' graphic='cloud' container='false' /><block x='1825' y='-615' type='cloud' graphic='cloud' container='false' /><block maxxmov='450' xspeed='5' mover='yes' x='2515' y='-630' type='solid' graphic='ice platform' container='false' /><block containerCounter='15' x='390' y='-360' type='solid' graphic='cube' container='true' /><block x='3450' y='130' type='solid' graphic='tree' container='false' /><block x='3800' y='70' type='solid' graphic='tree' container='false' /><block x='4115' y='-115' type='cloud' graphic='cloud' container='false' /><block x='4295' y='-275' type='cloud' graphic='cloud' container='false' /><block x='4285' y='-495' type='cloud' graphic='cloud' container='false' /></blocks><grounds><ground xstart='0' xend='129' /><ground xstart='279.3' xend='518' /><ground xstart='948.3' xend='2733.85' /></grounds><baddies><baddy x='1442.9' y='327.95' breadth='180' start_direction='left' speed='5' /><baddy graphic='bug' x='1322.9' y='-38.95' breadth='150' start_direction='left' speed='6' /><baddy graphic='bee' x='1701.85' y='197' breadth='170' start_direction='left' speed='6' /><baddy graphic='bee' x='2092.85' y='201' breadth='170' start_direction='left' speed='6' /><baddy x='2237.85' y='332.95' breadth='150' start_direction='left' speed='5' /><baddy graphic='bee' x='1704.8' y='-680.95' breadth='180' start_direction='left' speed='7' /><baddy graphic='bee' x='2043.85' y='-682.95' breadth='180' start_direction='left' speed='7' /><baddy graphic='bug' x='1239.9' y='-597' breadth='100' start_direction='left' speed='6' /><baddy x='1219.9' y='329.95' breadth='180' start_direction='left' speed='5' /><baddy x='2534.85' y='330.95' breadth='150' start_direction='left' speed='5' /><baddy graphic='bug' x='3952.75' y='83' breadth='100' start_direction='left' speed='7' /><baddy graphic='bee' x='3718.75' y='16.05' breadth='100' start_direction='left' speed='7' /><baddy x='3604.75' y='147' breadth='100' start_direction='left' speed='5' /></baddies><collectables><collectable x='401' type='ice cube'y='300.95' type='ice cube' graphic='element'/><collectable x='1844.85' type='ice cube'y='100' type='ice cube' /><collectable x='1906.85' type='ice cube'y='98' type='ice cube' /><collectable x='1963.85' type='ice cube'y='101' type='ice cube' /><collectable x='1074.9' type='ice cube'y='-263.95' type='ice cube' /><collectable x='934.9' type='ice cube'y='-448.95' type='ice cube' /><collectable x='1553.9' type='ice cube'y='-648.95' type='ice cube' /><collectable x='1874.9' type='ice cube'y='-654.95' type='ice cube' /><collectable x='2722.8' type='ice cube'y='-663.95' type='ice cube' /><collectable x='2783.8' type='ice cube'y='-665.95' type='ice cube' /><collectable x='2844.8' type='ice cube'y='-661.95' type='ice cube' /><collectable x='3070.8' type='ice cube'y='-692.95' type='ice cube' /><collectable x='3140.8' type='ice cube'y='-744.95' type='ice cube' /><collectable x='3223.75' type='ice cube'y='-779.95' type='ice cube' /><collectable x='3304.75' type='ice cube'y='-743' type='ice cube' /><collectable x='3375.75' type='ice cube'y='-680.95' type='ice cube' /><collectable x='3438.75' type='ice cube'y='-487.95' type='ice cube' /><collectable x='3407.8' type='ice cube'y='-593' type='ice cube' /><collectable x='4161.75' type='ice cube'y='-159.95' type='ice cube' /><collectable x='4337.7' type='ice cube'y='-310.95' type='ice cube' /></collectables></level>");
levelXML = level3;
}
levelLoaded();
}
function makeMover(who) {
var _local1 = who;
_local1.me.homex = _local1._x;
_local1.me.homey = _local1._y;
_local1.onEnterFrame = moverFXN;
}
function listenForKeys() {
var _local1 = _global;
hero.wasCrouching = hero.isCrouching;
if (hero.inAir) {
hero.walkIncrement = hero.airWalkIncrement;
} else {
hero.walkIncrement = hero.groundWalkIncrement;
}
if (Key.isDown(39) && ((!hero.isCrouching) || (hero.isCrouching && (hero.inAir)))) {
hero.xmov = hero.xmov + hero.walkIncrement;
hero.walkRight();
} else if (Key.isDown(37) && ((!hero.isCrouching) || (hero.isCrouching && (hero.inAir)))) {
hero.xmov = hero.xmov - hero.walkIncrement;
hero.walkLeft();
}
if ((Key.isDown(32) || (Key.isDown(38))) && (okToJump)) {
okToJump = false;
if (_local1.doubleJump == 0) {
if ((!hero.isJumping) && (!hero.inAir)) {
hero.inAir = true;
hero.ymov = hero.ymov - hero.jumpSpeed;
hero.jump();
}
} else if (_local1.doubleJump == 1) {
if (!hero.inDoubleJump) {
hero.inAir = true;
_local1.jumpCount++;
if (_local1.jumpCount == 2) {
hero.inDoubleJump = true;
_local1.jumpCount = 0;
}
hero.ymov = hero.ymov - hero.jumpSpeed;
hero.jump();
}
}
} else if ((!Key.isDown(32)) && (!Key.isDown(38))) {
okToJump = true;
}
if (Key.isDown(40)) {
hero.crouch();
} else {
hero.unCrouch();
}
}
function addFrictionAndGravity() {
hero.ymov = hero.ymov + game.gravity;
if (!hero.inAir) {
hero.xmov = hero.xmov * game.runDecay;
} else {
hero.xmov = hero.xmov * game.windResistance;
}
if (Math.abs(hero.xmov) < hero.minXmov) {
if (hero.isWalking) {
hero.stopWalking();
}
hero.xmov = 0;
} else if (Math.abs(hero.xmov) > hero.maxXmov) {
hero.xmov = (Math.abs(hero.xmov) / hero.xmov) * hero.maxXmov;
}
}
function createTempPosition() {
hero.tempx = hero.x + hero.xmov;
hero.tempy = hero.y + hero.ymov;
var _local1 = Math.abs(hero.ymov);
if (_local1 > 10) {
if (_local1 > 22) {
hero.ymov = 22 * (hero.ymov / _local1);
}
game.totalIterations = 2;
} else {
game.totalIterations = 1;
}
}
function nextLife() {
levelRestart();
playSound("die");
hero.lives--;
display.num = hero.lives;
hero.dead = false;
hero.fallingToDeath = false;
hero.x = hero.startx;
hero.y = hero.starty;
hero.xmov = 0;
hero.ymov = 0;
hero.walkRight();
if (hero.lives < 0) {
levelComplete();
}
}
function renderScreen() {
hero.lastX = hero.x;
hero.lastY = hero.y;
hero.x = hero.tempx;
hero.y = hero.tempy;
clip._x = hero.x;
clip._y = hero.y;
if (hero.dead && ((hero.y - game.floor) > 250)) {
nextLife();
}
var _local2 = (-hero.x) * game.xScrollFactor;
var _local1 = ((-((hero.y - game.floor) - 20)) * game.yScrollFactor) - (game.bg.height - game.viewableHeight);
game.bg.position(_local2, _local1);
_local2 = (-hero.x) + (game.viewableWidth / 2);
_local1 = (-hero.y) + (game.viewableHeight / 2);
game.overlay.position(_local2, _local1);
}
function checkFloor() {
var heroOnFloor = (hero.tempY > game.floor);
if (heroOnFloor) {
var heroMin = hero.x;
var heroMax = (hero.x + hero.width);
var _local3 = false;
var _local1 = 0;
while (_local1 < game.grounds.length) {
var _local2 = game.grounds[_local1];
if ((heroMax > _local2.x1) && (heroMin < _local2.x2)) {
_local3 = true;
break;
}
_local1++;
}
if (!_local3) {
hero.dead = true;
}
}
if (((heroOnFloor && (_local3)) && (!hero.onPlatform)) && (!hero.fallingToDeath)) {
hero.ymov = 0;
hero.tempy = game.floor;
hero.stopJumping();
hero.inAir = false;
}
}
function bounceOffOfPlatform(newx) {
hero.x = newx;
hero.xmov = 0;
hero.tempx = hero.x + hero.xmov;
}
function bounceOffOfBottom(newy) {
hero.y = newy;
hero.ymov = 0;
hero.tempy = hero.y + hero.ymov;
}
function landOnPlatform(platformTop) {
hero.ymov = 0;
hero.y = platformTop;
hero.tempy = hero.y + hero.ymov;
hero.inAir = false;
hero.stopJumping();
}
function platformDetect() {
var oldOnPlatform = hero.onPlatform;
var onPlatform = false;
var i = 0;
while (i < game.platforms.column.length) {
var _local1 = game.platforms.column[i];
var _local2 = _local1.x;
var py = _local1.y;
var pw = _local1.width;
var ph = _local1.height;
var _local3 = _local1.type;
var iteration = 1;
while (iteration <= game.totalIterations) {
hero.tempx = hero.x + ((hero.xmov / game.totalIterations) * iteration);
hero.tempy = hero.y + ((hero.ymov / game.totalIterations) * iteration);
if (((((hero.tempx + hero.width) > _local2) && (hero.tempx < (_local2 + pw))) && ((hero.tempy - hero.height) < (py + ph))) && (hero.tempy > py)) {
if ((((hero.tempy > py) && (hero.y <= (py + 0.01))) && (hero.tempy < (py + ph))) && (hero.ymov > 0)) {
var onPlatform = true;
var platformTop = py;
landOnPlatform(platformTop);
if (_local3 == "cloud") {
} else if (_local3 == "cloud1") {
}
if (_local1.mover == "yes") {
var xinc = (_local1.xspeed + (hero.xmov * 0.5));
hero.x = hero.x + xinc;
hero.y = hero.y + (_local1.yspeed + (hero.ymov * 0.5));
hero.tempx = hero.x;
hero.tempy = hero.y;
}
} else if (((((((_local3 != "cloud") && (_local3 != "cloud1")) && ((hero.tempy - hero.height) > py)) && ((hero.tempy - hero.height) < (py + ph))) && ((hero.tempx + (hero.width / 2)) > _local2)) && (hero.tempx < ((_local2 + pw) - (hero.width / 2)))) && (hero.ymov < 0)) {
var newy = ((py + ph) + hero.height);
bounceOffOfBottom(newy);
if (_local1.container) {
if (_local1.item == "life") {
hero.lives++;
display.num = hero.lives;
playSound("intro");
_local1.clip.itemLife.gotoAndPlay("Display Life");
if ((--_local1.containerCounter) <= 0) {
_local1.container = false;
}
break;
}
_local1.clip.item.gotoAndPlay("Display");
display.num2 = Number(display.num2) + 1;
_global.score = display.num2;
if (_global.score > _global.num4life) {
display.num2 = 0;
_global.score = display.num2;
hero.lives++;
display.num = hero.lives;
playSound("intro");
}
playSound("collect");
if ((--_local1.containerCounter) <= 0) {
_local1.container = false;
}
}
} else if ((((_local3 != "cloud") && (_local3 != "cloud1")) && ((hero.tempx + hero.width) > _local2)) && ((hero.tempx + hero.width) < (_local2 + pw))) {
if (!hero.wasCrouching) {
var newx = (_local2 - hero.width);
bounceOffOfPlatform(newx);
} else {
hero.crouch();
var crouchMove = true;
var left = true;
}
} else if ((((_local3 != "cloud") && (_local3 != "cloud1")) && (hero.tempx > _local2)) && (hero.tempx < (_local2 + pw))) {
if (!hero.wasCrouching) {
var newx = (_local2 + pw);
bounceOffOfPlatform(newx);
} else {
hero.crouch();
var crouchMove = true;
var left = false;
}
} else if (_local3 == "cloud") {
} else if (_local3 == "cloud1") {
}
}
iteration++;
}
i++;
}
hero.onPlatform = onPlatform;
if (crouchMove) {
if (left) {
hero.tempx = hero.tempx - hero.pushSpeed;
} else {
hero.tempx = hero.tempx + hero.pushSpeed;
}
}
if ((!hero.onPlatform) && (oldOnPlatform)) {
hero.inAir = true;
}
}
function killBaddy(who, index) {
playSound("kill");
who.clip.animation.gotoAndPlay("dead");
game.baddies.splice(index, 1);
}
function baddyDetection() {
var _local3 = _global;
var _local1 = 0;
while (_local1 < game.baddies.length) {
var _local2 = game.baddies[_local1];
if (hero.clip.animation.hitArea1.hitTest(_local2.clip.hitArea)) {
if (hero.ymov > game.gravity) {
hero.tempy = hero.y;
hero.ymov = -15;
killBaddy(_local2, _local1);
} else if (((hero.ymov < 0) && (_local3.jumpCount == 0)) && (_local3.doubleJump == 1)) {
hero.tempy = hero.y;
hero.ymov = -15;
killBaddy(_local2, _local1);
} else {
hero.ymov = -20;
hero.xmov = 15;
hero.die();
}
}
_local1++;
}
}
function collectableDetect() {
var _local2 = _global;
var _local3 = 0;
while (_local3 < game.collectables.length) {
var _local1 = game.collectables[_local3];
if (hero.clip.hitTest(_local1.clip) && (!_local1.captured)) {
if (_local1.graphic == "element") {
_local2.doubleJump = 1;
playSound("magic");
_local1.captured = true;
hero.clip.animation.elm.gotoAndPlay(2);
_local1.clip.gotoAndPlay("Capture");
return;
}
display.num2 = Number(display.num2) + 1;
_local2.score = display.num2;
if (_local2.score > _local2.num4life) {
display.num2 = 0;
_local2.score = display.num2;
hero.lives++;
display.num = hero.lives;
playSound("intro");
}
playSound("collect");
_local1.captured = true;
_local1.clip.gotoAndPlay("Capture");
}
_local3++;
}
}
function detectFlag() {
if (hero.clip.hitTest(game.flag.clip) && (!game.flagCaptured)) {
game.flagCaptured = true;
playSound("flag");
game.flag.clip.play();
}
}
function CloudFall(id) {
trace("name je" add id);
}
stop();
soundOn = true;
game = {};
game.level = 1;
game.numLevels = 3;
game.hero = {};
game.hero.clip = gameClip.overlay.man;
game.bg = {};
game.bg.clip = gameClip.bg;
game.bg.x = 0;
game.bg.y = 0;
game.bg.height = game.bg.clip._height;
game.bg.width = game.bg.clip._width;
game.overlay = {};
game.overlay.clip = gameClip.overlay;
game.overlay.x = 0;
game.overlay.y = 0;
game.gravity = 2;
game.windResistance = 0.92;
game.numLives = 4;
hero = game.hero;
hero.lives = game.numLives - 1;
clip = game.hero.clip;
hero.xmov = 0;
hero.startx = 50;
hero.starty = 320;
hero.standingHeight = 65;
hero.crouchingHeight = 50;
hero.width = 47;
hero.height = hero.standingHeight;
hero.ymov = 0;
hero.minXmov = 0.5;
hero.maxXmov = 12;
hero.groundWalkIncrement = 2;
hero.airWalkIncrement = 0.98;
hero.pushSpeed = 15;
hero.walkIncrement = hero.groundWalkIncrement;
hero.jumpSpeed = 29;
hero.clip.swapDepths(1000000);
game.runDecay = 0.9;
game.depth = 10000;
game.floor = 330;
game.viewableHeight = 350;
game.viewableWidth = 680;
game.walkAbleWidth = 4800;
game.walkAbleHeight = 4000;
game.xScrollFactor = (game.bg.width - game.viewableWidth) / game.walkAbleWidth;
game.yScrollFactor = game.bg.height / game.walkAbleHeight;
_global.score = 0;
_global.num4life = 99;
_global.doubleJump = 0;
_global.jumpCount = 0;
moverFXN = function () {
var _local1 = this;
_local1.me.tempx = _local1._x + _local1.me.xspeed;
_local1.me.tempy = _local1._y + _local1.me.yspeed;
if (_local1.me.xspeed > 0) {
if (_local1.me.tempx < (_local1.me.homex + _local1.me.maxxmov)) {
_local1._x = _local1.me.tempx;
} else {
_local1.me.xspeed = -Math.abs(_local1.me.xspeed);
}
}
if (_local1.me.xspeed < 0) {
if (_local1.me.tempx > (_local1.me.homex - _local1.me.maxxmov)) {
_local1._x = _local1.me.tempx;
} else {
_local1.me.xspeed = Math.abs(_local1.me.xspeed);
}
}
if (_local1.me.yspeed > 0) {
if (_local1.me.tempy < (_local1.me.homey + _local1.me.maxymov)) {
_local1._y = _local1.me.tempy;
} else {
_local1.me.yspeed = -Math.abs(_local1.me.yspeed);
}
}
if (_local1.me.yspeed < 0) {
if (_local1.me.tempy > (_local1.me.homey - _local1.me.maxymov)) {
_local1._y = _local1.me.tempy;
} else {
_local1.me.yspeed = Math.abs(_local1.me.yspeed);
}
}
_local1.me.x = _local1._x;
_local1.me.y = _local1._y;
};
hero.stopWalking = function () {
var _local1 = this;
_local1.isWalking = false;
if (!_local1.isCrouching) {
_local1.clip.animation.gotoAndStop(1);
}
};
hero.walkRight = function () {
var _local1 = this;
_local1.isWalking = true;
_local1.clip.animation._xscale = 100;
if (!_local1.inAir) {
_local1.clip.animation.play();
}
};
hero.walkLeft = function () {
var _local1 = this;
_local1.isWalking = true;
_local1.clip.animation._xscale = -100;
if (!_local1.inAir) {
_local1.clip.animation.play();
}
};
hero.jump = function () {
playSound("jump");
this.isJumping = true;
this.clip.animation.gotoAndStop("Jump Frame");
};
hero.die = function () {
playSound("die");
this.dead = true;
hero.clip.animation.elm.gotoAndStop(1);
this.clip.animation.gotoAndStop("Dead");
};
hero.crouch = function () {
var _local1 = this;
_local1.isCrouching = true;
_local1.height = _local1.crouchingHeight;
_local1.clip.animation.gotoAndStop("Crouch");
if (Key.isDown(39)) {
_local1.clip.animation._xscale = 100;
} else if (Key.isDown(37)) {
_local1.clip.animation._xscale = -100;
}
};
hero.unCrouch = function () {
var _local1 = this;
if (_local1.isCrouching) {
_local1.isCrouching = false;
_local1.height = _local1.standingHeight;
if (!_local1.inAir) {
if (_local1.isWalking) {
_local1.clip.animation.gotoAndPlay("Walk");
} else {
_local1.clip.animation.gotoAndStop(1);
}
} else if (_local1.inAir) {
if (_local1.isJumping) {
_local1.clip.animation.gotoAndStop("Jump Frame");
}
}
}
};
hero.stopJumping = function () {
var _local1 = this;
if (_local1.isJumping) {
_local1.isJumping = false;
if (_global.doubleJump == 1) {
_local1.inDoubleJump = false;
_global.jumpCount = 0;
}
if (!_local1.isWalking) {
if (!_local1.isCrouching) {
_local1.clip.animation.gotoAndStop(1);
} else {
_local1.clip.animation.gotoAndStop("Crouch");
}
} else if (_local1.isCrouching) {
_local1.clip.animation.gotoAndStop("Crouch");
} else {
_local1.clip.animation.gotoAndPlay("Walk");
}
}
};
hero.stopWalking();
game.bg.position = function (x, y) {
var _local1 = y;
var _local2 = x;
if (_local2 > 0) {
_local2 = 0;
}
if ((_local1 + game.bg.height) < (game.floor + 30)) {
_local1 = (game.floor + 30) - game.bg.height;
}
if ((_local2 + game.bg.width) < game.viewableWidth) {
_local2 = game.viewAbleWidth - game.bg.width;
}
game.bg.clip.x = _local2;
game.bg.clip.y = _local1;
game.bg.clip._x = _local2;
game.bg.clip._y = _local1;
};
game.overlay.position = function (x, y) {
var _local1 = y;
var _local2 = x;
if (_local2 > 0) {
_local2 = 0;
} else if (_local2 < ((-game.walkableWidth) + game.viewableWidth)) {
_local2 = (-game.walkableWidth) + game.viewableWidth;
}
if (_local1 < 0) {
_local1 = 0;
}
game.overlay.clip.x = _local2;
game.overlay.clip.y = _local1;
game.overlay.clip._x = _local2;
game.overlay.clip._y = _local1;
};
game.bg.position(0, 0);
loadLevel(1);
playSound("music");
this.onEnterFrame = function () {
if (game.inPlay) {
if (!hero.dead) {
listenForKeys();
}
addFrictionAndGravity();
createTempPosition();
if (!hero.dead) {
baddyDetection();
platformDetect();
collectableDetect();
detectFlag();
checkFloor();
}
renderScreen();
}
};