Frame 1
stop();
Instance of Symbol 13 MovieClip in Frame 1
onClipEvent (load) {
var nSpeed = 100;
var nCurrLoad = 0;
var nRealLoad = 0;
this.btnContinue._visible = false;
this.btnContinue.gotoAndStop("Idle");
this.btnContinue.onRollOver = function () {
this.gotoAndStop("Over");
};
this.btnContinue.onRollOut = function () {
this.gotoAndStop("Idle");
};
this.btnContinue.onPress = function () {
this.gotoAndStop("Down");
};
this.btnContinue.onMouseUp = function () {
this.gotoAndStop("Idle");
};
this.btnContinue.onRelease = function () {
new Main(_root);
};
}
onClipEvent (enterFrame) {
nRealLoad = (this._parent.getBytesLoaded() / this._parent.getBytesTotal()) * 100;
if (nRealLoad > (nCurrLoad + nSpeed)) {
nCurrLoad = nCurrLoad + nSpeed;
} else {
nCurrLoad = nRealLoad;
}
txtPourcentage.text = nCurrLoad + "%";
if ((nCurrLoad == 100) && (this._parent.getBytesTotal() > 100)) {
this.mcLoading._visible = false;
this.btnContinue._visible = true;
}
}
Symbol 353 MovieClip [__Packages.State] Frame 0
class State
{
var mcRef, sState;
function State (_mcRef) {
mcRef = _mcRef;
}
function setState(_sState) {
sState = _sState;
mcRef.gotoAndStop(sState);
loadState(sState);
}
function setMc(_mcRef) {
mcRef = _mcRef;
setState(sState);
}
function pause() {
mcRef.mcState.stop();
}
function resume() {
mcRef.mcState.play();
}
function enterFrame() {
this["do" + sState]();
}
function loadState(_sState) {
this["start" + sState]();
}
function isStateComplete() {
if (mcRef.mcState._currentframe == mcRef.mcState._totalframes) {
this["end" + sState]();
}
return(mcRef.mcState._currentframe == mcRef.mcState._totalframes);
}
function get Mc() {
return(mcRef);
}
}
Symbol 354 MovieClip [__Packages.Main] Frame 0
class Main extends State
{
static var oCTRL, sHiddenString;
var nId, setState, oKeys, mcRef, oGame;
function Main (_mcRef) {
super(_mcRef);
nId = 0;
oCTRL = this;
sHiddenString = "";
setState(sSTATE_GAME);
oKeys = new Object();
oKeys.onKeyDown = library.Delegate.create(this, keyDown);
Key.addListener(oKeys);
mcRef.mcFrames._visible = false;
}
function loadState(_sState) {
switch (_sState) {
case sSTATE_TITLE :
mcRef.btnPlay.onRelease = library.Delegate.create(this, setState, sSTATE_GAME);
break;
case sSTATE_GAME :
oGame = new Game(mcRef.mcState);
oGame.startLevel(Game.sDEFAULT_MAP, Game.sDEFAULT_POS);
break;
}
}
function keyDown() {
if (Key.isDown(46)) {
sHiddenString = "";
} else {
sHiddenString = sHiddenString + chr(Key.getAscii());
}
switch (sHiddenString) {
case "who" :
mcRef.txtMain.text = sOWNER;
break;
case "date" :
mcRef.txtMain.text = sDATE;
break;
case "frames" :
mcRef.mcFrames._visible = !mcRef.mcFrames._visible;
}
}
function get getNextId() {
nId++;
return(nId);
}
static function get Instance() {
return(oCTRL);
}
function get game() {
return(oGame);
}
static var bDEBUG = false;
static var sDATE = "20100814";
static var sOWNER = "YiffyHusky";
static var b2D_PLATFORMER = false;
static var NX_SIZE = 800;
static var NY_SIZE = 600;
static var sSTATE_TITLE = "Title";
static var sSTATE_GAME = "Game";
}
Symbol 355 MovieClip [__Packages.Game] Frame 0
class Game
{
var mcRef, aTriggers, aTriggerSequence, oTransition, oPause, oPlayer, oLevel, oShop, oHud, oDeath, oDialog, bPause, bIsCutscene;
function Game (_mcRef) {
mcRef = _mcRef;
sDEFAULT_MAP = dat.LevelData.STRING_LOCATION_OFFICE1;
init();
mcRef.onEnterFrame = library.Delegate.create(this, enterFrame);
aTriggers.push(dat.TriggerData.sGAME_START);
aTriggerSequence = dat.TriggerData.getTrigger(dat.TriggerData.sGAME_START);
nextTrigger();
}
function enterFrame() {
oTransition.enterFrame();
if (!oPause.__get__paused()) {
oPlayer.enterFrame();
oLevel.enterFrame(oPlayer.canChangeMap());
oShop.enterFrame();
oHud.enterFrame();
}
checkCutscene();
oPause.enterFrame();
oDeath.enterFrame();
oDialog.enterFrame();
}
function setPause(_bPause) {
if (_bPause) {
oPause.start(oPlayer.__get__playerData());
}
}
function startGame() {
oPause.__set__paused(false);
}
function tryHit(_oPoint, _scale, _nOrigin, _nDamage, _nRecoil, _bKnockout, _bBliss) {
var _local2;
_local2 = oPlayer.tryHit(_oPoint, _scale, _nOrigin, _nDamage, _nRecoil, _bKnockout, _bBliss);
if (_local2 != undefined) {
oHud.setPlayer(_local2.health, _local2.maxhealth, oPlayer.__get__characterLinkage());
} else {
_local2 = oLevel.tryHit(_oPoint, _scale, _nOrigin, _nDamage, _nRecoil, _bKnockout, _bBliss);
if (_local2 != undefined) {
oHud.showEnnemy(true);
oHud.setEnnemy(_local2.health, _local2.maxhealth, _local2.face, _local2.name);
}
}
return(_local2);
}
function init() {
oPlayer = new game.Player();
oTransition = new library.Popup(mcRef.mcGameTransition);
oHud = new game.Hud(mcRef.mcHud);
oHud.setPlayer(oPlayer.__get__health(), oPlayer.__get__maxhealth(), oPlayer.__get__characterLinkage());
oHud.showEnnemy(false);
oHud.setHunger(oPlayer.addHunger(0));
oDialog = new game.DialogManager(mcRef.mcDialog);
oPause = new Pause(mcRef.mcPause);
oDeath = new Death(mcRef.mcDeath);
oShop = new game.Shop(mcRef.mcShop);
aTriggers = new Array();
bPause = false;
bIsCutscene = false;
mcRef.gotoAndStop(library.Popup.sSTATE_HIDDEN);
}
function setDeath() {
oDeath.__set__respawnLevel(oLevel.respawnLevel);
oDeath.__set__respawnPos(oLevel.respawnPos);
oDeath.setState(library.Popup.sSTATE_IN);
}
function startLevel(_sMap, _sPos) {
var _local2 = mcRef.mcLevel.getDepth();
mcRef.mcLevel.swapDepth(mcRef.getNextHighestDepth());
mcRef.mcLevel.removeMovieClip();
mcRef.createEmptyMovieClip("mcLevel", _local2);
oLevel = new game.Level(mcRef.mcLevel);
setLevel(_sMap, _sPos);
}
function changeLevel(_sLevel, _sPos) {
oPlayer.__set__changingLevels(true);
oPlayer.setState(game.Player.sSTATE_CHANGE_LEVEL);
oTransition.__set__midFunction(library.Delegate.create(this, setLevel, _sLevel, _sPos));
oTransition.__set__outFunction(library.Delegate.create(this, endChangeLevel));
oTransition.startTransition();
}
function chargeShop(_sShop, _sPos) {
oPlayer.__set__changingLevels(true);
oPlayer.setState(game.Player.sSTATE_CHANGE_LEVEL);
oTransition.__set__midFunction(library.Delegate.create(this, setShop, _sShop, _sPos));
oTransition.__set__outFunction(library.Delegate.create(this, endChargeShop));
oTransition.startTransition();
}
function leaveShop(_sShop) {
oTransition.__set__midFunction(library.Delegate.create(this, unsetShop, _sShop));
oTransition.__set__outFunction(library.Delegate.create(this, endChangeLevel));
oTransition.startTransition();
}
function endChargeShop() {
}
function setLevel(_sLevel, _sPos) {
var _local2 = dat.LevelData.getData(_sLevel);
oLevel.setLevel(_sLevel, _local2);
oHud.__set__location(_local2.name);
oPlayer.setCharacter(oLevel.__get__Mc().mcSprites);
oPlayer.setState(game.character.Character.sSTATE_IDLE);
oLevel.__set__player(oPlayer.Mc);
oLevel.setPlayerPos(_sPos);
oTransition.setState(library.Popup.sSTATE_OUT);
}
function endChangeLevel() {
var _local2 = oLevel.__get__startTrigger();
if (!triggerExecuted(_local2)) {
aTriggers.push(_local2);
aTriggerSequence = dat.TriggerData.getTrigger(_local2);
nextTrigger();
} else {
oLevel.__set__ChangingLevels(false);
oPlayer.setState(game.character.Character.sSTATE_IDLE);
oPlayer.__set__changingLevels(false);
}
}
function setShop(_sShop, _sPos) {
var _local2;
if (!triggerExecuted(dat.TriggerData.sFIRST_SHOP)) {
_local2 = dat.TriggerData.getTrigger(dat.TriggerData.sFIRST_SHOP);
aTriggers.push(dat.TriggerData.sFIRST_SHOP);
} else {
_local2 = dat.TriggerData.getTrigger(dat.TriggerData.sAFTER_FIRST_SHOP);
}
oShop.setShop(_sShop, _sPos, _local2, oPlayer.addHunger(0));
oHud.__set__location(dat.ShopData.getData(_sShop).name);
oLevel.unsetLevel();
oTransition.setState(library.Popup.sSTATE_OUT);
}
function unsetShop(_sShop) {
oShop.unsetShop();
setLevel(oLevel.__get__getLevel(), _sShop);
oTransition.setState(library.Popup.sSTATE_OUT);
}
function nextTrigger() {
if (aTriggerSequence.length > 0) {
var _local2 = aTriggerSequence.shift();
switch (_local2.nType) {
case dat.TriggerData.nTYPE_SET_DIALOG :
oDialog.setDialog(_local2.sCharacter1, _local2.sCharacter2);
break;
case dat.TriggerData.nTYPE_DIALOG :
oDialog.setText(_local2.sDialog, _local2.nTalk);
break;
case dat.TriggerData.nTYPE_ENTER_DIALOG_CHARACTER :
oDialog.enterCharacter(_local2.nChar, _local2.sCharacter);
break;
case dat.TriggerData.nTYPE_EXIT_DIALOG_CHARACTER :
oDialog.exitCharacter(_local2.nChar);
break;
case dat.TriggerData.nTYPE_END_DIALOG :
oDialog.endDialog();
break;
case dat.TriggerData.nTYPE_START_GAME :
startGame();
break;
case dat.TriggerData.nTYPE_SHOW_CUTSCENE :
bIsCutscene = true;
mcRef.mcCutscene.gotoAndStop(_local2.sCutscene);
}
} else {
endChangeLevel();
}
}
function checkCutscene() {
if (bIsCutscene) {
if (mcRef.mcCutscene.mcState._currentframe == mcRef.mcCutscene.mcState._totalframes) {
mcRef.mcCutscene.gotoAndStop(sDEFAULT_CUTSCENE);
bIsCutscene = false;
nextTrigger();
}
}
}
function triggerExecuted(_sTrigger) {
var _local3 = _sTrigger == undefined;
if (!_local3) {
var _local2;
_local2 = 0;
while (_local2 < aTriggers.length) {
if (aTriggers[_local2] == _sTrigger) {
_local3 = true;
}
_local2++;
}
}
return(_local3);
}
function addHunger(_nHunger, _nId) {
_nHunger = oPlayer.addHunger(_nHunger);
oHud.setHunger(_nHunger);
oLevel.addNextEnnemy(_nId);
}
function addBones(_nBones) {
_nBones = oPlayer.addBones(_nBones);
oHud.setBones(_nBones);
}
function buyItem(_oItem) {
oPlayer.buyItem(_oItem);
}
function get level() {
return(oLevel);
}
function get player() {
return(oPlayer);
}
static var sDEFAULT_CUTSCENE = "Hidden";
static var sDEFAULT_MAP = "";
static var sDEFAULT_POS = "Start";
}
Symbol 356 MovieClip [__Packages.library.Popup] Frame 0
class library.Popup extends State
{
var setState, fMidFunction, isStateComplete, fOutFunction, sState, __get__midFunction, __get__outFunction;
function Popup (_mcRef) {
super(_mcRef);
setState(sSTATE_HIDDEN);
}
function loadState(_sState) {
switch (_sState) {
case sSTATE_HIDDEN :
break;
case sSTATE_IN :
break;
case sSTATE_IDLE :
if (fMidFunction) {
fMidFunction();
fMidFunction = undefined;
}
break;
case sSTATE_OUT :
}
}
function doIn() {
if (isStateComplete()) {
setState(sSTATE_IDLE);
}
}
function doOut() {
if (isStateComplete()) {
if (fOutFunction) {
fOutFunction();
fOutFunction = undefined;
}
setState(sSTATE_HIDDEN);
}
}
function startTransition() {
if (sState == sSTATE_HIDDEN) {
setState(sSTATE_IN);
}
}
function set midFunction(_fMidFunction) {
fMidFunction = _fMidFunction;
//return(__get__midFunction());
}
function set outFunction(_fOutFunction) {
fOutFunction = _fOutFunction;
//return(__get__outFunction());
}
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_IN = "In";
static var sSTATE_IDLE = "Idle";
static var sSTATE_OUT = "Out";
}
Symbol 357 MovieClip [__Packages.Pause] Frame 0
class Pause extends library.Popup
{
var setState, bPause, mcRef, nSection, oKeyListener, oPlayerStats;
function Pause (_mcRef) {
super(_mcRef);
setState(library.Popup.sSTATE_HIDDEN);
bPause = true;
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case library.Popup.sSTATE_IN :
bPause = true;
resetPanels(mcRef.mcState.mcState);
mcRef.mcState.mcState["mc" + aOptions[nSection]]._visible = true;
break;
case library.Popup.sSTATE_OUT :
resetPanels(mcRef.mcState.mcState);
mcRef.mcState.mcState["mc" + aOptions[nSection]]._visible = true;
Key.removeListener(oKeyListener);
break;
case library.Popup.sSTATE_IDLE :
resetPanels(mcRef.mcState);
mcRef.mcState["mc" + aOptions[nSection]]._visible = true;
oKeyListener = new Object();
oKeyListener.onKeyDown = library.Delegate.create(this, doKeyDown);
Key.addListener(oKeyListener);
break;
case library.Popup.sSTATE_HIDDEN :
bPause = false;
}
}
function doIdle() {
}
function start(_oPlayerStats) {
oPlayerStats = _oPlayerStats;
nSection = 0;
setState(library.Popup.sSTATE_IN);
}
function resetPanels(_mcRef) {
var _local2;
_local2 = 0;
while (_local2 < aOptions.length) {
_mcRef["mc" + aOptions[_local2]]._visible = false;
_mcRef[("mc" + aOptions[_local2]) + "Text"].onRollOver = library.Delegate.create(this, doMouseOver, _local2);
_mcRef[("mc" + aOptions[_local2]) + "Text"].onRelease = library.Delegate.create(this, doMouseClick, _local2);
_local2++;
}
_mcRef.mcStatus.txtHealth.text = oPlayerStats.health;
_mcRef.mcStatus.txtHunger.text = oPlayerStats.hunger;
_mcRef.mcStatus.txtPunchStr.text = oPlayerStats.punchstr;
_mcRef.mcStatus.txtPunchDef.text = oPlayerStats.punchdef;
_mcRef.mcStatus.txtCockStr.text = oPlayerStats.cockstr;
_mcRef.mcStatus.txtCockDef.text = oPlayerStats.cockdef;
_mcRef.mcStatus.txtMovement.text = oPlayerStats.movement;
}
function doKeyDown() {
if (Key.isDown(40) || (Key.isDown(38))) {
mcRef.mcState["mc" + aOptions[nSection]]._visible = false;
if (Key.isDown(40)) {
nSection++;
if (nSection >= aOptions.length) {
nSection = 0;
}
} else {
nSection--;
if (nSection < 0) {
nSection = aOptions.length - 1;
}
}
mcRef.mcState["mc" + aOptions[nSection]]._visible = true;
}
if (Key.isDown(game.Player.nBUTTON_PUNCH) || (Key.isDown(game.Player.nBUTTON_PAUSE))) {
selectSection(aOptions[nSection]);
}
}
function doMouseClick(_nSection) {
selectSection(aOptions[_nSection]);
}
function doMouseOver(_nSection) {
mcRef.mcState["mc" + aOptions[nSection]]._visible = false;
nSection = _nSection;
mcRef.mcState["mc" + aOptions[nSection]]._visible = true;
}
function selectSection(_sSection) {
switch (_sSection) {
case "Status" :
break;
case "Exit" :
setState(library.Popup.sSTATE_OUT);
}
}
function get paused() {
return(bPause);
}
function set paused(_bPause) {
bPause = _bPause;
//return(paused);
}
static var aOptions = new Array("Status", "Exit");
}
Symbol 358 MovieClip [__Packages.library.Delegate] Frame 0
class library.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local3 = arguments.callee.target;
var _local4 = arguments.callee.func;
var _local2 = arguments.callee.arg;
_local2 = _local2.concat(arguments);
return(_local4.apply(_local3, _local2));
};
_local2.target = obj;
_local2.func = func;
_local2.arg = arguments.slice(2);
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 359 MovieClip [__Packages.game.character.Sprite] Frame 0
class game.character.Sprite extends State
{
var nId, nSpeedX, nSpeedY, nAirSpeedY, nOriginY, bFlight, mcRef;
function Sprite (_mcRef) {
super(_mcRef);
nId = Main.__get__Instance().getNextId;
initSprite();
}
function initSprite() {
nSpeedX = 0;
nSpeedY = 0;
nAirSpeedY = 0;
nOriginY = 0;
bFlight = false;
}
function enterFrame() {
super.enterFrame();
if ((nSpeedX != 0) || (nSpeedY != 0)) {
var _local3 = 0;
if (nAirSpeedY != 0) {
_local3 = nOriginY;
} else {
_local3 = mcRef._y + nSpeedY;
}
var _local4 = new Object({x:mcRef._x + nSpeedX, y:_local3});
if (Main.__get__Instance().__get__game().__get__level().tryHitWall(_local4)) {
nSpeedX = 0;
nSpeedY = 0;
}
mcRef._x = mcRef._x + nSpeedX;
mcRef._y = mcRef._y + nSpeedY;
if ((nSpeedY != 0) && (nAirSpeedY == 0)) {
mcRef._y = mcRef._y + nAirSpeedY;
if (!Main.b2D_PLATFORMER) {
mcRef.swapDepths(Main.__get__Instance().__get__game().__get__level().getDepth(mcRef._y));
}
}
}
}
function verifyTryHit(_oPoint, _nOrigin) {
var _local5 = false;
if ((_nOrigin != nId) && (mcRef.mcState.mcHitArea != undefined)) {
var _local2 = new Object({x:mcRef.mcState.mcHitArea._x, y:mcRef.mcState.mcHitArea._y});
mcRef.mcState.localToGlobal(_local2);
var _local4 = mcRef._xscale < 0;
if (((_local4 || ((_local2.x <= _oPoint.x) && ((_local2.x + mcRef.mcState.mcHitArea._width) >= _oPoint.x))) && ((!_local4) || ((_local2.x >= _oPoint.x) && ((_local2.x - mcRef.mcState.mcHitArea._width) <= _oPoint.x)))) && ((_local2.y <= _oPoint.y) && ((_local2.y + mcRef.mcState.mcHitArea._height) >= _oPoint.y))) {
_local5 = true;
}
}
return(_local5);
}
function faceTarget(_mcTarget) {
if (mcRef._x < _mcTarget._x) {
mcRef._xscale = 100;
} else {
mcRef._xscale = -100;
}
}
function get Id() {
return(nId);
}
}
Symbol 360 MovieClip [__Packages.game.character.Character] Frame 0
class game.character.Character extends game.character.Sprite
{
var sType, nHP, nHPMax, nPunchStr, nKickStr, nPunchDef, nKickDef, nPunchRecoil, nKickRecoil, nAirSpeedY, nSpeedMultiplier, setState, mcRef, sState, nPunchCount, nSpeedX, nRecoil, nFrameWait, nSpeedY, isStateComplete, nId, nOriginY, setMc, sCHARACTER_LINKAGE, verifyTryHit, sName, bChangingLevels, __get__changingLevels;
function Character (_mcRef, _sType) {
super(_mcRef);
sType = _sType;
nHP = 100;
nHPMax = 100;
nPunchStr = 1;
nKickStr = 1;
nPunchDef = 1;
nKickDef = 1;
nPunchRecoil = 4;
nKickRecoil = 4;
nAirSpeedY = 0;
nSpeedMultiplier = 1;
setState(sSTATE_IDLE);
mcRef.swapDepths(Main.__get__Instance().__get__game().__get__level().getDepth(mcRef._y));
}
function loadState(_sState) {
super.loadState(_sState);
switch (sState) {
case sSTATE_IDLE :
nPunchCount = 1;
break;
case sSTATE_WALK :
nPunchCount = 1;
break;
case sSTATE_RUN :
nPunchCount = 1;
break;
case sSTATE_FALL :
case sSTATE_BLISSFALL :
nSpeedX = (-(mcRef._xscale / Math.abs(mcRef._xscale))) * nRecoil;
break;
case sSTATE_GROUND :
nFrameWait = nGROUND_WAIT;
break;
case sSTATE_HURT :
case sSTATE_BLOCK :
nSpeedX = 0;
nSpeedY = 0;
break;
case sSTATE_PUNCH :
case sSTATE_UPPERCUT :
case sSTATE_KICK :
case sSTATE_ROUNDHOUSE :
}
}
function doWalk() {
if ((nSpeedX == 0) && (nSpeedY == 0)) {
setState(sSTATE_IDLE);
}
}
function doRun() {
if ((nSpeedX == 0) && (nSpeedY == 0)) {
setState(sSTATE_IDLE);
}
}
function doPrePunch() {
slowDown("X");
slowDown("Y");
if (isStateComplete()) {
if (nPunchCount < nPUNCH_TO_UPPERCUT) {
setState(sSTATE_PUNCH);
} else {
setState(sSTATE_UPPERCUT);
}
}
}
function doPunch() {
slowDown("X");
slowDown("Y");
if (mcRef.mcState.mcHit != undefined) {
var _local2 = new Object({x:mcRef.mcState.mcHit._x, y:mcRef.mcState.mcHit._y});
mcRef.mcState.localToGlobal(_local2);
var _local3 = Main.__get__Instance().__get__game().tryHit(_local2, mcRef._xscale, nId, nPunchStr, 0, false, false);
nPunchCount++;
}
if (isStateComplete()) {
setState(sSTATE_POSTPUNCH);
}
}
function doUppercut() {
slowDown("X");
slowDown("Y");
if (mcRef.mcState.mcHit != undefined) {
var _local2 = new Object({x:mcRef.mcState.mcHit._x, y:mcRef.mcState.mcHit._y});
mcRef.mcState.localToGlobal(_local2);
var _local3 = Main.__get__Instance().__get__game().tryHit(_local2, mcRef._xscale, nId, nPunchStr * 2, nPunchRecoil, true, false);
nPunchCount++;
}
if (isStateComplete()) {
setState(sSTATE_POSTPUNCH);
}
}
function doPostPunch() {
slowDown("X");
slowDown("Y");
}
function doPreKick() {
slowDown("X");
slowDown("Y");
if (isStateComplete()) {
if (nPunchCount < nPUNCH_TO_UPPERCUT) {
setState(sSTATE_KICK);
} else {
setState(sSTATE_ROUNDHOUSE);
}
}
}
function doKick() {
slowDown("X");
slowDown("Y");
if (mcRef.mcState.mcHit != undefined) {
var _local2 = new Object({x:mcRef.mcState.mcHit._x, y:mcRef.mcState.mcHit._y});
mcRef.mcState.localToGlobal(_local2);
var _local3 = Main.__get__Instance().__get__game().tryHit(_local2, mcRef._xscale, nId, nKickStr, 0, false, true);
nPunchCount++;
}
if (isStateComplete()) {
setState(sSTATE_POSTKICK);
}
}
function doRoundhouse() {
slowDown("X");
slowDown("Y");
if (mcRef.mcState.mcHit != undefined) {
var _local2 = new Object({x:mcRef.mcState.mcHit._x, y:mcRef.mcState.mcHit._y});
mcRef.mcState.localToGlobal(_local2);
var _local3 = Main.__get__Instance().__get__game().tryHit(_local2, mcRef._xscale, nId, nKickStr * 2, nKickRecoil, true, true);
nPunchCount++;
}
if (isStateComplete()) {
setState(sSTATE_POSTKICK);
}
}
function doPostKick() {
slowDown("X");
slowDown("Y");
}
function doHurt() {
if (isStateComplete()) {
setState(sSTATE_IDLE);
}
}
function doJump() {
nAirSpeedY = nAirSpeedY / nGRAVITY;
mcRef._y = mcRef._y + nAirSpeedY;
if (nAirSpeedY >= -1) {
nAirSpeedY = 1;
setState(sSTATE_JUMPFALL);
}
}
function doJumpFall() {
nAirSpeedY = nAirSpeedY * nGRAVITY;
nAirSpeedY = Math.min(nAirSpeedY, nJUMP_Y);
mcRef._y = mcRef._y + nAirSpeedY;
if (mcRef._y >= nOriginY) {
mcRef._y = nOriginY;
nAirSpeedY = 0;
if ((nSpeedX == 0) && (nSpeedY == 0)) {
setState(sSTATE_IDLE);
} else if (nMAX_X < nSpeedX) {
setState(sSTATE_WALK);
} else {
setState(sSTATE_RUN);
}
}
}
function doJumpKick() {
doJumpFall();
if (mcRef.mcState.mcHit != undefined) {
var _local2 = new Object({x:mcRef.mcState.mcHit._x, y:mcRef.mcState.mcHit._y});
mcRef.mcState.localToGlobal(_local2);
Main.__get__Instance().__get__game().tryHit(_local2, mcRef._xscale, nId, 4, nKickRecoil, false, false);
}
}
function doFall() {
if (isStateComplete()) {
if (nHP <= 0) {
setState(sSTATE_DEATH);
} else {
setState(sSTATE_GROUND);
}
}
}
function doDeath() {
slowDown("X");
}
function doBlissFall() {
doFall();
}
function doGround() {
slowDown("X");
nFrameWait--;
if (nFrameWait <= 0) {
setState(sSTATE_GETUP);
}
}
function doGetUp() {
if (isStateComplete()) {
setState(sSTATE_IDLE);
}
}
function startJump() {
nOriginY = mcRef._y;
nAirSpeedY = -nJUMP_Y;
}
function changeSpeed(_bRight, _sPosVariable) {
var _local3 = _sPosVariable.substr(0, 1);
var _local2 = this["nSpeed" + _local3];
if (_bRight) {
if (this["nSpeed" + _local3] > 0) {
_local2 = _local2 * this["nACCELERATE_" + _sPosVariable];
_local2 = Math.min(_local2, this["nMAX_" + _sPosVariable]);
} else if (nSpeedX < 0) {
_local2 = _local2 / this["nACCELERATE_" + _sPosVariable];
if (_local2 >= -1) {
_local2 = 1;
}
if (_local3 == "X") {
mcRef[("_" + _local3) + "scale"] = 100;
}
} else {
_local2 = 1;
if (_local3 == "X") {
mcRef[("_" + _local3) + "scale"] = 100;
}
}
} else if (_local2 < 0) {
_local2 = _local2 * this["nACCELERATE_" + _sPosVariable];
_local2 = Math.max(_local2, -this["nMAX_" + _sPosVariable]);
if (_local3 == "Y") {
nOriginY = nOriginY + _local2;
}
} else if (_local2 > 0) {
_local2 = _local2 / this["nACCELERATE_" + _sPosVariable];
if (_local2 <= 1) {
_local2 = -1;
}
if (_local3 == "X") {
mcRef[("_" + _local3) + "scale"] = -100;
}
} else {
_local2 = -1;
if (_local3 == "X") {
mcRef[("_" + _local3) + "scale"] = -100;
}
}
this["nSpeed" + _local3] = _local2;
}
function slowDown(_sPosVariable) {
this["nSpeed" + _sPosVariable] = this["nSpeed" + _sPosVariable] / this["nACCELERATE_" + _sPosVariable];
if (Math.abs(this["nSpeed" + _sPosVariable]) <= 1) {
this["nSpeed" + _sPosVariable] = 0;
}
}
function setCharacter(_mcLevel) {
setMc(_mcLevel.attachMovie(sCHARACTER_LINKAGE, sCHARACTER_LINKAGE + _mcLevel.getNextHighestDepth(), _mcLevel.getNextHighestDepth()));
mcRef._x = 300;
mcRef._y = 300;
mcRef.swapDepths(Main.__get__Instance().__get__game().__get__level().getDepth(mcRef._y));
}
function tryHit(_oPoint, _scale, _nOrigin, _nDamage, _nRecoil, _bKnockout, _bBliss) {
var _local2 = sSTATE_IDLE;
var _local3;
var _local4 = verifyTryHit(_oPoint, _nOrigin);
if (_local4) {
if (tryBlock(_xscale)) {
setState(sSTATE_BLOCK);
_local2 = sSTATE_BLOCK;
} else {
mcRef._xscale = -_scale;
nHP = nHP - _nDamage;
nSpeedX = 0;
nSpeedY = 0;
nRecoil = _nRecoil;
if (_bKnockout) {
if (!_bBliss) {
setState(sSTATE_FALL);
} else {
setState(sSTATE_BLISSFALL);
}
_local2 = sSTATE_FALL;
} else {
nHP = Math.max(1, nHP);
if (!_bBliss) {
setState(sSTATE_HURT);
} else {
setState(sSTATE_BLISSHURT);
}
_local2 = sSTATE_HURT;
}
}
_local3 = new Object({health:nHP, maxhealth:nHPMax, face:sCHARACTER_LINKAGE, name:sName});
}
_local3.result = _local2;
return(_local3);
}
function tryBlock(_xscale) {
return(false);
}
function isHit(_sResult) {
return((_sResult == sSTATE_HURT) || (_sResult == sSTATE_FALL));
}
function set changingLevels(_bChangingLevels) {
bChangingLevels = _bChangingLevels;
//return(__get__changingLevels());
}
function get characterLinkage() {
return(sCHARACTER_LINKAGE);
}
function get characterType() {
return(sType);
}
function get characterName() {
return(sName);
}
function get health() {
return(nHP);
}
function get maxhealth() {
return(nHPMax);
}
var nACCELERATE_X = 1.5;
var nACCELERATE_X_RUN = 10;
var nACCELERATE_Y = 2;
var nGROUND_WAIT = 8;
var nMAX_X = 5;
var nMAX_X_RUN = 15;
var nMAX_Y = 2;
var nJUMP_Y = 70;
var nGRAVITY = 1.75;
var nPUNCH_TO_UPPERCUT = 3;
static var sSTATE_IDLE = "Idle";
static var sSTATE_WALK = "Walk";
static var sSTATE_RUN = "Run";
static var sSTATE_JUMP = "Jump";
static var sSTATE_JUMPFALL = "JumpFall";
static var sSTATE_FALL = "Fall";
static var sSTATE_BLISSFALL = "BlissFall";
static var sSTATE_GROUND = "Ground";
static var sSTATE_GETUP = "GetUp";
static var sSTATE_PREPUNCH = "PrePunch";
static var sSTATE_PUNCH = "Punch";
static var sSTATE_UPPERCUT = "Uppercut";
static var sSTATE_POSTPUNCH = "PostPunch";
static var sSTATE_PREKICK = "PreKick";
static var sSTATE_KICK = "Kick";
static var sSTATE_ROUNDHOUSE = "Roundhouse";
static var sSTATE_POSTKICK = "PostKick";
static var sSTATE_JUMPKICK = "JumpKick";
static var sSTATE_HURT = "Hurt";
static var sSTATE_BLISSHURT = "BlissHurt";
static var sSTATE_DEATH = "Death";
static var sSTATE_BLOCK = "Block";
}
Symbol 361 MovieClip [__Packages.game.Player] Frame 0
class game.Player extends game.character.Character
{
var bButtonPressA, bButtonPressS, bButtonPressD, bButtonPressLeft, bButtonPressRight, bButtonPressSpace, sLastButton, nFramesSinceLastButton, nPunchStr, nKickStr, nPunchDef, nKickDef, nHunger, nHungerPart, nMaxHungerPart, nBones, nHP, nHPMax, mcRef, bChangingLevels, nPunchCount, isStateComplete, setState, nSpeedX, slowDown, nSpeedY, nAirSpeedY, startJump, changeSpeed, sState, nSpeedMultiplier;
function Player () {
super(undefined, "Player");
bButtonPressA = false;
bButtonPressS = false;
bButtonPressD = false;
bButtonPressLeft = false;
bButtonPressRight = false;
bButtonPressSpace = false;
sLastButton = "";
nFramesSinceLastButton = 0;
nPunchStr = 4;
nKickStr = 4;
nPunchDef = 1;
nKickDef = 1;
nHunger = 5;
nHungerPart = 125;
nMaxHungerPart = 125;
nBones = 0;
nHP = 100;
nHPMax = 100;
}
function enterFrame() {
super.enterFrame();
nFramesSinceLastButton++;
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case sSTATE_CHANGE_LEVEL :
mcRef.gotoAndStop(game.character.Character.sSTATE_IDLE);
bButtonPressLeft = false;
bButtonPressRight = false;
break;
case game.character.Character.sSTATE_DEATH :
Main.__get__Instance().__get__game().setDeath();
}
}
function doIdle() {
if (!bChangingLevels) {
keyDown();
}
}
function doWalk() {
keyDown();
super.doWalk();
}
function doRun() {
keyDown();
super.doRun();
}
function doJumpFall() {
super.doJumpFall();
}
function doPostPunch() {
if (nPunchCount < (nPUNCH_TO_UPPERCUT + 1)) {
pressAttack();
}
super.doPostPunch();
if (isStateComplete()) {
resumeMovement();
}
}
function doPostKick() {
if (nPunchCount <= (nPUNCH_TO_UPPERCUT + 1)) {
pressAttack();
}
super.doPostKick();
if (isStateComplete()) {
resumeMovement();
}
}
function doBlock() {
if (isStateComplete()) {
setState(game.character.Character.sSTATE_IDLE);
}
}
function doChangeLevel() {
if (Math.abs(nSpeedX) > 0) {
slowDown("X");
}
if (Math.abs(nSpeedY) > 0) {
slowDown("Y");
}
}
function keyDown() {
var _local2 = pressAttack();
if (!_local2) {
pressLeftRight("Left");
pressLeftRight("Right");
if ((!bButtonPressLeft) && (!bButtonPressRight)) {
slowDown("X");
}
if (Key.isDown(nBUTTON_JUMP) && (!bButtonPressD)) {
sLastButton = "Jump";
if (nAirSpeedY == 0) {
bButtonPressD = true;
setState(game.character.Character.sSTATE_JUMP);
startJump();
}
} else {
if ((!Key.isDown(nBUTTON_JUMP)) && (bButtonPressD)) {
bButtonPressD = false;
}
if (Key.isDown(38)) {
sLastButton = "Up";
if ((nSpeedY == 0) && (nAirSpeedY == 0)) {
setState(game.character.Character.sSTATE_WALK);
}
changeSpeed(false, "Y");
} else if (Key.isDown(40)) {
sLastButton = "Down";
if ((nSpeedY == 0) && (nAirSpeedY == 0)) {
setState(game.character.Character.sSTATE_WALK);
}
changeSpeed(true, "Y");
} else {
slowDown("Y");
}
}
} else {
slowDown("X");
slowDown("Y");
}
}
function pressAttack() {
var _local2 = false;
if (Key.isDown(nBUTTON_PUNCH)) {
sLastButton = "Punch";
if (!bButtonPressA) {
if (sState == game.character.Character.sSTATE_RUN) {
nPunchCount = nPUNCH_TO_UPPERCUT;
setState(game.character.Character.sSTATE_UPPERCUT);
_local2 = true;
bButtonPressA = true;
} else {
setState(game.character.Character.sSTATE_PREPUNCH);
_local2 = true;
bButtonPressA = true;
}
}
} else {
bButtonPressA = false;
}
if (!bButtonPressA) {
if (Key.isDown(nBUTTON_KICK)) {
sLastButton = "Kick";
if (!bButtonPressS) {
if (sState == game.character.Character.sSTATE_RUN) {
nPunchCount = nPUNCH_TO_UPPERCUT;
setState(game.character.Character.sSTATE_ROUNDHOUSE);
_local2 = true;
bButtonPressS = true;
} else {
setState(game.character.Character.sSTATE_PREKICK);
_local2 = true;
bButtonPressS = true;
}
}
} else {
bButtonPressS = false;
}
}
return(_local2);
}
function pressLeftRight(_sDirection) {
var _local5;
var _local4;
var _local3;
if (_sDirection == "Left") {
_local5 = "Right";
_local4 = 37;
_local3 = false;
} else {
_local5 = "Left";
_local4 = 39;
_local3 = true;
}
if (!this["bButtonPress" + _local5]) {
if (Key.isDown(_local4)) {
if ((!this["bButtonPress" + _sDirection]) || ((sState != game.character.Character.sSTATE_WALK) && (sState != game.character.Character.sSTATE_RUN))) {
if (nAirSpeedY == 0) {
if ((sLastButton == _sDirection) && (nFramesSinceLastButton < nFRAMES_BETWEEN_DASH_BUTTON_PRESS)) {
setState(game.character.Character.sSTATE_RUN);
nFramesSinceLastButton = nFRAMES_BETWEEN_DASH_BUTTON_PRESS + 1;
} else {
setState(game.character.Character.sSTATE_WALK);
nFramesSinceLastButton = 0;
}
sLastButton = "";
}
this["bButtonPress" + _sDirection] = true;
}
if (sState == game.character.Character.sSTATE_WALK) {
changeSpeed(_local3, "X");
} else {
changeSpeed(_local3, "X_RUN");
}
} else if (this["bButtonPress" + _sDirection]) {
sLastButton = _sDirection;
this["bButtonPress" + _sDirection] = false;
}
}
}
function resumeMovement() {
if (Key.isDown(37)) {
setState(game.character.Character.sSTATE_WALK);
} else if (Key.isDown(39)) {
setState(game.character.Character.sSTATE_WALK);
} else {
setState(game.character.Character.sSTATE_IDLE);
}
}
function addHunger(_nHunger) {
nHungerPart = nHungerPart - _nHunger;
while (nHungerPart < 0) {
nHunger--;
nHungerPart = nHungerPart + nMaxHungerPart;
}
if (nHunger <= 0) {
nHunger = 0;
nHungerPart = 0;
}
return((((nHunger - 1) * nMaxHungerPart) + nHungerPart) / (nMaxHungerPart * nHUNGER_PARTS));
}
function addBones(_nBones) {
nBones = nBones + _nBones;
return(nBones);
}
function buyItem(_oItem) {
if (_oItem.nHunger != undefined) {
nPunchStr = nPunchStr + _oItem.nPunchStr;
}
if (_oItem.nMaxHungerPart != undefined) {
nMaxHungerPart = nMaxHungerPart + _oItem.nMaxHungerPart;
}
if (_oItem.nHP != undefined) {
nPunchStr = nPunchStr + _oItem.nHP;
}
if (_oItem.nMaxHP != undefined) {
nHPMax = nHPMax + _oItem.nMaxHP;
}
if (_oItem.nPunchStr != undefined) {
nPunchStr = nPunchStr + _oItem.nPunchStr;
}
if (_oItem.nPunchDef != undefined) {
nPunchDef = nPunchDef + _oItem.nPunchDef;
}
if (_oItem.nKickStr != undefined) {
nKickStr = nKickStr + _oItem.nKickStr;
}
if (_oItem.nKickDef != undefined) {
nKickDef = nKickDef + _oItem.nKickDef;
}
}
function tryBlock(_xscale) {
return((sState == game.character.Character.sSTATE_PREPUNCH) || (sState == game.character.Character.sSTATE_PREKICK));
}
function canChangeMap() {
var _local2 = true;
if (nAirSpeedY != 0) {
_local2 = false;
}
return(_local2);
}
function get hunger() {
return(nHunger);
}
function get bones() {
return(nBones);
}
function get playerData() {
var _local2 = new Object();
_local2.health = nHPMax;
_local2.hunger = nMaxHungerPart;
_local2.punchstr = nPunchStr;
_local2.punchdef = nPunchDef;
_local2.cockstr = nKickStr;
_local2.cockdef = nKickDef;
_local2.movement = nSpeedMultiplier;
return(_local2);
}
static var nBUTTON_PUNCH = 65;
static var nBUTTON_KICK = 83;
static var nBUTTON_JUMP = 68;
static var nBUTTON_PAUSE = 32;
static var nHUNGER_PARTS = 8;
var sCHARACTER_LINKAGE = "Player";
var nACCELERATE_X = 2;
var nACCELERATE_X_RUN = 5;
var nACCELERATE_Y = 5;
var nFRAMES_BETWEEN_DASH_BUTTON_PRESS = 5;
var nMAX_X = 10;
var nMAX_X_RUN = 20;
var nMAX_Y = 5;
var nPUNCH_TO_UPPERCUT = 3;
static var sSTATE_CHANGE_LEVEL = "ChangeLevel";
}
Symbol 362 MovieClip [__Packages.Death] Frame 0
class Death extends library.Popup
{
var setState, oKeyListener, mcRef, nSection, sRespawnLevel, sRespawnPos, __get__respawnLevel, __get__respawnPos;
function Death (_mcRef) {
super(_mcRef);
setState(library.Popup.sSTATE_HIDDEN);
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case library.Popup.sSTATE_IN :
break;
case library.Popup.sSTATE_OUT :
Key.removeListener(oKeyListener);
break;
case library.Popup.sSTATE_IDLE :
resetPanels(mcRef.mcState);
oKeyListener = new Object();
oKeyListener.onKeyDown = library.Delegate.create(this, doKeyDown);
Key.addListener(oKeyListener);
break;
case library.Popup.sSTATE_HIDDEN :
}
}
function resetPanels(_mcRef) {
var _local2;
_local2 = 0;
while (_local2 < aOptions.length) {
_mcRef[("mc" + aOptions[_local2]) + "Text"].onRollOver = library.Delegate.create(this, doMouseOver, _local2);
_mcRef[("mc" + aOptions[_local2]) + "Text"].onRelease = library.Delegate.create(this, doMouseClick, _local2);
_local2++;
}
}
function doKeyDown() {
if (Key.isDown(40) || (Key.isDown(38))) {
if (Key.isDown(40)) {
nSection++;
if (nSection >= aOptions.length) {
nSection = 0;
}
} else {
nSection--;
if (nSection < 0) {
nSection = aOptions.length - 1;
}
}
}
if (Key.isDown(game.Player.nBUTTON_PUNCH) || (Key.isDown(game.Player.nBUTTON_PAUSE))) {
selectSection(aOptions[nSection]);
}
}
function doMouseClick(_nSection) {
selectSection(aOptions[_nSection]);
}
function doMouseOver(_nSection) {
mcRef.mcState["mc" + aOptions[nSection]]._visible = false;
nSection = _nSection;
mcRef.mcState["mc" + aOptions[nSection]]._visible = true;
}
function selectSection(_sSection) {
switch (_sSection) {
case "Retry" :
Main.__get__Instance().__get__game().startLevel(sRespawnLevel, sRespawnPos);
setState(library.Popup.sSTATE_OUT);
break;
case "Quit" :
setState(library.Popup.sSTATE_OUT);
}
}
function setOptions() {
}
function set respawnLevel(_sRespawnLevel) {
sRespawnLevel = _sRespawnLevel;
//return(__get__respawnLevel());
}
function set respawnPos(_sRespawnPos) {
sRespawnPos = _sRespawnPos;
//return(__get__respawnPos());
}
static var aOptions = new Array("Retry", "Quit");
}
Symbol 363 MovieClip [__Packages.game.Level] Frame 0
class game.Level extends game.character.Sprite
{
var sLevel, oLevelData, mcBackground, mcRef, mcSprites, bChangingLevels, aEnnemies, mcPlayer, oBottomRight, aChangeLevel, oPlayerPos, oEnnemyStartPos, aWalls, aTriggers, oAIManager, __get__player, __get__ChangingLevels;
function Level (_mcRef, _sLevel) {
super(_mcRef);
sLevel = _sLevel;
oLevelData = dat.LevelData.getData(sLevel);
initStructure();
}
function initStructure() {
mcBackground = mcRef.createEmptyMovieClip("mcBackground", mcRef.getNextHighestDepth());
mcSprites = mcRef.createEmptyMovieClip("mcSprites", mcRef.getNextHighestDepth());
}
function enterFrame(_bCanChangeMap) {
if (!bChangingLevels) {
var _local2;
_local2 = 0;
while (_local2 < aEnnemies.length) {
aEnnemies[_local2].enterFrame();
_local2++;
}
scrollLevel();
if (_bCanChangeMap) {
changeLevel();
}
}
}
function scrollLevel() {
mcRef._x = Math.min(0, (Main.NX_SIZE / 2) - mcPlayer._x);
mcRef._x = Math.max(mcRef._x, Main.NX_SIZE - oBottomRight.x);
mcRef._y = Math.min(0, (Main.NY_SIZE / 2) - mcPlayer._y);
mcRef._y = Math.max(mcRef._y, Main.NY_SIZE - oBottomRight.y);
updateEnnemies(false);
}
function changeLevel() {
var _local3;
var _local2;
_local3 = 0;
while (_local3 < aChangeLevel.length) {
_local2 = aChangeLevel[_local3];
if ((((mcPlayer._x >= _local2.bx) && (mcPlayer._x <= _local2.ex)) && (mcPlayer._y >= _local2.by)) && (mcPlayer._y <= _local2.ey)) {
switch (_local2.type) {
case sTYPE_LEVEL :
Main.__get__Instance().__get__game().changeLevel(_local2.map, _local2.pos);
break;
case sTYPE_SHOP :
Main.__get__Instance().__get__game().chargeShop(_local2.shop, _local2.pos);
}
bChangingLevels = true;
break;
}
_local3++;
}
}
function unsetShop(_sShop) {
mcPlayer._x = oPlayerPos[_sShop].x;
mcPlayer._y = oPlayerPos[_sShop].y;
mcPlayer._xscale = oPlayerPos[_sShop].xscale;
}
function unsetLevel() {
mcBackground.removeMovieClip();
aChangeLevel = new Array();
}
function setLevel(_sLevel, _oLevelData) {
oLevelData = _oLevelData;
var _local11 = mcBackground.getNextHighestDepth();
mcBackground.removeMovieClip();
mcSprites.removeMovieClip();
initStructure();
sLevel = _sLevel;
var _local3 = mcBackground.attachMovie(sLevel, "mcBackground", _local11);
oEnnemyStartPos = new Object();
oBottomRight = new Object({x:_local3.mcBottomRight._x, y:_local3.mcBottomRight._y});
_local3.mcBottomRight.swapDepths(_local3.getNextHighestDepth());
_local3.mcBottomRight.removeMovieClip();
aEnnemies = new Array();
aChangeLevel = new Array();
aWalls = new Array();
oPlayerPos = new Object();
var _local2;
var _local4;
for (_local2 in _local3) {
if (_local2.substring(0, 12) == "mcZoneChange") {
_local4 = new Object();
_local4.bx = _local3[_local2]._x;
_local4.by = _local3[_local2]._y;
_local4.ex = _local3[_local2]._x + _local3[_local2]._width;
_local4.ey = _local3[_local2]._y + _local3[_local2]._height;
_local4.type = sTYPE_LEVEL;
_local4.map = _local2.substr(12).split("_")[0];
_local4.pos = _local2.substr(12).split("_")[1];
aChangeLevel.push(_local4);
_local3[_local2].swapDepths(_local3.getNextHighestDepth());
_local3[_local2].removeMovieClip();
} else if (_local2.substring(0, 7) == "mcEnemy") {
if (oEnnemyStartPos[_local2.substring(8)] == undefined) {
oEnnemyStartPos[_local2.substring(8)] = new Array();
}
oEnnemyStartPos[_local2.substring(8)].push(new Object({x:_local3[_local2]._x, y:_local3[_local2]._y, xscale:_local3[_local2]._xscale}));
_local3[_local2].swapDepths(_local3.getNextHighestDepth());
_local3[_local2].removeMovieClip();
} else if (_local2.substring(0, 6) == "mcBoss") {
addEnnemy(_local2.substring(2), _local3[_local2], _sLevel);
} else if (_local2.substring(0, 8) == "mcPlayer") {
oPlayerPos[_local2.substring(8)] = new Object({x:_local3[_local2]._x, y:_local3[_local2]._y, xscale:_local3[_local2]._xscale});
_local3[_local2].swapDepths(_local3.getNextHighestDepth());
_local3[_local2].removeMovieClip();
} else if (_local2.substring(0, 6) == "mcShop") {
_local4 = new Object();
_local4.bx = _local3[_local2]._x;
_local4.by = _local3[_local2]._y;
_local4.ex = _local3[_local2]._x + _local3[_local2]._width;
_local4.ey = _local3[_local2]._y + _local3[_local2]._height;
_local4.type = sTYPE_SHOP;
_local4.shop = _local2.substr(6).split("_")[0];
_local4.pos = _local2.substr(6).split("_")[1];
aChangeLevel.push(_local4);
_local3[_local2].swapDepths(_local3.getNextHighestDepth());
_local3[_local2].removeMovieClip();
} else if (_local2.substring(0, 6) == "mcWall") {
var _local6 = new Object();
_local6.bx = _local3[_local2]._x;
_local6.by = _local3[_local2]._y;
_local6.ex = _local3[_local2]._x + _local3[_local2]._width;
_local6.ey = _local3[_local2]._y + _local3[_local2]._height;
aWalls.push(_local6);
_local3[_local2].swapDepths(_local3.getNextHighestDepth());
_local3[_local2].removeMovieClip();
} else if (_local2.substring(0, 9) == "mcTrigger") {
var _local5 = new Object();
_local5.bx = _local3[_local2]._x;
_local5.by = _local3[_local2]._y;
_local5.ex = _local3[_local2]._x + _local3[_local2]._width;
_local5.ey = _local3[_local2]._y + _local3[_local2]._height;
_local5.trigger = _local2.substr(9);
aTriggers.push(_local5);
_local3[_local2].swapDepths(_local3.getNextHighestDepth());
_local3[_local2].removeMovieClip();
}
}
}
function setPlayerPos(_sPos) {
oAIManager = new game.AIManager(mcPlayer);
mcPlayer._x = oPlayerPos[_sPos].x;
mcPlayer._y = oPlayerPos[_sPos].y;
mcPlayer._xscale = oPlayerPos[_sPos].xscale;
mcPlayer.swapDepths(getDepth(mcPlayer._y));
scrollLevel();
var _local6;
var _local2;
var _local5;
var _local3;
_local2 = 0;
while (_local2 < oLevelData.nSimultaneous) {
_local5 = Math.floor(Math.random() * oEnnemyStartPos[_sPos].length);
_local6 = String(oLevelData.aEnnemyList.pop());
_local3 = mcSprites.attachMovie(_local6, "Enemy" + aEnnemies.length, mcSprites.getNextHighestDepth());
_local3._x = oEnnemyStartPos[_sPos][_local5].x;
_local3._y = oEnnemyStartPos[_sPos][_local5].y;
_local3._xscale = oEnnemyStartPos[_sPos][_local5].xscale;
_local3.swapDepths(getDepth(_local3._y));
aEnnemies.push(new game.Enemy(_local3, _local6, sLevel));
oEnnemyStartPos[_sPos].splice(_local5, 1);
_local2++;
}
var _local7 = aEnnemies.length;
_local2 = 0;
while (_local2 < _local7) {
aEnnemies[_local2].setAI(mcPlayer);
oAIManager.addEnnemy(aEnnemies[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < _local7) {
aEnnemies[_local2].setAI(mcPlayer, oAIManager.getAttitude(aEnnemies[_local2].Id));
_local2++;
}
}
function setDialog(_sCharacter, _sText) {
var _local2;
_local2 = 0;
while (_local2 < aEnnemies.length) {
if (aEnnemies[_local2].characterType == _sCharacter) {
aEnnemies[_local2].setDialog(_sText);
break;
}
_local2++;
}
}
function tryHit(_oPoint, _scale, _nOrigin, _nDamage, _nRecoil, _bKnockout, _bBliss) {
var _local3;
var _local2;
_local2 = 0;
while (_local2 < aEnnemies.length) {
_local3 = aEnnemies[_local2].tryHit(_oPoint, _scale, _nOrigin, _nDamage, _nRecoil, _bKnockout, _bBliss);
_local2++;
}
return(_local3);
}
function tryHitWall(_oPoint) {
var _local4 = false;
var _local2;
_local2 = 0;
while (_local2 < aWalls.length) {
_local4 = (((aWalls[_local2].bx <= _oPoint.x) && (aWalls[_local2].ex >= _oPoint.x)) && (aWalls[_local2].by <= _oPoint.y)) && (aWalls[_local2].ey >= _oPoint.y);
if (_local4) {
break;
}
_local2++;
}
return(_local4);
}
function tryHitTrigger(_oPoint) {
var _local4 = false;
var _local2;
_local2 = 0;
while (_local2 < aWalls.length) {
_local4 = (((aWalls[_local2].bx <= _oPoint.x) && (aWalls[_local2].ex >= _oPoint.x)) && (aWalls[_local2].by <= _oPoint.y)) && (aWalls[_local2].ey >= _oPoint.y);
if (_local4) {
break;
}
_local2++;
}
return(_local4);
}
function tryLevelHit(_mcRef) {
}
function addEnnemy(_sType, _mcSource, _sLevel) {
var _local3 = mcSprites.attachMovie(_sType, "Enemy" + aEnnemies.length, mcSprites.getNextHighestDepth());
_local3._x = _mcSource._x;
_local3._y = _mcSource._y;
aEnnemies.push(new game.Enemy(_local3, _sType, _sLevel));
_mcSource.swapDepths(getDepth(_mcSource._y));
_mcSource.removeMovieClip();
}
function addNextEnnemy(_nId) {
oAIManager.removeEnnemy(_nId);
if (oLevelData.aEnnemyList.length > 0) {
var _local2;
var _local3 = oLevelData.aEnnemyList.pop();
_local2 = mcSprites.attachMovie(_local3, "Enemy" + aEnnemies.length, mcSprites.getNextHighestDepth());
if (mcPlayer._x > (mcBackground._width / 2)) {
_local2._x = mcPlayer._x - (Math.floor((nDISTANCE_RESPAWN_RANGE - nDISTANCE_RESPAWN) * Math.random()) + nDISTANCE_RESPAWN);
_local2._xscale = 100;
} else {
_local2._x = mcPlayer._x + (Math.floor((nDISTANCE_RESPAWN_RANGE - nDISTANCE_RESPAWN) * Math.random()) + nDISTANCE_RESPAWN);
_local2._xscale = -100;
}
_local2._y = mcPlayer._y;
_local2.swapDepths(getDepth(_local2._y));
aEnnemies.push(new game.Enemy(_local2, _local3, sLevel));
oAIManager.addEnnemy(aEnnemies[aEnnemies.length - 1]);
}
updateEnnemies(true);
}
function updateEnnemies(_bUpdate) {
var _local2;
var _local3 = aEnnemies.length;
if (_bUpdate) {
_local2 = 0;
while (_local2 < _local3) {
if (aEnnemies[_local2].Active) {
aEnnemies[_local2].setAI(mcPlayer, oAIManager.getAttitude(aEnnemies[_local2].Id));
}
_local2++;
}
}
_local2 = 0;
while (_local2 < _local3) {
if (aEnnemies[_local2].leftOfPlayerChanged) {
aEnnemies[_local2].attitude = oAIManager.getAttitude(aEnnemies[_local2].Id);
}
_local2++;
}
}
function damageOrigin(_nOrigin, _nDamage) {
var _local2;
_local2 = 0;
while (_local2 < aEnnemies.length) {
aEnnemies[_local2].damageOrigin(_nOrigin, _nDamage);
_local2++;
}
}
function getDepth(_nXPos) {
var _local3 = 0;
var _local2;
_local2 = 0;
while (_local2 < aEnnemies.length) {
if (aEnnemies[_local2].Mc._x == _nXPos) {
if (aEnnemies[_local2].Mc.getDepth() > _local3) {
_local3 = aEnnemies[_local2].Mc.getDepth();
}
}
_local2++;
}
if (mcPlayer._x == _nXPos) {
if (mcPlayer.getDepth() > _local3) {
_local3 = mcPlayer.getDepth();
}
}
if ((_local3 >= (_nXPos * 1000)) && (_local3 < ((_nXPos + 1) * 1000))) {
_local3 = _local3 + 1;
} else {
_local3 = _nXPos * 1000;
}
return(_local3);
}
function set player(_mcPlayer) {
mcPlayer = _mcPlayer;
scrollLevel();
updateEnnemies(true);
//return(__get__player());
}
function set ChangingLevels(_bChangingLevels) {
bChangingLevels = _bChangingLevels;
//return(__get__ChangingLevels());
}
function get startTrigger() {
return(oLevelData.startTrigger);
}
function get getLevel() {
return(sLevel);
}
function get respawnLevel() {
return(oLevelData.respawnLevel);
}
function get respawnPos() {
return(oLevelData.respawnPos);
}
static var sTYPE_LEVEL = "Level";
static var sTYPE_SHOP = "Shop";
static var nDISTANCE_RESPAWN = 800;
static var nDISTANCE_RESPAWN_RANGE = 850;
}
Symbol 364 MovieClip [__Packages.game.AIManager] Frame 0
class game.AIManager
{
var mcPlayer, aEnnemyList;
function AIManager (_mcPlayer) {
mcPlayer = _mcPlayer;
aEnnemyList = new Array();
}
function addEnnemy(_oEnnemy) {
aEnnemyList.push({mc:_oEnnemy.__get__Mc(), id:_oEnnemy.__get__Id(), attitude:game.character.AIList.STRING_ATTITUDE_NONE});
}
function removeEnnemy(_nId) {
var _local2;
_local2 = 0;
while (_local2 < aEnnemyList.length) {
if (_nId == aEnnemyList[_local2].id) {
aEnnemyList.splice(_local2, 1);
break;
}
_local2++;
}
}
function getAttitude(_nId) {
var _local10;
var _local3;
var _local5 = 999999 /* 0x0F423F */;
var _local4 = 999999 /* 0x0F423F */;
var _local8 = false;
var _local7 = false;
var _local9 = false;
var _local2;
_local2 = 0;
while (_local2 < aEnnemyList.length) {
_local3 = Math.pow(aEnnemyList[_local2].mc._x - mcPlayer._x, 2) + Math.pow(aEnnemyList[_local2].mc._y - mcPlayer._y, 2);
if (aEnnemyList[_local2].mc._x < mcPlayer._x) {
_local5 = Math.min(_local3, _local5);
} else {
_local4 = Math.min(_local3, _local4);
}
if (aEnnemyList[_local2].id == _nId) {
_local9 = aEnnemyList[_local2].mc._x < mcPlayer._x;
}
if (_local5 == _local3) {
_local8 = aEnnemyList[_local2].id == _nId;
} else if (_local4 == _local3) {
_local7 = aEnnemyList[_local2].id == _nId;
}
_local2++;
}
if (_local8 || (_local7)) {
_local10 = game.character.AIList.STRING_ATTITUDE_AGRESSIVE;
} else if ((_local5 == 999999) || (_local4 == 999999)) {
_local10 = game.character.AIList.STRING_ATTITUDE_GET_BEHIND;
} else {
_local10 = game.character.AIList.STRING_ATTITUDE_STAY_AWAY;
}
return(_local10);
}
}
Symbol 365 MovieClip [__Packages.game.Enemy] Frame 0
class game.Enemy extends game.character.Character
{
var sCHARACTER_LINKAGE, sLevel, bManualComplete, nHP, nPunchStr, nKickStr, nPunchDef, nKickDef, nHunger, nBones, nBlockRate, aAttackRates, sName, bActive, oAttackDistances, sState, oAI, nFrameWait, mcRef, nId, slowDown, nPUNCH_TO_UPPERCUT, nPunchCount, bLastAttackHit, setState, isStateComplete, nSpeedY, nSpeedX, sCurrentAction, mcTarget, nMAX_X, sNextAttack, bMoveAway, bMoveSide, bMoveBehind, changeSpeed, faceTarget, bRightOfPlayer, __get__attitude;
function Enemy (_mcRef, _sType, _sLevel) {
super(_mcRef, _sType);
sCHARACTER_LINKAGE = _sType;
sLevel = _sLevel;
bManualComplete = false;
var _local5 = dat.EnnemyData.getData(_sType, _sLevel);
nHP = _local5.nHP;
nPunchStr = _local5.nPunchStr;
nKickStr = _local5.nKickStr;
nPunchDef = _local5.nPunchDef;
nKickDef = _local5.nKickDef;
nHunger = _local5.nHunger;
nBones = _local5.nBones;
nBlockRate = _local5.nBlockRate;
aAttackRates = _local5.aAttackRates;
sName = _local5.sName;
bActive = true;
oAttackDistances = new Object();
var _local3;
for (_local3 in _mcRef) {
if (_local3.substring(0, 10) == "mcDistance") {
oAttackDistances[_local3.substring(10)] = new Object();
oAttackDistances[_local3.substring(10)].x = _mcRef["mcDistance" + _local3.substring(10)]._x;
oAttackDistances[_local3.substring(10)].y = _mcRef["mcDistance" + _local3.substring(10)]._y;
_mcRef["mcDistance" + _local3.substring(10)].swapDepth(_mcRef.getNextHighestDepth());
_mcRef["mcDistance" + _local3.substring(10)].removeMovieClip();
}
}
}
function enterFrame() {
super.enterFrame();
setAction();
}
function loadState(_sState) {
super.loadState(_sState);
switch (sState) {
case game.character.Character.sSTATE_IDLE :
oAI.start();
break;
case game.character.Character.sSTATE_PREPUNCH :
case game.character.Character.sSTATE_PREKICK :
oAI.stop();
break;
case game.character.Character.sSTATE_PUNCH :
case game.character.Character.sSTATE_KICK :
break;
case game.character.Character.sSTATE_POSTPUNCH :
case game.character.Character.sSTATE_POSTKICK :
nFrameWait = mcRef.mcState._totalframes - 4;
break;
case game.character.Character.sSTATE_BLOCK :
oAI.stop();
break;
case game.character.Character.sSTATE_HURT :
case game.character.Character.sSTATE_BLISSHURT :
oAI.stop();
break;
case game.character.Character.sSTATE_FALL :
case game.character.Character.sSTATE_BLISSFALL :
oAI.stop();
break;
case game.character.Character.sSTATE_DEATH :
bActive = false;
oAI.stop();
Main.__get__Instance().__get__game().addHunger(nHunger, nId);
}
}
function doIdle() {
slowDown("X");
slowDown("Y");
}
function doPunch() {
super.doPunch();
slowDown("X");
slowDown("Y");
}
function doKick() {
doPunch()();
}
function doPostPunch() {
if (((nPunchCount <= nPUNCH_TO_UPPERCUT) && (bLastAttackHit)) && (nFrameWait <= 0)) {
setState(game.character.Character.sSTATE_PREPUNCH);
} else {
nFrameWait--;
super.doPostPunch();
if (isStateComplete()) {
if (!bLastAttackHit) {
nFrameWait = NUMBER_WAIT_FRAMES;
} else {
nFrameWait = NUMBER_WAIT_FRAMES_LONG;
}
setState(game.character.Character.sSTATE_IDLE);
}
}
}
function doPostKick() {
if (((nPunchCount <= nPUNCH_TO_UPPERCUT) && (bLastAttackHit)) && (nFrameWait <= 0)) {
setState(game.character.Character.sSTATE_PREKICK);
} else {
nFrameWait--;
super.doPostKick();
if (isStateComplete()) {
if (!bLastAttackHit) {
nFrameWait = NUMBER_WAIT_FRAMES;
} else {
nFrameWait = NUMBER_WAIT_FRAMES_LONG;
}
setState(game.character.Character.sSTATE_IDLE);
}
}
}
function doGetUp() {
if (isStateComplete()) {
oAI.start();
}
super.doGetUp();
}
function doHurt() {
if (isStateComplete()) {
setState(game.character.Character.sSTATE_IDLE);
nFrameWait = nFRAMES_WAIT_AFTER_HURT;
oAI.start();
}
}
function doBlissHurt() {
doHurt();
}
function doBlock() {
if (isStateComplete()) {
setState(game.character.Character.sSTATE_IDLE);
nFrameWait = nFRAMES_WAIT_AFTER_HURT;
oAI.start();
}
}
function doWalk() {
var _local3 = movement("");
if (_local3) {
mcRef._y = getTargetPos("y");
nSpeedY = 0;
} else {
super.doWalk();
}
}
function doRun() {
var _local3 = movement("_RUN");
if (_local3) {
mcRef._y = getTargetPos("y");
nSpeedX = 0;
nSpeedY = 0;
} else {
super.doRun();
}
}
function setAI(_mcPlayer, sAttitude) {
oAI = new game.character.AI(_mcPlayer, mcRef, sLevel, sAttitude);
oAI.start();
mcRef.txtText2.text = sAttitude;
(leftOfPlayerChanged);// not popped
}
function setAction() {
if (oAI.__get__Active() && (oAI.changedDistance() || (actionComplete()))) {
sCurrentAction = oAI.getAction();
nFrameWait = 9999;
mcTarget = oAI.Player;
setNextAttack();
mcRef.txtText.text = sCurrentAction;
switch (sCurrentAction) {
case game.character.AIList.STRING_ATTACK :
if (nMAX_X < nSpeedX) {
nPunchCount = nPUNCH_TO_UPPERCUT + 1;
if (sNextAttack == dat.EnnemyData.sATTACK_PUNCH) {
setState(game.character.Character.sSTATE_UPPERCUT);
} else {
setState(game.character.Character.sSTATE_ROUNDHOUSE);
}
} else if (attackMayHit()) {
if (sNextAttack == dat.EnnemyData.sATTACK_PUNCH) {
setState(game.character.Character.sSTATE_PREPUNCH);
} else {
setState(game.character.Character.sSTATE_PREKICK);
}
} else {
bMoveAway = false;
bMoveSide = false;
bMoveBehind = false;
nFrameWait = 2;
setState(game.character.Character.sSTATE_WALK);
}
break;
case game.character.AIList.STRING_IDLE :
setState(game.character.Character.sSTATE_IDLE);
nFrameWait = NUMBER_WAIT_FRAMES_SHORT;
break;
case game.character.AIList.STRING_WALK_AWAY :
bMoveAway = true;
bMoveSide = false;
bMoveBehind = false;
nFrameWait = NUMBER_WAIT_FRAMES;
setState(game.character.Character.sSTATE_WALK);
break;
case game.character.AIList.STRING_WALK_TO :
bMoveAway = false;
bMoveSide = false;
bMoveBehind = false;
nFrameWait = NUMBER_WAIT_FRAMES;
setState(game.character.Character.sSTATE_WALK);
break;
case game.character.AIList.STRING_RUN_AWAY :
bMoveAway = true;
bMoveSide = false;
bMoveBehind = false;
nFrameWait = NUMBER_WAIT_FRAMES;
setState(game.character.Character.sSTATE_RUN);
break;
case game.character.AIList.STRING_RUN_TO :
bMoveAway = false;
bMoveSide = false;
bMoveBehind = false;
nFrameWait = NUMBER_WAIT_FRAMES;
setState(game.character.Character.sSTATE_RUN);
break;
case game.character.AIList.STRING_WALK_UP_DOWN :
bMoveSide = true;
nFrameWait = NUMBER_WAIT_FRAMES;
setState(game.character.Character.sSTATE_IDLE);
break;
case game.character.AIList.STRING_WALK_BEHIND :
bMoveBehind = true;
bMoveAway = false;
nFrameWait = NUMBER_WAIT_FRAMES;
setState(game.character.Character.sSTATE_WALK);
break;
case game.character.AIList.STRING_RUN_BEHIND :
bMoveBehind = true;
bMoveAway = false;
nFrameWait = NUMBER_WAIT_FRAMES;
setState(game.character.Character.sSTATE_RUN);
}
}
}
function tryBlock(_xscale) {
var _local2 = false;
if (nHP <= 1) {
var _local3 = Math.ceil(Math.random() * 100);
switch (sState) {
case game.character.Character.sSTATE_IDLE :
case game.character.Character.sSTATE_RUN :
case game.character.Character.sSTATE_WALK :
if (nBlockRate < _local3) {
break;
}
_local2 = true;
}
}
return(_local2);
}
function clearAction() {
}
function actionComplete() {
nFrameWait--;
var _local2 = false;
if (bManualComplete || (nFrameWait <= 0)) {
_local2 = true;
bManualComplete = false;
}
return(_local2);
}
function setNextAttack() {
var _local3 = Math.ceil(Math.random() * 100);
var _local2;
_local2 = 0;
while (_local2 < aAttackRates.length) {
if (aAttackRates[_local2].nRate <= _local3) {
sNextAttack = aAttackRates[_local2].sType;
break;
}
_local2++;
}
}
function getTargetPos(_sPos) {
var _local2 = 0;
if (oAI.__get__Attitude() == game.character.AIList.STRING_ATTITUDE_GET_BEHIND) {
if (_sPos == "x") {
if (mcRef._xscale > 0) {
_local2 = mcTarget._x + oAttackDistances[sNextAttack][_sPos];
} else {
_local2 = mcTarget._x - oAttackDistances[sNextAttack][_sPos];
}
} else {
_local2 = mcTarget._y;
}
} else if (_sPos == "x") {
if (mcRef._xscale > 0) {
_local2 = mcTarget._x - oAttackDistances[sNextAttack][_sPos];
} else {
_local2 = mcTarget._x + oAttackDistances[sNextAttack][_sPos];
}
} else {
_local2 = mcTarget._y;
}
return(_local2);
}
function movement(_sSpeed) {
if (mcRef._x > getTargetPos("x")) {
changeSpeed(bMoveAway, "X" + _sSpeed);
} else {
changeSpeed(!bMoveAway, "X" + _sSpeed);
}
if (!bMoveAway) {
faceTarget(mcTarget);
}
if (oAI.__get__Attitude() == game.character.AIList.STRING_ATTITUDE_GET_BEHIND) {
if (Math.abs(mcRef._y - getTargetPos("y")) < nMIN_MOVE_BEHIND) {
if (mcRef._y < mcTarget._y) {
changeSpeed(false, "Y");
} else {
changeSpeed(true, "Y");
}
} else {
nSpeedY = 0;
}
} else {
var _local2 = false;
if (mcRef._y != getTargetPos("y")) {
if (mcRef._y > getTargetPos("y")) {
changeSpeed(bMoveSide, "Y");
} else {
changeSpeed(!bMoveSide, "Y");
}
if (!bMoveSide) {
if (Math.abs(mcRef._y - getTargetPos("y")) < nMAX_Y_EQUAL_RANGE) {
_local2 = true;
}
}
}
}
return(_local2);
}
function attackMayHit() {
return((Math.pow(mcRef._x - getTargetPos("x"), 2) + Math.pow(mcRef._y - getTargetPos("y"), 2)) <= nMAX_ATTACK_RANGE);
}
function get Active() {
return(bActive);
}
function get leftOfPlayerChanged() {
var _local2 = false;
if (((mcRef._x < mcTarget._x) && (bRightOfPlayer)) || ((mcRef._x > mcTarget._x) && (!bRightOfPlayer))) {
_local2 = true;
}
bRightOfPlayer = mcRef._x > mcTarget._x;
return(bActive);
}
function set attitude(_sAttitude) {
oAI.__set__Attitude(_sAttitude);
//return(__get__attitude());
}
var NUMBER_WAIT_FRAMES_SHORT = 7;
var NUMBER_WAIT_FRAMES = 15;
var NUMBER_WAIT_FRAMES_LONG = 25;
var nFRAMES_WAIT_AFTER_HURT = 8;
var nMAX_Y_EQUAL_RANGE = 2;
var nMAX_ATTACK_RANGE = 600;
var nMIN_MOVE_BEHIND = 70;
}
Symbol 366 MovieClip [__Packages.game.character.AI] Frame 0
class game.character.AI
{
var mcPlayer, mcRef, sGang, sAttitude, aActions, bActive, nCurrentDistance;
function AI (_mcPlayer, _mcRef, _sGang, _sAttitude) {
mcPlayer = _mcPlayer;
mcRef = _mcRef;
sGang = _sGang;
sAttitude = _sAttitude;
aActions = game.character.AIList.actionList(sGang, sAttitude);
}
function stop() {
bActive = false;
}
function start() {
bActive = true;
}
function setActions(_aActions) {
aActions = _aActions;
}
function changedDistance() {
var _local2 = false;
var _local3 = getDistance();
if (_local3 != nCurrentDistance) {
nCurrentDistance = _local3;
_local2 = true;
}
return(_local2);
}
function getAction() {
nCurrentDistance = getDistance();
var _local5;
var _local6 = Math.floor(Math.random() * 100);
var _local3 = 0;
var _local2;
var _local4 = aActions[nCurrentDistance].length;
_local2 = 0;
while (_local2 < _local4) {
if ((aActions[nCurrentDistance][_local2].nProb + _local3) >= _local6) {
_local5 = aActions[nCurrentDistance][_local2].sAction;
break;
}
_local3 = _local3 + aActions[nCurrentDistance][_local2].nProb;
_local2++;
}
return(_local5);
}
function getDistance() {
var _local2;
var _local3 = Math.pow(mcRef._x - mcPlayer._x, 2) + Math.pow(mcRef._y - mcPlayer._y, 2);
if (_local3 <= NUMBER_SHORT_DISTANCE) {
_local2 = 0;
} else if (_local3 <= NUMBER_MEDIUM_DISTANCE) {
_local2 = 1;
} else if (_local3 <= NUMBER_FAR_DISTANCE) {
_local2 = 2;
} else {
_local2 = 3;
}
return(_local2);
}
function get Player() {
return(mcPlayer);
}
function get Active() {
return(bActive);
}
function get Attitude() {
return(sAttitude);
}
function set Attitude(_sAttitude) {
sAttitude = _sAttitude;
//return(Attitude);
}
var NUMBER_SHORT_DISTANCE = 20000;
var NUMBER_MEDIUM_DISTANCE = 100000;
var NUMBER_FAR_DISTANCE = 250000;
}
Symbol 367 MovieClip [__Packages.game.character.AIList] Frame 0
class game.character.AIList
{
function AIList () {
}
static function actionList(_sLevel, _sAttitude) {
var _local1 = new Array(new Array(), new Array(), new Array(), new Array());
switch (_sAttitude) {
case STRING_ATTITUDE_AGRESSIVE :
if (!(_sLevel === dat.LevelData.STRING_LOCATION_OFFICE2)) {
} else {
_local1[0].push({nProb:100, sAction:STRING_IDLE});
_local1[1].push({nProb:100, sAction:STRING_IDLE});
_local1[2].push({nProb:100, sAction:STRING_IDLE});
_local1[3].push({nProb:100, sAction:STRING_IDLE});
}
_local1[0].push({nProb:10, sAction:STRING_WALK_AWAY});
_local1[0].push({nProb:5, sAction:STRING_WALK_UP_DOWN});
_local1[0].push({nProb:25, sAction:STRING_IDLE});
_local1[0].push({nProb:60, sAction:STRING_ATTACK});
_local1[1].push({nProb:15, sAction:STRING_RUN_TO});
_local1[1].push({nProb:35, sAction:STRING_WALK_TO});
_local1[1].push({nProb:15, sAction:STRING_WALK_UP_DOWN});
_local1[1].push({nProb:5, sAction:STRING_WALK_AWAY});
_local1[1].push({nProb:30, sAction:STRING_IDLE});
_local1[2].push({nProb:55, sAction:STRING_RUN_TO});
_local1[2].push({nProb:30, sAction:STRING_WALK_TO});
_local1[2].push({nProb:5, sAction:STRING_WALK_AWAY});
_local1[2].push({nProb:5, sAction:STRING_RUN_AWAY});
_local1[2].push({nProb:5, sAction:STRING_IDLE});
_local1[3].push({nProb:100, sAction:STRING_RUN_TO});
break;
case STRING_ATTITUDE_GET_BEHIND :
_local1[0].push({nProb:30, sAction:STRING_WALK_BEHIND});
_local1[0].push({nProb:55, sAction:STRING_RUN_BEHIND});
_local1[0].push({nProb:5, sAction:STRING_IDLE});
_local1[0].push({nProb:10, sAction:STRING_WALK_UP_DOWN});
_local1[1].push({nProb:50, sAction:STRING_WALK_BEHIND});
_local1[1].push({nProb:40, sAction:STRING_RUN_BEHIND});
_local1[1].push({nProb:5, sAction:STRING_WALK_UP_DOWN});
_local1[1].push({nProb:5, sAction:STRING_IDLE});
_local1[2].push({nProb:50, sAction:STRING_WALK_BEHIND});
_local1[2].push({nProb:30, sAction:STRING_RUN_BEHIND});
_local1[2].push({nProb:20, sAction:STRING_WALK_UP_DOWN});
_local1[3].push({nProb:80, sAction:STRING_RUN_BEHIND});
_local1[3].push({nProb:20, sAction:STRING_WALK_BEHIND});
break;
case STRING_ATTITUDE_STAY_AWAY :
_local1[0].push({nProb:70, sAction:STRING_WALK_AWAY});
_local1[0].push({nProb:30, sAction:STRING_IDLE});
_local1[1].push({nProb:20, sAction:STRING_RUN_AWAY});
_local1[1].push({nProb:30, sAction:STRING_WALK_AWAY});
_local1[1].push({nProb:50, sAction:STRING_IDLE});
_local1[2].push({nProb:30, sAction:STRING_WALK_TO});
_local1[2].push({nProb:30, sAction:STRING_WALK_AWAY});
_local1[2].push({nProb:40, sAction:STRING_IDLE});
_local1[3].push({nProb:60, sAction:STRING_WALK_TO});
_local1[3].push({nProb:40, sAction:STRING_IDLE});
}
return(_local1);
}
static var STRING_ATTITUDE_AGRESSIVE = "Agressive";
static var STRING_ATTITUDE_GET_BEHIND = "GetBehind";
static var STRING_ATTITUDE_STAY_AWAY = "StayAway";
static var STRING_ATTITUDE_NONE = "None";
static var STRING_ATTACK = "Attack";
static var STRING_IDLE = "Idle";
static var STRING_WALK_AWAY = "WalkAway";
static var STRING_WALK_TO = "WalkTo";
static var STRING_RUN_AWAY = "RunAway";
static var STRING_RUN_TO = "RunTo";
static var STRING_WALK_UP_DOWN = "WalkUpDown";
static var STRING_WALK_BEHIND = "WalkBehind";
static var STRING_RUN_BEHIND = "RunBehind";
}
Symbol 368 MovieClip [__Packages.dat.LevelData] Frame 0
class dat.LevelData
{
function LevelData () {
}
static function getData(_sLevel) {
var _local1 = new Object();
switch (_sLevel) {
case STRING_LOCATION_OFFICE1 :
_local1.name = "The City";
_local1.nSimultaneous = 2;
_local1.aEnnemyList = dat.EnnemyData.getRandomEnnemies(5);
_local1.respawnLevel = STRING_LOCATION_OFFICE1;
_local1.respawnPos = Game.sDEFAULT_POS;
break;
case STRING_LOCATION_OFFICE2 :
_local1.name = "Bahamut's Lair";
_local1.nSimultaneous = 1;
_local1.aEnnemyList = new Array("BossBahamut");
_local1.respawnLevel = STRING_LOCATION_OFFICE1;
_local1.respawnPos = Game.sDEFAULT_POS;
break;
case STRING_LOCATION_DOCK1 :
_local1.name = "The Docks";
_local1.nSimultaneous = 2;
_local1.aEnnemyList = dat.EnnemyData.getRandomEnnemies(5);
_local1.respawnLevel = STRING_LOCATION_OFFICE1;
_local1.respawnPos = "mcPlayer" + STRING_LOCATION_OFFICE1;
}
return(_local1);
}
static var STRING_LOCATION_OFFICE1 = "Office1";
static var STRING_LOCATION_OFFICE2 = "Office2";
static var STRING_LOCATION_DOCK1 = "Dock1";
}
Symbol 369 MovieClip [__Packages.dat.EnnemyData] Frame 0
class dat.EnnemyData
{
function EnnemyData () {
}
static function getData(_sType, _sLevel) {
var _local1 = new Object();
switch (_sLevel) {
case dat.LevelData.STRING_LOCATION_OFFICE1 :
case dat.LevelData.STRING_LOCATION_DOCK1 :
_local1.nHP = 25;
_local1.nPunchStr = 2;
_local1.nKickStr = 2;
_local1.nPunchDef = 0;
_local1.nKickDef = 0;
_local1.nHunger = 100;
_local1.nBones = 100;
_local1.nBlockRate = 1;
_local1.aAttackRates = new Array({sType:sATTACK_PUNCH, sRate:50, sType:sATTACK_KICK, sRate:50});
break;
case dat.LevelData.STRING_LOCATION_OFFICE2 :
_local1.nHP = 100;
_local1.nPunchStr = 2;
_local1.nKickStr = 2;
_local1.nPunchDef = 20;
_local1.nKickDef = 20;
_local1.nHunger = 100;
_local1.nBones = 100;
_local1.nBlockRate = 1;
_local1.aAttackRates = new Array({sType:sATTACK_PUNCH, sRate:50, sType:sATTACK_KICK, sRate:50});
}
switch (_sType) {
case sENNEMY_DOG :
_local1.sName = "Doggy Dog";
break;
case "BossBahamut" :
_local1.sName = "Bahamut";
}
return(_local1);
}
static function getRandomEnnemies(_nTotal) {
var _local1 = aEnnemyList.slice();
var _local4 = new Array();
var _local2;
var _local3;
_local2 = 0;
while (_local2 < _nTotal) {
if (_local1.length <= 0) {
_local1 = aEnnemyList.slice();
}
_local3 = Math.floor(Math.random() * _local1.length);
_local4.push(_local1.splice(_local3, 1));
_local2++;
}
return(_local4);
}
static var sATTACK_PUNCH = "Punch";
static var sATTACK_KICK = "Kick";
static var sENNEMY_DOG = "EnnemyDog";
static var aEnnemyList = new Array(sENNEMY_DOG);
}
Symbol 370 MovieClip [__Packages.game.Shop] Frame 0
class game.Shop extends State
{
var mcRef, setState, aBoughtItems, oMax, oDialog, aTriggerSequence, sShop, nHunger, sPos, oOptions;
function Shop (_mcRef) {
super();
mcRef = _mcRef;
setState(sSTATE_HIDDEN);
aBoughtItems = new Array();
}
function enterFrame() {
super.enterFrame();
oMax.enterFrame();
oDialog.enterFrame();
}
function buyItem(_oItem, _nSelected) {
if ((game.Player.nHUNGER_PARTS - _oItem.nHunger) < Main.__get__Instance().__get__game().__get__player().__get__hunger()) {
oDialog.setText(sNOT_HUNGRY_ENOUGH);
oDialog.setState(library.Popup.sSTATE_IN);
oDialog.__set__outFunction(library.Delegate.create(this, startSelection));
} else if (_oItem.nBones > Main.__get__Instance().__get__game().__get__player().__get__bones()) {
} else {
aTriggerSequence = new Array();
var _local3 = new Object({shop:sShop, item:_oItem.item});
aBoughtItems.push(_local3);
oDialog.setText(_oItem.description);
oDialog.setState(library.Popup.sSTATE_IN);
oDialog.__set__outFunction(library.Delegate.create(this, endMaxTalk, _nSelected, _oItem.item));
}
}
function endMaxTalk(_nSelected, _sItemShow) {
oMax.buyItem(_nSelected, _sItemShow);
}
function endMaxTakeItem(_nSelected) {
}
function endMaxBuy() {
Main.__get__Instance().__get__game().buyItem(aBoughtItems[aBoughtItems.length - 1]);
oDialog.setText(sBUY_ITEM);
oDialog.setState(library.Popup.sSTATE_IN);
oDialog.__set__outFunction(library.Delegate.create(this, startSelection));
}
function setShop(_sShop, _sPos, _aTrigger, _nHunger) {
setState(sSTATE_IDLE);
nHunger = _nHunger;
sShop = _sShop;
sPos = _sPos;
mcRef.mcBackground.gotoAndStop(sShop);
var _local3 = Math.max(Math.floor(_nHunger * mcRef.mcHunger._totalframes), 1);
mcRef.mcHunger.gotoAndStop(_local3);
oOptions = new game.shop.Options(mcRef.mcBackground, sShop, this);
oMax = new game.shop.ShopMax(mcRef.mcBackground.mcMax, library.Delegate.create(this, endMaxBuy), library.Delegate.create(this, endMaxTakeItem));
aTriggerSequence = _aTrigger;
var _local2 = aTriggerSequence.shift();
oDialog = new game.dialog.Dialog(mcRef.mcDialog, undefined, library.Delegate.create(this, endDialog));
oDialog.setText(_local2.sDialog);
oDialog.setState(library.Popup.sSTATE_IN);
oDialog.__set__outFunction(library.Delegate.create(this, startSelection));
}
function endDialog() {
if (aTriggerSequence.length > 0) {
oDialog.setText(aTriggerSequence.shift().sDialog);
} else {
var _local2 = oDialog.__get__Mc().mcState.txtText.text;
oDialog.setState(library.Popup.sSTATE_OUT);
oDialog.__get__Mc().mcState.mcState.txtText.text = _local2;
}
}
function startSelection() {
oOptions.startSelection();
}
function unsetShop() {
setState(sSTATE_HIDDEN);
}
function exitShop() {
Main.__get__Instance().__get__game().leaveShop(sShop);
}
var sNOT_HUNGRY_ENOUGH = "Oh come on Sam! You can't eat that, you'd burst open! ";
var sNOT_ENOUGH_BONES = "";
var sBUY_ITEM = "Here ya go! Anything else?";
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_IDLE = "Idle";
}
Symbol 371 MovieClip [__Packages.game.shop.ShopMax] Frame 0
class game.shop.ShopMax extends State
{
var setState, fIdleFunction, sState, mcRef, sItemShow, isStateComplete;
function ShopMax (_mcRef, _fIdleFunction) {
super(_mcRef);
setState(sSTATE_IDLE);
fIdleFunction = _fIdleFunction;
}
function loadState() {
if (!(sState === sSTATE_OFFERITEM)) {
} else {
mcRef.mcState.mcItem.gotoAndStop(sItemShow);
}
}
function doItem1() {
if (isStateComplete()) {
setState(sSTATE_OFFERITEM);
}
}
function doItem2() {
if (isStateComplete()) {
setState(sSTATE_OFFERITEM);
}
}
function doItem3() {
if (isStateComplete()) {
setState(sSTATE_OFFERITEM);
}
}
function doItem4() {
if (isStateComplete()) {
setState(sSTATE_OFFERITEM);
}
}
function doOfferItem() {
if (isStateComplete()) {
setState(sSTATE_IDLE);
fIdleFunction();
}
}
function buyItem(_nItem, _sItemShow) {
sItemShow = _sItemShow;
setState(sSTATE_ITEM + _nItem);
}
function get itemShow() {
return(sItemShow);
}
var sSTATE_IDLE = "Idle";
var sSTATE_ITEM = "Item";
var sSTATE_OFFERITEM = "OfferItem";
var sSTATE_HIDDEN = "Hidden";
}
Symbol 372 MovieClip [__Packages.game.shop.Options] Frame 0
class game.shop.Options extends library.Popup
{
var mcRef, oShop, aShopItems, oKey;
function Options (_mcRef, _sShop, _oShop) {
super();
mcRef = _mcRef;
oShop = _oShop;
addItems(_sShop);
hideSelection();
}
function addItems(_sShop) {
aShopItems = new Array();
var _local3 = dat.ShopData.getData(_sShop).aItems;
var _local4 = _local3.length;
var _local2;
_local2 = 0;
while (_local2 < _local4) {
aShopItems.push(dat.ItemData.getData(_local3[_local2]));
mcRef["mcItem" + (_local2 + 1)].gotoAndStop(aShopItems[_local2].item);
_local2++;
}
mcRef.mcItemExitSelect.onRollOver = library.Delegate.create(this, mouseOver, _local2 + 1);
}
function startSelection() {
nSelected = 1;
keyPress();
oKey = new Object();
oKey.onKeyDown = library.Delegate.create(this, keyPress);
Key.addListener(oKey);
var _local2;
_local2 = 0;
while (_local2 < NUMBER_TOTAL_OPTIONS) {
mcRef["mcItem" + (_local2 + 1)].onRollOver = library.Delegate.create(this, mouseOver, _local2 + 1);
mcRef["mcItem" + (_local2 + 1)].onRelease = library.Delegate.create(this, mousePress);
_local2++;
}
mcRef.mcItemExit.onRollOver = library.Delegate.create(this, mouseOver, NUMBER_TOTAL_OPTIONS + 1);
mcRef.mcItemExit.onRelease = library.Delegate.create(this, mousePress);
}
function mouseOver(_nSelected) {
showSelection(_nSelected);
}
function mousePress() {
enterSelection();
}
function keyPress() {
var _local2 = nSelected;
if (Key.isDown(37)) {
_local2--;
if (_local2 <= 0) {
_local2 = aShopItems.length + 1;
}
} else if (Key.isDown(39)) {
if (_local2 >= (aShopItems.length + 1)) {
_local2 = 0;
}
_local2++;
}
showSelection(_local2);
if (((Key.isDown(game.Player.nBUTTON_PUNCH) || (Key.isDown(game.Player.nBUTTON_KICK))) || (Key.isDown(game.Player.nBUTTON_JUMP))) || (Key.isDown(game.Player.nBUTTON_PAUSE))) {
enterSelection();
}
}
function showSelection(_nSelected) {
if (nSelected <= aShopItems.length) {
mcRef[("mcItem" + nSelected) + "Select"].gotoAndStop(sSTATE_HIDDEN);
mcRef["mcEffect" + nSelected]._visible = false;
} else {
mcRef.mcItemExitSelect.gotoAndStop(sSTATE_HIDDEN);
}
nSelected = _nSelected;
if (nSelected <= aShopItems.length) {
mcRef[("mcItem" + nSelected) + "Select"].gotoAndStop(sSTATE_IDLE);
mcRef["mcEffect" + nSelected]._visible = true;
var _local3 = "";
var _local2 = aShopItems[nSelected - 1];
mcRef["mcEffect" + nSelected].txtName.text = _local2.name;
mcRef["mcEffect" + nSelected].txtHunger.text = _local2.nHunger;
mcRef["mcEffect" + nSelected].txtEffect.text = "";
if (_local2.nHP != undefined) {
mcRef["mcEffect" + nSelected].txtEffect.text = mcRef["mcEffect" + nSelected].txtEffect.text + ((_local3 + "Health + ") + _local2.nHP);
_local3 = newline;
}
if (_local2.nPunchStr != undefined) {
mcRef["mcEffect" + nSelected].txtEffect.text = mcRef["mcEffect" + nSelected].txtEffect.text + ((_local3 + "Punch + ") + _local2.nPunchStr);
_local3 = newline;
}
if (_local2.nPunchDef != undefined) {
mcRef["mcEffect" + nSelected].txtEffect.text = mcRef["mcEffect" + nSelected].txtEffect.text + ((_local3 + "Resistance + ") + _local2.nPunchDef);
_local3 = newline;
}
if (_local2.nMaxHP != undefined) {
mcRef["mcEffect" + nSelected].txtEffect.text = mcRef["mcEffect" + nSelected].txtEffect.text + ((_local3 + "Max Health + ") + _local2.nMaxHP);
_local3 = newline;
}
} else {
mcRef.mcItemExitSelect.gotoAndStop(sSTATE_IDLE);
}
}
function enterSelection() {
if (nSelected == (aShopItems.length + 1)) {
oShop.exitShop();
} else {
oShop.buyItem(aShopItems[nSelected - 1], nSelected);
}
hideSelection();
}
function hideSelection() {
var _local2;
_local2 = 0;
while (_local2 < NUMBER_TOTAL_OPTIONS) {
mcRef[("mcItem" + (_local2 + 1)) + "Select"].gotoAndStop(sSTATE_HIDDEN);
mcRef["mcEffect" + (_local2 + 1)]._visible = false;
_local2++;
}
mcRef.mcItemExitSelect.gotoAndStop(sSTATE_HIDDEN);
Key.removeListener(oKey);
}
var NUMBER_TOTAL_OPTIONS = 4;
var nSelected = 1;
var sSTATE_IDLE = "Idle";
var sSTATE_HIDDEN = "Hidden";
}
Symbol 373 MovieClip [__Packages.dat.ShopData] Frame 0
class dat.ShopData
{
function ShopData () {
}
static function getData(_sShop) {
var _local1 = new Object();
_local1.aItems = new Array();
switch (_sShop) {
case STRING_SHOP1 :
_local1.name = "Test";
_local1.aItems.push(dat.ItemData.STRING_ITEM_1);
_local1.aItems.push(dat.ItemData.STRING_ITEM_2);
_local1.aItems.push(dat.ItemData.STRING_ITEM_3);
_local1.aItems.push(dat.ItemData.STRING_ITEM_4);
break;
case STRING_SHOP2 :
_local1.name = "Test2";
_local1.aItems.push("Item1");
_local1.aItems.push("Item2");
}
return(_local1);
}
static var STRING_SHOP1 = "Shop1";
static var STRING_SHOP2 = "Shop2";
}
Symbol 374 MovieClip [__Packages.dat.ItemData] Frame 0
class dat.ItemData
{
function ItemData () {
}
static function getData(_sItem) {
var _local1 = new Object();
switch (_sItem) {
case STRING_ITEM_1 :
_local1.name = "Item 1";
_local1.item = "Red";
_local1.description = "You won't believe how red it can get!";
_local1.nHunger = 1;
_local1.nBones = 100;
_local1.nHP = 50;
_local1.nMaxHungerPart = 0;
break;
case STRING_ITEM_2 :
_local1.name = "Item 2";
_local1.item = "Blue";
_local1.description = "It's 2! Righto!";
_local1.nHunger = 2;
_local1.nBones = 200;
_local1.nHP = 20;
_local1.nMaxHP = 20;
_local1.nMaxHungerPart = 15;
break;
case STRING_ITEM_3 :
_local1.name = "Item 3";
_local1.item = "Yellow";
_local1.description = "Let the sunshine in!";
_local1.nHunger = 4;
_local1.nBones = 450;
_local1.nPunchStr = 1;
_local1.nMaxHungerPart = 35;
break;
case STRING_ITEM_4 :
_local1.name = "Item 4";
_local1.item = "Green";
_local1.description = "Mean green!";
_local1.nHunger = 6;
_local1.nBones = 700;
_local1.nPunchStr = 1;
_local1.nPunchDef = 1;
_local1.nMaxHungerPart = 55;
break;
case STRING_ITEM_5 :
_local1.name = "Item 5";
}
_local1.nBones = 0;
return(_local1);
}
static var STRING_ITEM_1 = "Item1";
static var STRING_ITEM_2 = "Item2";
static var STRING_ITEM_3 = "Item3";
static var STRING_ITEM_4 = "Item4";
static var STRING_ITEM_5 = "Item5";
}
Symbol 375 MovieClip [__Packages.game.dialog.Dialog] Frame 0
class game.dialog.Dialog extends library.Popup
{
var fEndDialog, fEndDialogClick, setState, oTextManager, mcRef, __get__Mc;
function Dialog (_mcRef, _fEndDialog, _fEndDialogClick) {
super(_mcRef);
fEndDialog = _fEndDialog;
fEndDialogClick = _fEndDialogClick;
setState(library.Popup.sSTATE_HIDDEN);
oTextManager = new library.TextManager(undefined, library.Delegate.create(this, endDialog), library.Delegate.create(this, endDialogClick));
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case library.Popup.sSTATE_IN :
oTextManager.__set__setTxtField(mcRef.mcState.mcState.txtText);
mcRef.mcState.mcState.txtText.text = "";
mcRef.mcState.mcState.mcArrow._visible = false;
break;
case library.Popup.sSTATE_OUT :
oTextManager.__set__setTxtField(mcRef.mcState.mcState.txtText);
mcRef.mcState.mcState.mcArrow._visible = false;
break;
case library.Popup.sSTATE_IDLE :
oTextManager.start();
oTextManager.__set__setTxtField(mcRef.mcState.txtText);
mcRef.mcState.txtText = "";
mcRef.mcState.mcArrow._visible = false;
break;
case library.Popup.sSTATE_HIDDEN :
oTextManager.stop();
}
}
function doIdle() {
oTextManager.addText(false);
}
function setText(_sText) {
mcRef.mcState.mcArrow._visible = false;
oTextManager.setDialog(_sText, 1);
}
function endDialog() {
fEndDialog();
mcRef.mcState.mcArrow._visible = true;
}
function endDialogClick() {
fEndDialogClick();
}
function set Mc(_mcRef) {
mcRef = _mcRef;
setState(library.Popup.sSTATE_HIDDEN);
//return(__get__Mc());
}
}
Symbol 376 MovieClip [__Packages.library.TextManager] Frame 0
class library.TextManager
{
var txtField, endDialog, endDialogClick, sCurrentText, sTextToDisplay, nSpeed, nCurrentTotalLineCharCount, nCurrentLineCharCount, oKeyListener, oMouseListener, __get__setTxtField;
function TextManager (_txtField, _endDialog, _endDialogClick) {
txtField = _txtField;
endDialog = _endDialog;
endDialogClick = _endDialogClick;
sCurrentText = "";
}
function doKeyDown() {
if (((Key.isDown(32) || (Key.isDown(game.Player.nBUTTON_JUMP))) || (Key.isDown(game.Player.nBUTTON_PUNCH))) || (Key.isDown(game.Player.nBUTTON_KICK))) {
if (sTextToDisplay.length > 0) {
addText(true);
} else {
endDialogClick();
}
}
}
function doMouseDown() {
if (sTextToDisplay.length > 0) {
addText(true);
} else {
endDialogClick();
}
}
function addText(_bAll) {
var _local4 = Math.max(1, nSpeed);
if (_bAll) {
_local4 = sTextToDisplay.length;
}
var _local3;
var _local2;
_local2 = 0;
while (_local2 < _local4) {
if (sTextToDisplay.slice(_local2, _local2 + 1) == " ") {
_local3 = sTextToDisplay.indexOf(" ", _local2 + 1) - _local2;
if (_local3 < 0) {
_local3 = sTextToDisplay.length - _local2;
}
if ((nCurrentLineCharCount + _local3) >= nCurrentTotalLineCharCount) {
nCurrentLineCharCount = 0;
txtField.text = txtField.text + newline;
_local2++;
}
}
txtField.text = txtField.text + sTextToDisplay.slice(_local2, _local2 + 1);
nCurrentLineCharCount++;
_local2++;
}
sTextToDisplay = sTextToDisplay.slice(_local2);
if (sTextToDisplay == "") {
endDialog();
}
}
function setDialog(_sTextToDisplay, _nSpeed) {
if (_nSpeed != undefined) {
nSpeed = _nSpeed;
} else {
nSpeed = 1;
}
nCurrentLineCharCount = 0;
nCurrentTotalLineCharCount = nTOTAL_LINE_COUNT;
sTextToDisplay = _sTextToDisplay;
sCurrentText = _sTextToDisplay;
txtField.text = "";
}
function start() {
stop();
oKeyListener = new Object();
oKeyListener.onKeyDown = library.Delegate.create(this, doKeyDown);
Key.addListener(oKeyListener);
oMouseListener = new Object();
oMouseListener.onMouseDown = library.Delegate.create(this, doMouseDown);
Mouse.addListener(oMouseListener);
}
function stop() {
Key.removeListener(oKeyListener);
Mouse.removeListener(oMouseListener);
}
function get getTxtField() {
return(txtField);
}
function set setTxtField(_txtField) {
txtField = _txtField;
//return(__get__setTxtField());
}
static var nTOTAL_LINE_COUNT = 50;
}
Symbol 377 MovieClip [__Packages.game.Hud] Frame 0
class game.Hud
{
var mcRef, oStreet, oAchievement, sLocation, __get__location, nHealth;
function Hud (_mcRef) {
mcRef = _mcRef;
oStreet = new game.hud.Street(mcRef.mcStreet);
oAchievement = new game.hud.Achievement(mcRef.mcAchievement);
}
function enterFrame() {
oStreet.enterFrame();
oAchievement.enterFrame();
}
function set location(_sLocation) {
sLocation = _sLocation;
oStreet.setLocation(_sLocation);
//return(__get__location());
}
function setPlayer(_nHealth, _nMaxHealth, _sFace) {
var _local2 = 1;
nHealth = _nHealth;
while ((_nHealth >= (nHEALTH_PER_BAR / 2)) && (nTOTAL_BARS >= _local2)) {
mcRef["mcHealth" + _local2].gotoAndStop(sSTATE_FULL);
_nHealth = _nHealth - nHEALTH_PER_BAR;
_local2++;
}
if ((_nHealth > 0) && (nTOTAL_BARS >= _local2)) {
mcRef["mcHealth" + _local2].gotoAndStop(sSTATE_HALF);
_local2++;
}
while ((_nMaxHealth >= (_local2 * nHEALTH_PER_BAR)) && (nTOTAL_BARS >= _local2)) {
mcRef["mcHealth" + _local2].gotoAndStop(sSTATE_EMPTY);
_local2++;
}
while (nTOTAL_BARS >= _local2) {
mcRef["mcHealth" + _local2].gotoAndStop(sSTATE_NONE);
_local2++;
}
mcRef.mcFace.gotoAndStop(_sFace);
}
function setHunger(_nHunger) {
var _local2 = Math.max(Math.floor(_nHunger * mcRef.mcStomach._totalframes), 1);
mcRef.mcStomach.gotoAndStop(_local2);
}
function setBones(_nBones) {
mcRef.txtBones.text = _nBones;
}
function setEnnemy(_nHealth, _nMaxHealth, _sFace, _sName) {
var _local2 = 1;
while ((_nHealth >= (nHEALTH_PER_BAR / 2)) && (nTOTAL_BARS >= _local2)) {
mcRef["mcHealthEnnemy" + _local2].gotoAndStop(sSTATE_FULL);
_nHealth = _nHealth - nHEALTH_PER_BAR;
_local2++;
}
if ((_nHealth > 0) && (nTOTAL_BARS >= _local2)) {
mcRef["mcHealthEnnemy" + _local2].gotoAndStop(sSTATE_HALF);
_local2++;
}
while ((_nMaxHealth >= (_local2 * nHEALTH_PER_BAR)) && (nTOTAL_BARS >= _local2)) {
mcRef["mcHealthEnnemy" + _local2].gotoAndStop(sSTATE_EMPTY);
_local2++;
}
while (nTOTAL_BARS >= _local2) {
mcRef["mcHealthEnnemy" + _local2].gotoAndStop(sSTATE_NONE);
_local2++;
}
mcRef.mcFaceEnnemy.gotoAndStop(_sFace);
mcRef.txtName.text = _sName;
}
function showEnnemy(_bShow) {
var _local2 = 1;
while (nTOTAL_BARS >= _local2) {
mcRef["mcHealthEnnemy" + _local2].gotoAndStop(sSTATE_NONE);
_local2++;
}
mcRef.mcFaceEnnemy._visible = _bShow;
}
static var nHEALTH_PER_BAR = 20;
static var nTOTAL_BARS = 8;
static var sSTATE_FULL = "Full";
static var sSTATE_HALF = "Half";
static var sSTATE_EMPTY = "Empty";
static var sSTATE_NONE = "None";
}
Symbol 378 MovieClip [__Packages.game.hud.Street] Frame 0
class game.hud.Street extends library.Popup
{
var sStreet, setState, mcRef;
function Street (_mcRef) {
super(_mcRef);
sStreet = "";
setState(library.Popup.sSTATE_HIDDEN);
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case library.Popup.sSTATE_IN :
mcRef.mcState.mcState.mcLocation.txtLocation.text = sStreet;
break;
case library.Popup.sSTATE_OUT :
mcRef.mcState.mcState.mcLocation.txtLocation.text = sStreet;
break;
case library.Popup.sSTATE_IDLE :
setState(library.Popup.sSTATE_OUT);
break;
case library.Popup.sSTATE_HIDDEN :
}
}
function setLocation(_sStreet) {
sStreet = _sStreet;
setState(library.Popup.sSTATE_IN);
}
}
Symbol 379 MovieClip [__Packages.game.hud.Achievement] Frame 0
class game.hud.Achievement extends library.Popup
{
var sAchievement, setState, mcRef;
function Achievement (_mcRef) {
super(_mcRef);
sAchievement = "";
setState(library.Popup.sSTATE_HIDDEN);
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case library.Popup.sSTATE_IN :
mcRef.mcState.mcState.gotoAndStop(sAchievement);
break;
case library.Popup.sSTATE_OUT :
mcRef.mcState.mcState.gotoAndStop(sAchievement);
break;
case library.Popup.sSTATE_IDLE :
setState(library.Popup.sSTATE_OUT);
break;
case library.Popup.sSTATE_HIDDEN :
}
}
function setAchievement(_sAchievement) {
sAchievement = _sAchievement;
setState(library.Popup.sSTATE_IN);
}
}
Symbol 380 MovieClip [__Packages.game.DialogManager] Frame 0
class game.DialogManager extends library.Popup
{
var oChar1, oChar2, oDialog, setState, fMidFunction, mcRef, fOutFunction, nTalkingChar;
function DialogManager (_mcRef) {
super(_mcRef);
oChar1 = new game.dialog.DialogCharacter();
oChar2 = new game.dialog.DialogCharacter();
oDialog = new game.dialog.Dialog(_mcRef, library.Delegate.create(this, endText), library.Delegate.create(this, endDialogClick));
setState(library.Popup.sSTATE_HIDDEN);
}
function enterFrame() {
super.enterFrame();
oChar1.enterFrame();
oChar2.enterFrame();
oDialog.enterFrame();
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case library.Popup.sSTATE_IN :
fMidFunction = library.Delegate.create(Main.__get__Instance().__get__game(), Main.__get__Instance().__get__game().nextTrigger);
oChar1.__set__Mc(mcRef.mcChar1);
oChar2.__set__Mc(mcRef.mcChar2);
oDialog.__set__Mc(mcRef.mcDialog);
break;
case library.Popup.sSTATE_OUT :
fOutFunction = library.Delegate.create(Main.__get__Instance().__get__game(), Main.__get__Instance().__get__game().nextTrigger);
break;
case library.Popup.sSTATE_IDLE :
fMidFunction();
fMidFunction = undefined;
break;
case library.Popup.sSTATE_HIDDEN :
fOutFunction();
fOutFunction = undefined;
}
}
function setDialog(_sCharacter1, _sCharacter2) {
setState(library.Popup.sSTATE_IN);
oChar1.setCharacterIn(_sCharacter1);
oChar2.setCharacterIn(_sCharacter2);
oDialog.setState(library.Popup.sSTATE_IN);
}
function setText(_sDialog, _nTalkingChar) {
oDialog.setText(_sDialog);
nTalkingChar = _nTalkingChar;
if (_nTalkingChar == 1) {
oChar1.setState(game.dialog.DialogCharacter.sSTATE_TALKING);
} else {
oChar2.setState(game.dialog.DialogCharacter.sSTATE_TALKING);
}
}
function endText() {
if (nTalkingChar == 1) {
oChar1.setState(library.Popup.sSTATE_IDLE);
} else {
oChar2.setState(library.Popup.sSTATE_IDLE);
}
}
function endDialog() {
setState(library.Popup.sSTATE_OUT);
oChar1.setCharacterOut();
oChar2.setCharacterOut();
var _local2 = oDialog.__get__Mc().mcDialog.mcState.txtText.text;
oDialog.setState(library.Popup.sSTATE_OUT);
oDialog.__get__Mc().mcDialog.mcState.mcState.txtText.text = _local2;
}
function endDialogClick() {
Main.__get__Instance().__get__game().nextTrigger();
}
function enterCharacter(_nCharPos, _sCharacter) {
if (_nCharPos == 1) {
oChar1.setCharacterIn(_sCharacter, library.Delegate.create(Main.__get__Instance().__get__game(), Main.__get__Instance().__get__game().nextTrigger));
} else {
oChar2.setCharacterIn(_sCharacter, library.Delegate.create(Main.__get__Instance().__get__game(), Main.__get__Instance().__get__game().nextTrigger));
}
}
function exitCharacter(_nCharPos) {
if (_nCharPos == 1) {
oChar1.setCharacterOut(library.Delegate.create(Main.__get__Instance().__get__game(), Main.__get__Instance().__get__game().nextTrigger));
} else {
oChar2.setCharacterOut(library.Delegate.create(Main.__get__Instance().__get__game(), Main.__get__Instance().__get__game().nextTrigger));
}
}
}
Symbol 381 MovieClip [__Packages.game.dialog.DialogCharacter] Frame 0
class game.dialog.DialogCharacter extends library.Popup
{
var setState, mcRef, sCharacter, fMidFunction, sState, fOutFunction, __get__Mc;
function DialogCharacter (_mcRef) {
super.Popup(_mcRef);
setState(library.Popup.sSTATE_HIDDEN);
}
function loadState(_sState) {
super.loadState(_sState);
switch (_sState) {
case library.Popup.sSTATE_IN :
case library.Popup.sSTATE_OUT :
mcRef.mcState.mcChar.gotoAndStop(sCharacter);
break;
case library.Popup.sSTATE_IDLE :
case sSTATE_TALKING :
mcRef.mcChar.gotoAndStop(sCharacter);
}
}
function setCharacterIn(_sCharacter, _fTrigger) {
sCharacter = _sCharacter;
setState(library.Popup.sSTATE_IN);
fMidFunction = _fTrigger;
}
function setCharacterOut(_fTrigger) {
if (sState != library.Popup.sSTATE_HIDDEN) {
setState(library.Popup.sSTATE_OUT);
fOutFunction = _fTrigger;
}
}
function set Mc(_mcRef) {
mcRef = _mcRef;
setState(library.Popup.sSTATE_HIDDEN);
//return(__get__Mc());
}
static var sSTATE_TALKING = "Talking";
}
Symbol 382 MovieClip [__Packages.dat.TriggerData] Frame 0
class dat.TriggerData
{
function TriggerData () {
}
static function getTrigger(_sTrigger) {
var _local1 = new Array();
switch (_sTrigger) {
case sGAME_START :
_local1.push({nType:nTYPE_SHOW_CUTSCENE, sCutscene:"Start"});
_local1.push({nType:nTYPE_SET_DIALOG, sCharacter1:sCHARACTER_NONE, sCharacter2:sCHARACTER_SAM});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"Hi and welcome to the game. Before you begin this short prototype, here's a rundown of the controls."});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"Use the arrows to move, A to punch, S to do a dick strike and D to jump. You may also run by double tapping in a direction."});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"To exit this room and move to the next, just go to the far left. You may switch between the city and the docks to continue fighting ennemies."});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"This is a prototype so there might be bugs. I do apologise for that, but this is in no way a finished product and besides, it's free!"});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"But as added bonus, you can go punch and slap me, the programmer, around in the third room, and I'll just stand there taking it."});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"That's it! Enjoy the game and be sure to comment!"});
_local1.push({nType:nTYPE_END_DIALOG});
_local1.push({nType:nTYPE_START_GAME});
break;
case sFIRST_SHOP :
_local1.push({nType:nTYPE_DIALOG, nTalk:1, sDialog:"Hi Sam! Welcome to my shop! Do you like it?"});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"Hey little buddy. What are you doing here?"});
_local1.push({nType:nTYPE_DIALOG, nTalk:1, sDialog:"I can't tell you that Sam. It's a secret. All I can say is that it involves the FBI, a can of tuna and a fart at a bad time."});
break;
case sAFTER_FIRST_SHOP :
_local1.push({nType:nTYPE_DIALOG, nTalk:1, sDialog:"See anything you like?"});
break;
case sTRIGGER_STREET1START :
_local1.push({nType:nTYPE_SET_DIALOG, sCharacter1:sCHARACTER_SAM, sCharacter2:sCHARACTER_NONE});
_local1.push({nType:nTYPE_DIALOG, nTalk:1, sDialog:"Bahamut. I should have known. It's you. It was you all along."});
_local1.push({nType:nTYPE_ENTER_DIALOG_CHARACTER, nChar:2, sCharacter:sCHARACTER_BAHAMUT});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"Yes. I was the one who made it all possible."});
_local1.push({nType:nTYPE_DIALOG, nTalk:1, sDialog:"Fiend. I shall never succomb to your wicked ways. Is such is what you await, then deception be your reward!"});
_local1.push({nType:nTYPE_DIALOG, nTalk:2, sDialog:"I grow weary of you. Defend yourself!"});
_local1.push({nType:nTYPE_EXIT_DIALOG_CHARACTER, nChar:2});
_local1.push({nType:nTYPE_DIALOG, nTalk:1, sDialog:"Bring it, dragon breath!"});
_local1.push({nType:nTYPE_END_DIALOG});
}
return(_local1);
}
static var nTYPE_SET_DIALOG = 1;
static var nTYPE_DIALOG = 2;
static var nTYPE_ENTER_DIALOG_CHARACTER = 3;
static var nTYPE_EXIT_DIALOG_CHARACTER = 4;
static var nTYPE_END_DIALOG = 5;
static var nTYPE_START_GAME = 6;
static var nTYPE_SHOW_CUTSCENE = 7;
static var sCHARACTER_NONE = "None";
static var sCHARACTER_SAM = "Sam";
static var sCHARACTER_BAHAMUT = "Bahamut";
static var sFIRST_SHOP = "FirstShop";
static var sAFTER_FIRST_SHOP = "AfterFirstShop";
static var sTRIGGER_STREET1START = "Street1Start";
static var sGAME_START = "GameStart";
}
Symbol 31 MovieClip Frame 1
this._visible = false;
Symbol 35 MovieClip Frame 1
this._visible = false;
Symbol 195 MovieClip Frame 1
stop();
this.hitArea = mcHitArea;
Symbol 352 MovieClip Frame 1
_global.tick = 0;
_global.timer = getTimer();
this.onEnterFrame = function () {
_global.tick++;
txtFrames.text = _global.tick / ((getTimer() - _global.timer) / 1000);
if (_global.tick >= 100) {
_global.timer = getTimer();
_global.tick = 0;
}
};