Frame 2
MochiAd.showPreloaderAd({id:"5ea65586212cb883", res:"800x300"});
Frame 3
function makeBlur(sprite, pixels) {
sprite.filters = [new flash.filters.BlurFilter(pixels, pixels)];
}
this._lockroot = true;
this.mMovieLoaded = false;
Frame 5
var shell = this._parent;
_root.snowing = true;
if ((!this.mMovieLoaded) || (shell.getBytesLoaded() < shell.getBytesTotal())) {
this.gotoAndPlay(this._currentframe - 1);
}
Frame 13
if (mCompanyAnim._currentframe < mCompanyAnim._totalframes) {
gotoAndPlay(_currentframe - 1);
}
Frame 17
gotoAndPlay ("TitleCard");
PumaMain.main();
mMoviePlayer.loadMovie("movieplayer.swf");
Frame 18
Game.reset();
_root.rNextScreen = "LevelUp";
Frame 23
stop();
Frame 28
gotoAndPlay(_root.rNextScreen);
Frame 29
Frame 33
stop();
Frame 40
gotoAndPlay ("LevelUp");
Frame 41
Game.reset();
SoundLib.singleton.stopSound("maintheme", null);
SoundLib.singleton.stopSound("loseloop", null);
SoundLib.singleton.stopSound("winsting", null);
SoundLib.singleton.stopSound("combatloop", null);
Frame 47
if (mIntro._currentframe < mIntro._totalframes) {
this.gotoAndPlay(this._currentframe - 1);
}
Frame 54
gotoAndPlay ("Instructions");
Frame 55
PumaMain.startLevel();
Frame 65
if (mGameIntro._currentframe < (mGameIntro._totalframes - 5)) {
this.gotoAndPlay(this._currentframe - 1);
}
Frame 70
Game.sLevel++;
mTitleClip.mLevel = "" + Game.sLevel;
this.mDelay = 0;
PumaMain.startLevel();
_root.snowing = true;
Frame 73
Frame 113
PumaMain.main();
mMoviePlayer.loadMovie("movieplayer.swf");
Frame 114
Game.singleton.gotoState("run");
Frame 119
stop();
Frame 120
mPauseClip._visible = false;
_root.snowing = false;
Frame 123
mPauseClip._visible = true;
Frame 128
stop();
Frame 129
_root.snowing = true;
Frame 136
stop();
Frame 143
Game.levelResult(Game.singleton);
Game.singleton.terminate();
mLevelEndTitle._visible = false;
Frame 145
if (Game.sFailed) {
gotoAndPlay ("LoseGame");
} else {
gotoAndPlay ("ending");
}
Frame 158
if (mMovie._currentframe < mMovie._totalframes) {
this.gotoAndPlay(this._currentframe - 1);
} else {
mMovie.stop();
}
Frame 172
if (Game.sFailed) {
this.gotoAndPlay("LoseGame");
} else {
mLevelEndTitle._visible = true;
}
mMovie.removeMovieClip();
Frame 173
SoundLib.singleton.playSound("levelup", 50, 1, null);
this.mDelay = true;
Frame 177
if (this.mDelay) {
this.gotoAndPlay(this._currentframe - 1);
}
Frame 181
if (Game.sFailed) {
this.gotoAndPlay("LoseGame");
} else if (Game.sLevel >= 5) {
this.gotoAndPlay("WinGame");
} else {
this.gotoAndPlay("LevelUp");
}
Frame 182
Game.gameResult();
SoundLib.singleton.playSound("loseloop", 50, 1, null);
Frame 186
stop();
_global.shellGui.highScore(false, Game.sScore);
Frame 192
Game.reset();
gotoAndPlay ("LevelUp");
Frame 197
Frame 201
stop();
_global.shellGui.highScore(true, Game.sScore);
Frame 207
Game.reset();
gotoAndPlay ("TitleCard");
Frame 222
stop();
Frame 227
gotoAndPlay ("TitleCard");
Symbol 18 MovieClip [company_logo] Frame 150
stop();
Symbol 994 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function showPreloaderAd(options) {
var _local29 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812};
options = _parseOptions(options, _local29);
var _local15 = options.clip;
var _local25 = 11000;
var _local28 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
return(undefined);
}
_local15.stop();
var mc = _local15._mochiad;
mc.onUnload = function () {
this._parent.play();
};
var _local16 = _getRes(options);
var _local5 = _local16[0];
var _local14 = _local16[1];
mc._x = _local5 * 0.5;
mc._y = _local14 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local5 * -0.5;
chk._y = _local14 * -0.5;
var _local8 = chk.createEmptyMovieClip("_mochiad_bar", 4);
_local8._x = 10;
_local8._y = _local14 - 20;
var _local24 = options.color;
delete options.color;
var _local21 = options.background;
delete options.background;
var _local26 = options.outline;
delete options.outline;
var _local6 = _local8.createEmptyMovieClip("_outline", 1);
_local6.beginFill(_local21);
_local6.moveTo(0, 0);
_local6.lineTo(_local5 - 20, 0);
_local6.lineTo(_local5 - 20, 10);
_local6.lineTo(0, 10);
_local6.lineTo(0, 0);
_local6.endFill();
var _local4 = _local8.createEmptyMovieClip("_inside", 2);
_local4.beginFill(_local24);
_local4.moveTo(0, 0);
_local4.lineTo(_local5 - 20, 0);
_local4.lineTo(_local5 - 20, 10);
_local4.lineTo(0, 10);
_local4.lineTo(0, 0);
_local4.endFill();
_local4._xscale = 0;
var _local7 = _local8.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local26, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local5 - 20, 0);
_local7.lineTo(_local5 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local25;
chk.ad_timeout = _local28;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local12 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local10 = (100 * _local8) / _local4;
var _local11 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local2 = Math.min(100, Math.min(_local10 || 0, _local11));
_local2 = Math.max(this.last_pcnt, _local2);
this.last_pcnt = _local2;
_local9._xscale = _local2;
if (!chk.showing) {
var _local7 = _local12.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local5 > chk.ad_timeout) {
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showTimedAd(options) {
var _local15 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd"};
options = _parseOptions(options, _local15);
var _local6 = options.clip;
var _local12 = 11000;
var _local14 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
return(undefined);
}
_local6.stop();
var mc = _local6._mochiad;
mc.onUnload = function () {
this._parent.play();
};
var _local7 = _getRes(options);
var _local16 = _local7[0];
var _local13 = _local7[1];
mc._x = _local16 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local12;
chk.ad_timeout = _local14;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function _loadCommunicator(options) {
var _local25 = {clip:_root, com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = _parseOptions(options, _local25);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = "1.4";
var _local18 = options.clip;
var _local20 = "_mochiad_com_" + options.id;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local18[_local20]) {
return(_local18[_local20].lc);
}
var _local21 = options.com_server + options.id;
_allowDomains(_local21);
delete options.id;
delete options.com_server;
var _local24 = options.depth;
delete options.depth;
var _local17 = _local18.createEmptyMovieClip(_local20, _local24);
var _local11 = _local17.createEmptyMovieClip("_mochiad_com", 1);
for (var _local15 in options) {
_local11[_local15] = options[_local15];
}
var _local6 = new LocalConnection();
var _local16 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local6.mc = _local17;
_local6.name = _local16;
_local6.allowDomain = function (d) {
return(true);
};
_local6.allowInsecureDomain = _local6.allowDomain;
_local6.connect(_local16);
_local17.lc = _local6;
_local11.lc = _local16;
_local6._id = 0;
_local6._queue = [];
_local6.rpcResult = function (cb) {
cb = parseInt(cb);
var _local4 = this._callbacks[cb];
if (!_local4) {
return(undefined);
}
delete this._callbacks[cb];
var _local5 = [];
var _local3 = 2;
while (_local3 < _local4.length) {
_local5.push(_local4[_local3]);
_local3++;
}
_local3 = 1;
while (_local3 < arguments.length) {
_local5.push(arguments[_local3]);
_local3++;
}
var _local6 = _local4[1];
var _local7 = _local4[0];
if (_local7 && (typeof(_local6) == "string")) {
_local6 = _local7[_local6];
}
if (_local6) {
_local6.apply(_local7, _local5);
}
};
_local6._didConnect = function (endpoint) {
this._endpoint = endpoint;
var _local4 = this._queue;
delete this._queue;
var _local5 = this.doSend;
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
_local5.apply(this, _local3);
_local2++;
}
};
_local6.doSend = function (args, cbobj, cbfn) {
if (this._endpoint == null) {
var _local4 = [];
var _local3 = 0;
while (_local3 < arguments.length) {
_local4.push(arguments[_local3]);
_local3++;
}
this._queue.push(_local4);
return(undefined);
}
this._id = this._id + 1;
var _local5 = this._id;
if ((cbfn === undefined) || (cbfn === null)) {
cbfn = cbobj;
}
this._callbacks[_local5] = [cbobj, cbfn];
var _local7 = new LocalConnection();
var _local9 = _local7.send(this._endpoint, "rpc", _local5, args);
};
_local6._callbacks = {};
_local6._callbacks[0] = [_local6, "_didConnect"];
_local11.st = getTimer();
_local11.loadMovie(_local21 + ".swf", "POST");
return(_local6);
}
static function fetchHighScores(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["fetchHighScores", options];
_local1.doSend(["fetchHighScores", options], callbackObj, callbackMethod);
return(true);
}
static function sendHighScore(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["sendHighScore", options];
_local1.doSend(["sendHighScore", options], callbackObj, callbackMethod);
return(true);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = "1.4";
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local7._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
if (_local7._url.indexOf("http") != 0) {
options.no_page = true;
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local4);
}
}
Symbol 995 MovieClip [__Packages.PumaMain] Frame 0
class PumaMain
{
function PumaMain () {
}
static function main() {
trace("hello");
Game.initStateMachine();
Actor.initStateMachine();
Actor.initStateMachine();
var _local2 = new SoundLib(_root);
Game.reset();
_root.PauseGame = function () {
if (Game.singleton) {
if (Game.singleton.isInState("run")) {
Game.singleton.pause_game();
}
}
};
_root.UnPauseGame = function () {
if (Game.singleton) {
if (Game.singleton.isInState("pause")) {
Game.singleton.pause_game();
}
}
};
_root.PlayAgain = function () {
if (Game.singleton) {
Game.singleton.terminate();
}
Game.reset();
SoundLib.singleton.stopSound("maintheme", null);
SoundLib.singleton.stopSound("loseloop", null);
SoundLib.singleton.stopSound("winsting", null);
SoundLib.singleton.stopSound("combatloop", null);
_root.gotoAndPlay("LevelUp");
};
_root.StartGame = function () {
PumaMain.gShellLoaded = true;
};
SoundLib.singleton.playSound("maintheme", 50, 1, null);
}
static function startLevel() {
if (Game.singleton) {
Game.singleton.terminate();
}
var _local2 = _root.gameroot.createEmptyMovieClip("game_root", _root.gameroot.getNextHighestDepth());
var _local3 = new Game(_local2, Game.sLevel);
_local2.onEnterFrame = function () {
Game.singleton.update();
};
}
static var gShellLoaded = false;
}
Symbol 996 MovieClip [__Packages.tinymantis.GameObject] Frame 0
class tinymantis.GameObject
{
function GameObject (className) {
mClassName = className;
}
function gotoState(inState) {
if (inState == null) {
throw new Error("Error: cannot goto a 'null' State");
}
if (mStateMachineMap == null) {
mStateMachineMap = new Array();
}
var _local2 = sStateMap[mClassName][inState];
if (!mStateMachineMap[_local2]) {
mStateMachineMap[_local2] = new tinymantis.StateMachine(this);
}
mStateMachineMap[_local2].setState(inState);
}
function isInState(inState) {
var _local2 = 0;
var _local3 = mStateMachineMap.length;
while (_local2 < _local3) {
if (mStateMachineMap[_local2].mCurrState == inState) {
return(true);
}
_local2++;
}
return(false);
}
function update() {
var _local2 = 0;
var _local3 = mStateMachineMap.length;
while (_local2 < _local3) {
if (mStateMachineMap[_local2]) {
mStateMachineMap[_local2].update();
}
_local2++;
}
}
function run(yes) {
var _local2 = 0;
var _local3 = mStateMachineMap.length;
while (_local2 < _local3) {
if (mStateMachineMap[_local2]) {
mStateMachineMap[_local2].run(yes);
}
_local2++;
}
}
static function buildStateGroup(inClassName, inStateGroup, inGroupIndex) {
if (typeof(sStateMap[inClassName]) == "undefined") {
sStateMap[inClassName] = new Object();
}
var _local1 = 0;
while (_local1 < inStateGroup.length) {
sStateMap[inClassName][inStateGroup[_local1]] = inGroupIndex;
_local1++;
}
}
var mStateMachineMap = null;
var mClassName = "";
var mStateParam = null;
static var sStateMap = new Object();
}
Symbol 997 MovieClip [__Packages.tinymantis.StateMachine] Frame 0
class tinymantis.StateMachine
{
function StateMachine (inParent) {
if (inParent == null) {
throw new Error("StateMachine : cannot initialize: inParent is null");
}
mParent = inParent;
}
function resetState() {
mParent[mCurrState + "_exit"]();
mCurrState = (mNextState = null);
}
function setState(inState) {
if (inState == null) {
throw new Error("StateMachine : cannot setState: inState is null; Use resetState instead.");
}
mNextState = inState;
}
function update() {
if (mNextState) {
mParent[mCurrState + "_exit"]();
mCurrState = mNextState;
mNextState = null;
mParent[mCurrState + "_enter"]();
}
if (mCurrState != null) {
mParent[mCurrState + "_update"]();
}
}
function run(yes) {
mParent[mCurrState + "_run"](yes);
}
var mParent = null;
var mNextState = null;
var mCurrState = null;
}
Symbol 998 MovieClip [__Packages.Game] Frame 0
class Game extends tinymantis.GameObject
{
static var sLevel, sScore, sNinjaDefeated, sTimeTaken, sNumberAttacks, sNumberHits;
var mStateParam, mLevel, mRootSprite, mStageRangeX, mStageRangeY, mLayers, mEnemies, mCamera, mUI, gotoState, isInState, mMainChar, mMusic;
function Game (root, level) {
super("Game");
singleton = this;
mStateParam = new Object();
mLevel = level;
mNumEnemiesDown = 0;
mRootSprite = root;
mRootSprite._x = (mRootSprite._y = 0);
mRootSprite._xscale = (mRootSprite._yscale = 100);
mRootSprite._visible = false;
mStageRangeX = 1030;
mStageRangeY = 90;
mLayers = new Array();
mEnemies = new Array();
var _local3;
_local3 = new Layer(mRootSprite, "back_ground", 500, 20);
mLayers.push(_local3);
_local3 = new Layer(mRootSprite, "mid_ground", 1005, 70);
mLayers.push(_local3);
_local3 = new Layer(mRootSprite, "empty_clip", mStageRangeX, mStageRangeY);
mLayers.push(_local3);
_local3 = new Layer(mRootSprite, "fore_ground", 1200, 110);
mLayers.push(_local3);
mCamera = new GameCamera();
mUI = new InGameMenu(mRootSprite);
mUI.mSprite.mHelpButton.enabled = false;
var _local4 = mRootSprite.attachMovie("GameMask", "game_mask", mRootSprite.getNextHighestDepth());
gotoState("init");
}
static function reset() {
sFailed = false;
sLevel = 0;
sScore = 0;
sNinjaDefeated = 0;
sTimeTaken = 0;
sNumberAttacks = 0;
sNumberHits = 0;
}
static function levelResult(game) {
var _local10 = game.getTotalEnemies();
var _local5 = _local10 - game.getNumEnemies();
var _local4 = game.mMainChar.getNumberAttacks();
var _local8 = game.mMainChar.getNumberHits();
var _local3 = 0;
if (_local4) {
_local3 = Math.round((_local8 / _local4) * 100);
}
var _local7 = singleton.getTimeTaken();
var _local9 = ((_local5 * 100) + Math.max(0, 5000 - _local7)) + (_local3 * 100);
sScore = sScore + _local9;
sNinjaDefeated = sNinjaDefeated + _local5;
sTimeTaken = sTimeTaken + _local7;
sNumberAttacks = sNumberAttacks + _local4;
sNumberHits = sNumberHits + _local8;
var _local6 = "" + _local5;
_local6 = _local6 + (newline + game.getTimeTakenString());
_local6 = _local6 + ((newline + _local3) + "%");
sFailed = game.__get__player().mHp <= 0;
_root.mLevelEndTitle.mLevel = "" + sLevel;
_root.mLevelEndTitle.mScore = "" + _local9;
_root.mLevelEndTitle.mStats = _local6;
_root.mLevelEndTitle.mTotalScore = "" + sScore;
}
static function gameResult() {
var _local3 = 0;
if (sNumberAttacks) {
_local3 = Math.round((sNumberHits / sNumberAttacks) * 100);
}
var _local2 = "" + sNinjaDefeated;
_local2 = _local2 + (newline + tinymantis.Utils.convertTimeToString(sTimeTaken, 24));
_local2 = _local2 + ((newline + _local3) + "%");
_local2 = _local2 + (newline + sLevel);
_root.mFinalStats = _local2;
_root.mFinalScores = sScore;
}
function getDoorClip() {
var _local2 = mLayers[1];
return(_local2.__get__sprite().mDoor);
}
function terminate() {
SoundLib.singleton.stopSound("combatloop", null);
mRootSprite.removeMovieClip();
singleton = null;
}
function pause_game() {
if (isInState("run")) {
gotoState("pause");
} else if (isInState("pause")) {
gotoState("run");
}
mStateParam.show_instructions = false;
}
function get enemies() {
return(mEnemies);
}
function get player() {
return(mMainChar);
}
function setCameraPosition(x, y) {
var _local3 = (-x) / mStageRangeX;
var _local4 = (-y) / mStageRangeY;
var _local2 = 0;
while (_local2 < mLayers.length) {
mLayers[_local2].setCameraShiftPercent(_local3, _local4);
_local2++;
}
}
function getTotalEnemies() {
switch (mLevel) {
case 0 :
return(0);
case 1 :
return(20);
}
return(1);
}
function getNumEnemies() {
var _local4 = 0;
var _local2 = 0;
while (_local2 < mEnemies.length) {
var _local3 = mEnemies[_local2];
if (_local3.mHp > 0) {
_local4++;
}
_local2++;
}
return(_local4);
}
function getMaxScreenEnemies() {
switch (mLevel) {
case 0 :
return(0);
case 1 :
return(3);
}
return(1);
}
function getTimeTakenString() {
return(mUI.mSprite.mTime);
}
function getTimeTaken() {
return(mUI.mTimer);
}
function showInstructions() {
if (isInState("run")) {
gotoState("pause");
mStateParam.show_instructions = true;
}
}
function init_update() {
mMainChar = new MainChar(mLayers[LAYER_STAGE].sprite);
var _local3;
var _local4 = getTotalEnemies();
var _local2 = 0;
while (_local2 < _local4) {
_local3 = new Enemy(mLayers[LAYER_STAGE].sprite);
mEnemies.push(_local3);
_local2++;
}
mCamera.update(mMainChar);
setCameraPosition(mCamera.__get__x(), mCamera.__get__y());
mRootSprite._visible = true;
gotoState("idle");
mMainChar.__get__sprite()._visible = false;
}
function removeEnemy(enemy) {
var _local2 = 0;
while (_local2 < mEnemies.length) {
if (mEnemies[_local2] == enemy) {
mEnemies[_local2] = mEnemies[mEnemies.length - 1];
mEnemies.pop();
mNumEnemiesDown++;
break;
}
_local2++;
}
if (mEnemies.length == 0) {
gotoState("end");
}
}
function idle_enter() {
mMainChar.update();
mMainChar.gotoState("wait");
}
function idle_update() {
mMainChar.update();
mCamera.update(mMainChar);
setCameraPosition(mCamera.__get__x(), mCamera.__get__y());
}
function idle_exit() {
mMainChar.gotoState("idle");
}
function run_enter() {
SoundLib.singleton.playSound("combatloop", 50, 100000, null);
mUI.mSprite.mHelpButton.enabled = true;
mUI.mSprite.mMuteButton.enabled = true;
mMusic = new Sound(null);
onMusicOver();
}
function onMusicOver() {
if (mMusic) {
var _local2 = Math.floor(Math.random() * 5);
mMusic = SoundLib.singleton.playSound("music" + _local2, 100, 1, null);
mMusic.onSoundComplete = tinymantis.Delegate.create(this, onMusicOver);
trace("playing music " + _local2);
}
}
function run_update() {
mMainChar.update();
var _local3 = new Array().concat(mEnemies);
var _local2 = 0;
while (_local2 < _local3.length) {
mEnemies[_local2].update();
_local2++;
}
mUI.update();
mCamera.update(mMainChar);
setCameraPosition(mCamera.__get__x(), mCamera.__get__y());
addEnemy();
}
function run_exit() {
var _local2 = mMusic;
mMusic = null;
_local2.stop();
SoundLib.singleton.stopSound("combatloop", null);
mUI.mSprite.mHelpButton.enabled = false;
mUI.mSprite.mMuteButton.enabled = false;
}
function addEnemy() {
var _local4 = 0;
var _local6 = 0;
var _local3 = 0;
while (_local3 < mEnemies.length) {
var _local2 = mEnemies[_local3];
if (_local2.mOnStage) {
_local4++;
}
_local3++;
}
var _local5 = 1;
if (mNumEnemiesDown > 15) {
_local5 = 3;
} else if (mNumEnemiesDown > 3) {
_local5 = 2;
}
if (_local4 < _local5) {
_local3 = 0;
while (_local3 < mEnemies.length) {
var _local2 = mEnemies[_local3];
if ((!_local2.mOnStage) && (_local2.isInState("wait"))) {
_local2.mOnStage = true;
_local2.gotoState("idle");
break;
}
_local3++;
}
}
}
function pause_enter() {
mMainChar.__get__sprite().body.stop();
var _local3 = 0;
while (_local3 < mEnemies.length) {
mEnemies[_local3].sprite.body.stop();
_local3++;
}
_root.gotoAndPlay("GamePaused");
_root.mPauseClip.gotoAndStop((mStateParam.show_instructions ? 2 : 1));
}
function pause_exit() {
mMainChar.__get__sprite().body.play();
var _local3 = 0;
while (_local3 < mEnemies.length) {
mEnemies[_local3].sprite.body.play();
_local3++;
}
_root.gotoAndPlay("GameResume");
}
function end_enter() {
mMainChar.gotoState("gotodoor");
}
function end_update() {
mMainChar.update();
var _local3 = new Array().concat(mEnemies);
var _local2 = 0;
while (_local2 < _local3.length) {
mEnemies[_local2].update();
_local2++;
}
mUI.update();
mRootSprite._xscale = mRootSprite._xscale + ((120 - mRootSprite._xscale) * 0.2);
mRootSprite._yscale = mRootSprite._xscale;
var _local4 = mRootSprite._xscale / 100;
mRootSprite._y = -((300 * _local4) - 300);
mCamera.update(mMainChar);
setCameraPosition(mCamera.__get__x() / _local4, mCamera.__get__y() / _local4);
if (mMainChar.isInState("disappear")) {
gotoState("over");
}
}
function over_enter() {
_root.gotoAndPlay("LevelEnd");
}
static function initStateMachine() {
tinymantis.GameObject.buildStateGroup("Game", new Array("init", "idle", "run", "pause", "end", "over"), 0);
}
static var sFailed = false;
static var LAYER_BACKGROUND = 0;
static var LAYER_MIDGROND = 1;
static var LAYER_STAGE = 2;
static var LAYER_FOREGROUND = 3;
static var singleton = null;
var mStageMinX = -900;
var mStageMaxX = 900;
var mNumEnemiesDown = 0;
}
Symbol 999 MovieClip [__Packages.tinymantis.Utils] Frame 0
class tinymantis.Utils
{
function Utils () {
}
static function convertTimeToString(inframes, infps) {
var _local3 = Math.floor(inframes / infps);
var _local4 = Math.floor(_local3 / 60);
_local3 = _local3 - (_local4 * 60);
var _local1 = "" + _local3;
var _local2 = "" + _local4;
if (_local2.length < 2) {
_local2 = "0" + _local2;
}
if (_local1.length < 2) {
_local1 = "0" + _local1;
}
return((_local2 + ":") + _local1);
}
static function UNTAG_STRING(content) {
var _local2 = content.split("<");
content = _local2[0];
var _local1 = 1;
while (_local1 < _local2.length) {
content = content + ("<" + _local2[_local1]);
_local1++;
}
return(content);
}
static function checkClipSource(clip) {
return(clip._url.indexOf("tinymantis.com/") > 6);
}
}
Symbol 1000 MovieClip [__Packages.Actor] Frame 0
class Actor extends tinymantis.GameObject
{
var mSprite, mStateParam, gotoState, mSpinKick, mKFM, isInState, mHp, mHpMax;
function Actor (root, lib) {
super("Actor");
mSprite = root.attachMovie(lib, "p" + (sIndex++), root.getNextHighestDepth());
mStateParam = new Object();
gotoState("init");
mSpinKick = false;
mKFM = false;
}
function get sprite() {
return(mSprite);
}
function init_update() {
reborn();
}
function be_hit_air(actor, damage, two_side) {
if (mSprite._y >= 0) {
return(false);
}
if (isInState("airdown")) {
return(false);
}
var _local3 = false;
var _local4 = 140;
if (two_side) {
if (Math.abs(sprite._x - actor.__get__sprite()._x) < _local4) {
_local3 = true;
}
} else if (actor.__get__sprite()._xscale > 0) {
_local3 = (sprite._x > actor.__get__sprite()._x) && (sprite._x < (actor.__get__sprite()._x + _local4));
} else {
_local3 = (sprite._x < actor.__get__sprite()._x) && (sprite._x > (actor.__get__sprite()._x - _local4));
}
if (_local3 && (Math.abs(sprite._y - actor.__get__sprite()._y) < 100)) {
trace("be hit air");
mHp = mHp - damage;
if (mHp < 0) {
mHp = 0;
}
mStateParam.airdown_dx = ((actor.__get__sprite()._xscale > 0) ? 1 : -1) * 20;
gotoState("airdown");
hit_sound(actor);
return(true);
}
return(false);
}
function be_hit(actor, pos, damage, distance) {
if (isInState("hit") || (isInState("ko"))) {
return(false);
}
if (mSprite._y < 0) {
return(false);
}
if (isInState("duck")) {
if (pos == 2) {
return(false);
}
}
var _local4 = false;
if (actor.__get__sprite()._xscale > 0) {
_local4 = (sprite._x > actor.__get__sprite()._x) && (sprite._x < (actor.__get__sprite()._x + distance));
} else {
_local4 = (sprite._x < actor.__get__sprite()._x) && (sprite._x > (actor.__get__sprite()._x - distance));
}
if (_local4) {
var _local3 = "low";
switch (pos) {
case 1 :
_local3 = "mid";
break;
case 2 :
_local3 = "high";
}
if ((isInState("block") || (isInState("block_impact"))) && (mSprite._xscale != actor.__get__sprite()._xscale)) {
gotoState("block_impact");
} else {
mHp = mHp - damage;
if (mHp > 0) {
mStateParam.hit_kick = distance > 150;
mStateParam.hit_frame = "hit_" + _local3;
mSprite._xscale = -actor.__get__sprite()._xscale;
gotoState("hit");
} else {
mHp = 0;
mStateParam.ko_frame = "ko_backward";
if (mSprite._xscale == actor.__get__sprite()._xscale) {
mSprite._xscale = mSprite._xscale * -1;
mStateParam.ko_frame = "ko_forward";
}
gotoState("ko");
}
hit_sound(actor);
return(true);
}
}
return(false);
}
function hit_sound(attacker) {
if (mKFM) {
if (attacker.isInState("punch")) {
SoundLib.singleton.playSound("hit_mid_k", 100, 1, this);
} else {
SoundLib.singleton.playSound("hit_high_k", 100, 1, this);
}
} else {
SoundLib.singleton.playSound("hit", 100, 1, this);
}
}
function punch_target(pos) {
return(false);
}
function kick_target(pos) {
return(false);
}
function spinkick_target() {
return(false);
}
function flykick_target() {
return(false);
}
function hit_enter() {
mSprite.gotoAndStop(mStateParam.hit_frame);
}
function hit_update() {
var _local2 = mSprite.body;
if (_local2._currentframe == _local2._totalframes) {
gotoState("idle");
}
}
function ko_enter() {
mSprite.gotoAndStop(mStateParam.ko_frame);
mStateParam.ko_timer = 0;
SoundLib.singleton.playSound("ko" + (mKFM ? "_k" : ""), 100, 1, this);
}
function ko_update() {
mStateParam.ko_timer++;
var _local2 = mSprite.body;
if (_local2._currentframe == _local2._totalframes) {
die();
}
}
function block_impact_enter() {
mSprite.gotoAndStop("block_impact");
mStateParam.block_dx = ((mSprite._xscale > 0) ? -1 : 1) * 6;
SoundLib.singleton.playSound("block" + (mKFM ? "_k" : ""), 100, 1, this);
}
function block_impact_update() {
if (Math.abs(mStateParam.block_dx) > 2) {
mSprite._x = mSprite._x + mStateParam.block_dx;
}
mStateParam.block_dx = mStateParam.block_dx * 0.2;
var _local2 = mSprite.body;
if (_local2._currentframe == _local2._totalframes) {
gotoState("idle");
}
}
function die() {
}
function reborn() {
gotoState("idle");
mSprite._visible = true;
mSprite._y = 0;
mHp = mHpMax;
}
function block_enter() {
mSprite.gotoAndStop("block");
mStateParam.block_dx = 0;
}
function update() {
super.update();
if (mSprite._x > Game.singleton.mStageMaxX) {
mSprite._x = Game.singleton.mStageMaxX;
} else if (mSprite._x < Game.singleton.mStageMinX) {
mSprite._x = Game.singleton.mStageMinX;
}
}
function jump(dx) {
mStateParam.jump_xspeed = dx;
gotoState("jump");
}
function run(dx) {
mStateParam.run_dx = dx;
}
function walk(destx) {
mStateParam.walk_destx = destx;
gotoState("walk");
}
function idle_enter() {
mStateParam.run_dx = 0;
mSprite.gotoAndStop("idle");
}
function idle_update() {
if (mStateParam.run_dx != 0) {
gotoState("run");
}
}
function run_enter() {
SoundLib.singleton.playSound("run" + (mKFM ? "_k" : ""), 100, 10000, this);
mSprite.gotoAndStop("run");
mStateParam.run_speedx = mStateParam.run_dx * 0.9;
}
function run_update() {
if ((mStateParam.run_dx * mStateParam.run_speedx) > 0) {
mStateParam.run_speedx = mStateParam.run_speedx + ((mStateParam.run_dx - mStateParam.run_speedx) * 0.1);
mSprite._x = mSprite._x + mStateParam.run_speedx;
mSprite._xscale = ((mStateParam.run_dx > 0) ? 100 : -100);
} else {
gotoState("idle");
}
}
function run_exit() {
SoundLib.singleton.stopSound("run" + (mKFM ? "_k" : ""), this);
}
function walk_enter() {
mSprite.gotoAndStop("walk");
mStateParam.walk_speed = 4;
mStateParam.walk_dx = ((mStateParam.walk_destx > mSprite._x) ? 1 : -1) * mStateParam.walk_speed;
mSprite._xscale = ((mStateParam.walk_dx > 0) ? 100 : -100);
}
function walk_update() {
var _local2 = Math.abs(mStateParam.walk_destx - mSprite._x);
if (_local2 <= mStateParam.walk_speed) {
mStateParam.walk_dx = 0;
gotoState("idle");
}
mSprite._x = mSprite._x + mStateParam.walk_dx;
}
function jump_enter() {
if (mStateParam.jump_xspeed == 0) {
mSprite.gotoAndStop("jump_up");
} else {
mSprite._xscale = ((mStateParam.jump_xspeed > 0) ? 100 : -100);
mSprite.gotoAndStop("jump_forward");
}
mStateParam.jump_prepare = 3;
mStateParam.jump_yspeed = -50;
mStateParam.jump_gravity = 5;
SoundLib.singleton.playSound("jump", 100, 1, this);
}
function jump_update() {
if (mStateParam.jump_prepare > 0) {
mStateParam.jump_prepare--;
} else {
if (mSprite._y <= 0) {
mSprite._x = mSprite._x + mStateParam.jump_xspeed;
mSprite._y = mSprite._y + mStateParam.jump_yspeed;
mStateParam.jump_yspeed = mStateParam.jump_yspeed + mStateParam.jump_gravity;
}
if (mSprite._y >= 0) {
mStateParam.jump_xspeed = 0;
mSprite._y = 0;
} else {
var _local2 = mSprite.body;
}
if (_local2._currentframe == _local2._totalframes) {
gotoState("idle");
} else if (mSpinKick) {
gotoState("spinkick");
}
}
}
function jump_exit() {
mSpinKick = false;
}
function duck_enter() {
mSprite.gotoAndStop("duck");
SoundLib.singleton.playSound("duck" + (mKFM ? "_k" : ""), 100, 1, this);
}
function duck_update() {
}
function punch(pos) {
mStateParam.punch_pos = pos;
gotoState("punch");
SoundLib.singleton.playSound("punch" + (mKFM ? "_k" : ""), 100, 1, this);
}
function punch_enter() {
switch (mStateParam.punch_pos) {
case 0 :
mSprite.gotoAndStop("punch_low");
break;
case 2 :
mSprite.gotoAndStop("punch_high");
break;
default :
mSprite.gotoAndStop("punch_mid");
}
mSprite.body.damage = 0;
}
function punch_update() {
var _local2 = mSprite.body;
if (_local2._currentframe == _local2._totalframes) {
gotoState("idle");
}
if (_local2.damage) {
punch_target(mStateParam.punch_pos);
}
}
function kick(pos) {
mStateParam.kick_pos = pos;
gotoState("kick");
SoundLib.singleton.playSound("kick" + (mKFM ? "_k" : ""), 100, 1, this);
}
function kick_enter() {
switch (mStateParam.kick_pos) {
case 0 :
mSprite.gotoAndStop("kick_low");
break;
case 2 :
mSprite.gotoAndStop("kick_high");
break;
default :
mSprite.gotoAndStop("kick_mid");
}
mSprite.body.damage = 0;
}
function kick_update() {
var _local2 = mSprite.body;
if (_local2._currentframe == _local2._totalframes) {
gotoState("idle");
}
if (_local2.damage) {
kick_target(mStateParam.kick_pos);
}
}
function flykick() {
mStateParam.jump_xspeed = ((mSprite._xscale > 0) ? 1 : -1) * 20;
gotoState("flykick");
}
function flykick_enter() {
if (mSprite._y < 0) {
mStateParam.jump_prepare = 0;
} else {
mStateParam.jump_prepare = 5;
mStateParam.jump_yspeed = -40;
}
mStateParam.jump_gravity = 5;
mSprite.gotoAndStop("fly_kick");
mSprite.body.damage = 0;
}
function flykick_update() {
if (mStateParam.jump_prepare > 0) {
mStateParam.jump_prepare--;
} else {
var _local2 = mSprite.body;
if (mSprite._y <= 0) {
mSprite._x = mSprite._x + mStateParam.jump_xspeed;
mSprite._y = mSprite._y + mStateParam.jump_yspeed;
mStateParam.jump_yspeed = mStateParam.jump_yspeed + mStateParam.jump_gravity;
if (mSprite._y >= 0) {
if (_local2.damage > 0) {
mSprite.gotoAndStop("fly_kick");
mSprite.body.gotoAndPlay("land");
} else {
_local2.damage = 0;
}
mStateParam.jump_xspeed = 0;
mSprite._y = 0;
_local2.damage = 0;
}
}
if (_local2.damage) {
flykick_target();
}
if (_local2._currentframe == _local2._totalframes) {
gotoState("idle");
}
}
}
function spinkick_enter() {
mSprite.gotoAndStop("spin_kick");
mSprite.body.damage = 0;
}
function spinkick_update() {
if (mSprite.body.damage) {
spinkick_target();
}
if (mSprite._y < 0) {
mSprite._y = mSprite._y + mStateParam.jump_yspeed;
mStateParam.jump_yspeed = mStateParam.jump_yspeed + mStateParam.jump_gravity;
if (mSprite._y >= 0) {
mSprite._y = 0;
}
} else {
gotoState("idle");
}
}
function airdown_enter() {
mSprite.gotoAndStop("airdown");
mSprite._xscale = ((mStateParam.airdown_dx > 0) ? -100 : 100);
mStateParam.jump_yspeed = -20;
mStateParam.jump_gravity = 5;
mSprite.body.landed = false;
}
function airdown_update() {
if (mSprite._y < 0) {
mSprite._x = mSprite._x + mStateParam.airdown_dx;
mSprite._y = mSprite._y + mStateParam.jump_yspeed;
mStateParam.jump_yspeed = mStateParam.jump_yspeed + mStateParam.jump_gravity;
} else {
var _local2 = mSprite.body;
if (!_local2.landed) {
mSprite._x = mSprite._x + (mStateParam.airdown_dx * 0.5);
}
mSprite._y = 0;
if (_local2._currentframe == _local2._totalframes) {
if (mHp > 0) {
gotoState("idle");
} else {
mStateParam.ko_frame = "ko_backward";
gotoState("ko");
}
}
}
}
static function initStateMachine() {
tinymantis.GameObject.buildStateGroup("Actor", new Array("init", "wait", "idle", "block_impact", "walk", "run", "spinkick", "airdown", "jump", "duck", "punch", "kick", "flykick", "hit", "ko", "block", "gotodoor", "enterdoor", "disappear"), 0);
}
static var sIndex = 0;
}
Symbol 1001 MovieClip [__Packages.SoundLib] Frame 0
class SoundLib
{
static var singleton;
var mRootClip, mRootController;
function SoundLib (root) {
singleton = this;
mRootClip = root.createEmptyMovieClip("sounds_root", root.getNextHighestDepth());
mRootController = new Sound(_root);
addSound("jump");
addSound("jump_ninja");
addSound("punch");
addSound("punch_k");
addSound("kick");
addSound("kick_k");
addSound("ko_k");
addSound("ko");
addSound("run_k");
addSound("run");
addSound("duck_k");
addSound("hit_high_k");
addSound("hit_mid_k");
addSound("block");
addSound("block_k");
addSound("introgrunt");
addSound("music0");
addSound("music1");
addSound("music2");
addSound("music3");
addSound("music4");
addSound("snd_mouseover");
addSound("snd_mouseclick");
addSound("snd_mouseclick1");
}
function addSound(lib) {
var _local3 = mRootClip.createEmptyMovieClip("snd" + lib, mRootClip.getNextHighestDepth());
var _local4 = new Sound(_local3);
_local4.attachSound(lib);
var _local2 = new Object();
_local2.clip = _local3;
_local2.sound = _local4;
mSounds[lib] = _local2;
}
function playSound(lib, vol, loop, actor) {
var _local3 = mSounds[lib];
var _local2 = _local3.sound;
if (_local3 && (_local2)) {
_local2.setVolume(vol);
_local2.start(0, loop);
_local3.actor = actor;
return(_local2);
}
return(null);
}
function stopSound(lib, actor) {
var _local2 = mSounds[lib];
var _local3 = _local2.sound;
if (_local2 && (_local3)) {
if ((actor == null) || (_local2.actor == actor)) {
_local3.stop();
}
}
}
function set mute(mute) {
if (mute) {
mRootController.setVolume(0);
} else {
mRootController.setVolume(100);
}
//return(this.mute);
}
function get mute() {
return(mRootController.getVolume() == 0);
}
var mSounds = new Object();
}
Symbol 1002 MovieClip [__Packages.MainChar] Frame 0
class MainChar extends Actor
{
var mHpMax, mTotalAttacks, mHitAttacks, mKFM, mSprite, jump, punch, kick, gotoState, run, mStateParam, update, flykick;
function MainChar (root) {
super(root, "lib_player");
mHpMax = 200;
mTotalAttacks = 0;
mHitAttacks = 0;
mKFM = true;
}
function startAttack() {
mAttackStart = true;
mTotalAttacks++;
}
function addAttack() {
if (mAttackStart) {
mAttackStart = false;
mHitAttacks++;
}
}
function getNumberAttacks() {
return(mTotalAttacks);
}
function getNumberHits() {
return(Math.min(mTotalAttacks, mHitAttacks));
}
function punch_target(pos) {
var _local4 = Game.singleton.__get__enemies();
_local4.sortOn("dx", Array.NUMERIC);
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
if (_local3.be_hit(this, pos, 10, 150)) {
addAttack();
return(true);
}
_local2++;
}
return(false);
}
function kick_target(pos) {
var _local4 = Game.singleton.__get__enemies();
_local4.sortOn("dx", Array.NUMERIC);
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
if (_local3.be_hit(this, pos, 10, 210)) {
addAttack();
return(true);
}
_local2++;
}
return(false);
}
function spinkick_target() {
var _local5 = Game.singleton.__get__enemies();
_local5.sortOn("dx", Array.NUMERIC);
var _local3 = 0;
while (_local3 < _local5.length) {
var _local2 = _local5[_local3];
var _local4 = _local2.__get__sprite()._y - mSprite._y;
if (Math.abs(_local4) < 100) {
if (_local2.be_hit_air(this, 10, false) || (_local2.be_hit(this, 2, 10, 150))) {
addAttack();
return(true);
}
}
_local3++;
}
return(false);
}
function flykick_target() {
var _local5 = Game.singleton.__get__enemies();
_local5.sortOn("dx", Array.NUMERIC);
var _local3 = 0;
while (_local3 < _local5.length) {
var _local2 = _local5[_local3];
var _local4 = _local2.__get__sprite()._y - mSprite._y;
if (Math.abs(_local4) < 100) {
if (_local2.be_hit_air(this, 10, false) || (_local2.be_hit(this, 2, 10, 200))) {
addAttack();
return(true);
}
}
_local3++;
}
return(false);
}
function reborn() {
super.reborn();
mSprite._x = 0;
}
function normal_control() {
if (Key.isDown(38)) {
if (Key.isDown(37)) {
jump(-14);
} else if (Key.isDown(39)) {
jump(14);
} else {
jump(0);
}
} else if (Key.isDown(90)) {
punch(0);
} else if (Key.isDown(65)) {
punch(1);
} else if (Key.isDown(81)) {
punch(2);
} else if (Key.isDown(88)) {
kick(0);
} else if (Key.isDown(83)) {
kick(1);
} else if (Key.isDown(87)) {
kick(2);
} else {
if (Key.isDown(40)) {
gotoState("duck");
} else if (Key.isDown(39)) {
run(20);
} else if (Key.isDown(37)) {
run(-20);
} else {
run(0);
}
return(true);
}
return(false);
}
function block_impact_update() {
if (Math.abs(mStateParam.block_dx) > 2) {
mSprite._x = mSprite._x + mStateParam.block_dx;
}
mStateParam.block_dx = mStateParam.block_dx * 0.3;
var _local2 = mSprite.body;
if (_local2._currentframe == _local2._totalframes) {
if (Key.isDown(32)) {
mStateParam.block_direct = 1;
gotoState("block");
} else {
gotoState("idle");
}
}
}
function idle_enter() {
super.idle_enter();
mAttackStart = false;
}
function idle_update() {
if (Game.singleton.isInState("run")) {
normal_control();
}
super.idle_update();
if (Key.isDown(32)) {
gotoState("block");
update();
}
}
function run_update() {
if (normal_control()) {
super.run_update();
}
}
function duck_update() {
if (Key.isDown(40)) {
super.duck_update();
} else {
gotoState("idle");
}
}
function face_key() {
if (Key.isDown(37)) {
mSprite._xscale = -100;
} else if (Key.isDown(39)) {
mSprite._xscale = 100;
}
}
function punch_enter() {
startAttack();
face_key();
super.punch_enter();
}
function kick_enter() {
startAttack();
face_key();
if (Key.isDown(38)) {
flykick();
trace("flykick from kick");
} else {
super.kick_enter();
}
}
function jump_enter() {
face_key();
mStateParam.jump_sound = "jump";
super.jump_enter();
}
function block_enter() {
super.block_enter();
if (mStateParam.block_direct) {
mSprite.body.gotoAndPlay(8);
mStateParam.block_direct = 0;
}
}
function block_update() {
if (!Key.isDown(32)) {
gotoState("idle");
}
}
function flykick_enter() {
startAttack();
super.flykick_enter();
}
function spinkick_enter() {
startAttack();
super.spinkick_enter();
}
function ko_update() {
mStateParam.ko_timer++;
if (mStateParam.ko_timer == 30) {
Game.singleton.gotoState("over");
}
}
function gotodoor_enter() {
mStateParam.targetx = 750;
SoundLib.singleton.playSound("run_k", 100, 10000, this);
mSprite.gotoAndStop("run");
}
function gotodoor_update() {
var _local2 = mStateParam.targetx - mSprite._x;
var _local4 = Math.min(15, Math.abs(_local2));
var _local3 = Math.abs(_local2);
if (_local3 < 300) {
if (Game.singleton.getDoorClip()._currentframe == 1) {
Game.singleton.getDoorClip().gotoAndPlay(2);
}
}
if (_local3 > 1) {
mSprite._x = mSprite._x + (_local4 * ((_local2 > 0) ? 1 : -1));
mSprite._xscale = ((_local2 > 0) ? 100 : -100);
} else {
gotoState("enterdoor");
}
}
function gotodoor_exit() {
SoundLib.singleton.stopSound("run" + (mKFM ? "_k" : ""), this);
}
function enterdoor_enter() {
mSprite._xscale = 100;
mStateParam.timer = 0;
mSprite.gotoAndStop("idle");
}
function enterdoor_update() {
var _local2 = 10;
mStateParam.timer++;
if (mStateParam.timer == _local2) {
mSprite.gotoAndStop("enterdoor");
} else if ((mStateParam.timer > _local2) && (mSprite.body._currentframe == mSprite.body._totalframes)) {
gotoState("disappear");
}
}
var mAttackStart = false;
}
Symbol 1003 MovieClip [__Packages.GameCamera] Frame 0
class GameCamera
{
function GameCamera () {
}
function update(focus) {
mX = focus.__get__sprite()._x - (Stage.width / 2);
if (mX < (-Game.singleton.mStageRangeX)) {
mX = -Game.singleton.mStageRangeX;
} else if (mX > (Game.singleton.mStageRangeX - Stage.width)) {
mX = Game.singleton.mStageRangeX - Stage.width;
}
mY = focus.__get__sprite()._y;
}
function get x() {
return(mX);
}
function get y() {
return(mY);
}
var mX = 0;
var mY = 0;
}
Symbol 1004 MovieClip [__Packages.InGameMenu] Frame 0
class InGameMenu
{
var mSprite, mTimer;
function InGameMenu (root) {
mSprite = root.attachMovie("lib_ingame_ui", "ui", root.getNextHighestDepth());
mSprite._x = 10;
mSprite._y = 283;
mSprite.mLevel = Game.singleton.mLevel;
mTimer = 0;
}
function update() {
var _local3 = Game.singleton.__get__player().mHp / Game.singleton.__get__player().mHpMax;
var _local2 = _local3 * 100;
mSprite.mHpbar._xscale = mSprite.mHpbar._xscale + ((_local2 - mSprite.mHpbar._xscale) * 0.5);
updateEnemies();
if (Game.singleton.isInState("run")) {
updateTimer();
}
}
function updateTimer() {
mTimer++;
mSprite.mTime = tinymantis.Utils.convertTimeToString(mTimer, 24);
}
function updateEnemies() {
mSprite.mEnemies = "" + Game.singleton.getNumEnemies();
}
}
Symbol 1005 MovieClip [__Packages.Layer] Frame 0
class Layer
{
var mSprite, mMoveRangeX, mMoveRangeY;
function Layer (root, lib, rangeX, rangeY) {
mSprite = root.attachMovie(lib, "layer" + (sIndex++), root.getNextHighestDepth());
mSprite._y = 300;
mMoveRangeX = rangeX;
mMoveRangeY = rangeY;
}
function setCameraShiftPercent(percentx, percenty) {
mSprite._x = mMoveRangeX * percentx;
mSprite._y = 290 + (mMoveRangeY * percenty);
}
function get sprite() {
return(mSprite);
}
static var sIndex = 0;
}
Symbol 1006 MovieClip [__Packages.Enemy] Frame 0
class Enemy extends Actor
{
var mHpMax, mOnStage, mSprite, mHp, gotoState, mStateParam, punch, run, walk;
function Enemy (root) {
super(root, "lib_enemy");
mHpMax = (Game.singleton.mLevel + 2) * 10;
mOnStage = false;
mSprite._visible = false;
trace(mHpMax);
}
function reborn() {
super.reborn();
mSprite._visible = false;
mHp = mHpMax;
gotoState("wait");
}
function wait_exit() {
var _local2 = 500 + (Math.random() * 300);
mSprite._x = ((Game.singleton.__get__player().mSprite._x > 0) ? (-_local2) : (_local2));
mSprite._visible = true;
gotoState("idle");
SoundLib.singleton.playSound("introgrunt", 100, 1, this);
}
function be_hit(actor, pos, damage, distance) {
if (mOnStage) {
return(super.be_hit(actor, pos, damage, distance));
}
return(false);
}
function be_hit_air(actor, damage, two_side) {
if (mOnStage) {
return(super.be_hit_air(actor, damage, two_side));
}
return(false);
}
function punch_target(pos) {
return(Game.singleton.__get__player().be_hit(this, pos, 5, 250));
}
function kick_target(pos) {
return(Game.singleton.__get__player().be_hit(this, pos, 5, 250));
}
function spinkick_target() {
return(Game.singleton.__get__player().be_hit_air(this, 10, false) || (Game.singleton.__get__player().be_hit(this, 2, 10, 120)));
}
function flykick_target() {
return(Game.singleton.__get__player().be_hit_air(this, 10, false) || (Game.singleton.__get__player().be_hit(this, 2, 10, 120)));
}
function get dx() {
return(Math.abs(Game.singleton.__get__player().__get__sprite()._x - mSprite._x));
}
function init_update() {
super.init_update();
mSprite._x = (500 + (Math.random() * 300)) * ((Math.random() < 0.5) ? 1 : -1);
trace(mHp);
}
function block(d) {
gotoState("block");
mBlocked = true;
mStateParam.block_timer = 0;
}
function block_update() {
var _local2 = mSprite.body;
if (_local2._currentframe == _local2._totalframes) {
_local2.stop();
mStateParam.block_timer++;
}
if (mStateParam.block_timer > 30) {
gotoState("idle");
}
}
function idle_update() {
super.idle_update();
var _local4 = Game.singleton.__get__player();
if (_local4.mHp > 0) {
var _local3 = _local4.__get__sprite()._x - mSprite._x;
if (Math.abs(_local3) < 250) {
var _local5 = Math.floor(Math.random() * 30);
switch (_local5) {
case 0 :
case 1 :
mSprite._xscale = ((_local3 > 0) ? 100 : -100);
punch(Math.floor(Math.random() * 2) + 1);
break;
case 2 :
case 3 :
mSprite._xscale = ((_local3 > 0) ? 100 : -100);
punch(Math.floor(Math.random() * 2) + 1);
break;
case 4 :
case 5 :
mSprite._xscale = ((_local3 > 0) ? 100 : -100);
punch(Math.floor(Math.random() * 2) + 1);
break;
case 6 :
if (mBlocked) {
mSprite._xscale = ((_local3 > 0) ? 100 : -100);
punch(Math.floor(Math.random() * 2) + 1);
} else {
block();
}
}
} else if (Math.abs(_local3) < 700) {
if (Math.random() < 0.1) {
block();
} else if (_local3 > 0) {
run(10);
} else {
run(-10);
}
} else {
walk((Math.random() * 1600) - 800);
}
}
}
function idle_exit() {
mBlocked = false;
}
function flykick() {
var _local3 = Game.singleton.__get__player().__get__sprite()._x - mSprite._x;
mSprite._xscale = ((_local3 > 0) ? 100 : -100);
super.flykick();
}
function run_update() {
var _local4 = Game.singleton.__get__player();
var _local3 = _local4.__get__sprite()._x - mSprite._x;
if (Math.abs(_local3) < 250) {
run(0);
}
super.run_update();
}
function walk_enter() {
mStateParam.walk_timer = 30;
super.walk_enter();
}
function walk_update() {
super.walk_update();
var _local4 = Game.singleton.__get__player();
var _local3 = _local4.__get__sprite()._x - mSprite._x;
mStateParam.walk_timer--;
if ((Math.abs(_local3) < 400) && (mStateParam.walk_timer < 0)) {
gotoState("idle");
}
}
function die() {
mSprite._visible = false;
mSprite.removeMovieClip();
Game.singleton.removeEnemy(this);
}
function jump_enter() {
mStateParam.jump_sound = "jump_ninja";
super.jump_enter();
}
function hit_enter() {
mStateParam.hit_dx = ((mSprite._xscale > 0) ? -1 : 1);
if (mStateParam.hit_kick) {
mStateParam.hit_dx = mStateParam.hit_dx * 50;
mStateParam.hit_idle = 3;
} else {
mStateParam.hit_dx = mStateParam.hit_dx * 30;
mStateParam.hit_idle = 3;
}
super.hit_enter();
}
function hit_update() {
super.hit_update();
if ((--mStateParam.hit_idle) < 0) {
mSprite._x = mSprite._x + mStateParam.hit_dx;
mStateParam.hit_dx = mStateParam.hit_dx * 0.5;
}
}
function ko_enter() {
if (mStateParam.ko_frame == "ko_backward") {
mStateParam.ko_frame = "ko_backward" + Math.floor(Math.random() * 3);
}
super.ko_enter();
}
var mBlocked = false;
}
Symbol 1007 MovieClip [__Packages.tinymantis.Delegate] Frame 0
class tinymantis.Delegate
{
function Delegate () {
}
static function create(target, handler) {
var extraArgs = arguments.slice(2);
var delegate;
delegate = function () {
var _local2 = arguments.concat(extraArgs, [delegate]);
return(handler.apply(target, _local2));
};
return(delegate);
}
}
Symbol 28 Button
on (release) {
getURL ("http://kongfumonkey.com", "_top");
}
Instance of Symbol 23 MovieClip "mBar" in Symbol 29 MovieClip Frame 1
onClipEvent (load) {
this._yscale = 0;
}
onClipEvent (enterFrame) {
var total = _root.getBytesTotal();
if (total > 0) {
var percent = (_root.getBytesLoaded() / _root.getBytesTotal());
this._yscale = percent * 100;
if (percent == 1) {
_root.mMovieLoaded = true;
}
}
}
Symbol 108 MovieClip Frame 1
stop();
Symbol 108 MovieClip Frame 30
stop();
Symbol 140 MovieClip Frame 1
stop();
Symbol 325 MovieClip Frame 10
if (Key.isDown(32)) {
this.gotoAndPlay(this._currentframe - 1);
}
Symbol 370 MovieClip Frame 7
if (Key.isDown(40)) {
gotoAndPlay(this._currentframe - 1);
}
Symbol 439 MovieClip Frame 22
if (this._parent._y < 0) {
this.gotoAndPlay(this._currentframe - 1);
}
Symbol 467 MovieClip Frame 4
this.damage = 1;
Symbol 467 MovieClip Frame 7
this.damage = 0;
Symbol 557 MovieClip Frame 7
this.damage = 1;
Symbol 557 MovieClip Frame 9
this.damage = 0;
Symbol 607 MovieClip Frame 8
Symbol 660 MovieClip Frame 1
Symbol 660 MovieClip Frame 10
Symbol 720 MovieClip Frame 19
this.gotoAndStop(this._currentframe - 1);
Symbol 802 MovieClip Frame 45
stop();
Symbol 803 MovieClip [lib_player] Frame 1
stop();
Symbol 840 MovieClip Frame 15
this.damage = 1;
Symbol 840 MovieClip Frame 19
this.damage = 0;
Symbol 852 MovieClip Frame 11
this.damage = 1;
Symbol 852 MovieClip Frame 14
this.damage = 0;
Symbol 870 MovieClip Frame 11
stop();
Symbol 873 MovieClip Frame 10
stop();
Instance of Symbol 874 MovieClip in Symbol 878 MovieClip Frame 3
/* no clip actions */
Symbol 879 MovieClip [lib_enemy] Frame 1
stop();
Symbol 916 Button
on (release) {
_parent.play();
}
Symbol 924 Button
on (release) {
SoundLib.singleton.playSound("snd_mouseclick", 100, 1, null);
_root.rNextScreen = "Instructions";
_root.play();
}
on (rollOver) {
SoundLib.singleton.playSound("snd_mouseover", 100, 1, null);
}
Symbol 925 Button
on (release) {
SoundLib.singleton.playSound("snd_mouseclick1", 100, 1, null);
_root.play();
}
on (rollOver) {
SoundLib.singleton.playSound("snd_mouseover", 100, 1, null);
}
Symbol 926 MovieClip Frame 203
stop();
Symbol 926 MovieClip Frame 250
stop();
Symbol 950 MovieClip Frame 125
stop();
Instance of Symbol 20 MovieClip [lib_rect] in Symbol 953 MovieClip Frame 1
onClipEvent (load) {
this._alpha = 0;
}
on (press) {
_root.UnPauseGame();
}
Instance of Symbol 944 MovieClip in Symbol 953 MovieClip Frame 2
onClipEvent (load) {
this.mButtonFight._visible = false;
}
Symbol 964 Button
on (release) {
_root.mDelay = false;
}
Symbol 972 MovieClip Frame 90
stop();
Symbol 982 Button
on (rollOver) {
SoundLib.singleton.playSound("snd_mouseover", 100, 1, null);
}
on (release) {
SoundLib.singleton.playSound("snd_mouseclick", 100, 1, null);
_root.play();
}
Symbol 984 Button
on (release) {
getURL ("http://kongfumonkey.com", "_top", "GET");
}
Symbol 988 Button
on (release) {
getURL ("http://kongfumonkey.com", "_top", "GET");
}
Symbol 991 Button
on (release) {
getURL ("http://tinymantis.com", "_top", "GET");
}
Instance of Symbol 976 MovieClip in Symbol 993 MovieClip Frame 27
on (press) {
this._parent.play();
}
Symbol 993 MovieClip Frame 36
stop();
Instance of Symbol 980 MovieClip in Symbol 993 MovieClip Frame 76
on (release) {
getURL ("http://kongfumonkey.com/game_detail.php?game_index=150", "_top");
}
Symbol 993 MovieClip Frame 90
stop();