Frame 1
Stage.showMenu = false;
Frame 6
var time = 75000;
var i = 0;
while (i < 20) {
_root["SCORE" + (19 - i)] = (i * 50) + 50;
i++;
}
stop();
Instance of Symbol 104 MovieClip "mcPad" in Frame 6
/* no clip actions */
Frame 11
function startGame() {
var myMap1 = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
var tileManagerInit = {path:_root, ref:"mcTile", obCreateTiles:{arrMaster:[myMap1], arrMoving:[[]]}};
var heroInit = {sp:2, x:1, y:4, xTile:1, yTile:4, width:8, height:11, gravity:1.5, jumpStart:-16, jump:false, climbing:false, climbSpeed:2};
var e1 = {sp:0.5, type:"samurai", xTile:4, yTile:3, turn:25, lastDir:"R"};
var e2 = {sp:0.5, type:"samurai", xTile:5, yTile:5, turn:50, lastDir:"L"};
var e5 = {sp:0.5, type:"samurai", xTile:6, yTile:6, turn:40, lastDir:"R"};
var e3 = {sp:0.5, type:"samurai", xTile:5, yTile:2, turn:40, lastDir:"R"};
var e4 = {sp:0.5, type:"samurai", xTile:7, yTile:4, turn:80, lastDir:"L"};
var enemyManagerInit = {arrRooms:[[e1, e2, e3, e4, e5]]};
var propManagerInit = {arrProps:[[]]};
var game = mvc_specific.MVC.main({lives:1, tileManagerInit:tileManagerInit, heroInit:heroInit, enemyManagerInit:enemyManagerInit, propManagerInit:propManagerInit, arrLevelStart:arrLevelStart, time:time});
return(game);
}
var myLog = org.fivepecks.logger.Logger.getInstance();
myLog.level = "debug";
myLog.setOutputWindowView(true);
resetGame = function () {
for (var prop in _root) {
removeMovieClip(_root[prop]);
}
};
mainStart = function () {
stopAllSounds();
name = "";
game = startGame();
this.onEnterFrame = function () {
game.mvc_controller.updateModel();
};
};
mainStart();
stop();
Frame 17
btnMain.onRelease = function () {
stopAllSounds();
resetGame();
gotoAndStop ("title");
};
btnHunt.onRelease = function () {
resetGame();
gotoAndStop ("game");
};
Frame 27
btnMain.onRelease = function () {
stopAllSounds();
resetGame();
gotoAndStop ("title");
};
btnHunt.onRelease = function () {
resetGame();
gotoAndStop ("game");
};
Frame 37
btnMain.onRelease = function () {
stopAllSounds();
resetGame();
gotoAndStop ("title");
};
btnHunt.onRelease = function () {
resetGame();
gotoAndStop ("game");
};
Frame 47
btnMain.onRelease = function () {
stopAllSounds();
resetGame();
gotoAndStop ("title");
};
btnHunt.onRelease = function () {
resetGame();
gotoAndStop ("game");
};
Instance of Symbol 7 MovieClip "preloadBar" in Symbol 8 MovieClip Frame 1
onClipEvent (enterFrame) {
var loadedSoFar = _root.getBytesLoaded();
if (loadedSoFar >= loadTotal) {
this.onEnterFrame = null;
_root.gotoAndStop("title");
} else {
var percent = Math.round((loadedSoFar / loadTotal) * 100);
_xscale = percent;
_parent.percentText.text = percent;
}
}
onClipEvent (load) {
var loadTotal = _root.getBytesTotal();
}
Symbol 175 MovieClip [__Packages.org.fivepecks.logger.Logger] Frame 0
class org.fivepecks.logger.Logger
{
static var _inst;
var _outputWinView, addEventListener, removeEventListener, _LCView, dispatchEvent;
function Logger () {
mx.events.EventDispatcher.initialize(this);
if (_global.log == undefined) {
_global.log = this;
}
_global.fplog = this;
}
static function getInstance() {
if (_inst == null) {
_inst = new org.fivepecks.logger.Logger();
}
return(_inst);
}
function get level() {
return(_logLevels[_logLevel]);
}
function set level(l) {
var len = _logLevels.length;
var i = 0;
while (i < len) {
if (_logLevels[i].toLowerCase() == l.toLowerCase()) {
_logLevel = i;
info(((("Log level set to " + _logLevels[_logLevel]) + " (") + _logLevel) + ")");
return;
}
i++;
}
warn("Invalid log level specified.");
//return(level);
}
function setLevel(l) {
level = (l);
}
function getLevel() {
return(level);
}
function setOutputWindowView(enableView) {
if (enableView) {
if (_outputWinView == undefined) {
_outputWinView = new org.fivepecks.logger.OutputWindowView();
}
addEventListener("logMessage", _outputWinView);
} else if (_outputWinView != undefined) {
removeEventListener("logMessage", _outputWinView);
}
}
function setLCView(enableView) {
if (enableView) {
if (_LCView == undefined) {
_LCView = new org.fivepecks.logger.LCView(this);
}
addEventListener("logMessage", _LCView);
} else if (_LCView != undefined) {
removeEventListener("logMessage", _LCView);
delete _LCView;
}
}
function fatal(msg) {
if (_logLevel >= 0) {
sendLogMessage(msg, "FATAL");
}
}
function error(msg) {
if (_logLevel >= 1) {
sendLogMessage(msg, "ERROR");
}
}
function warn(msg) {
if (_logLevel >= 2) {
sendLogMessage(msg, "WARN");
}
}
function info(msg) {
if (_logLevel >= 3) {
sendLogMessage(msg, "INFO");
}
}
function debug(msg) {
if (_logLevel >= 4) {
sendLogMessage(msg, "DEBUG");
}
}
function sendLogMessage(msg, lvl) {
var eventObj = {target:this, type:"logMessage"};
eventObj.message = msg;
eventObj.level = lvl;
dispatchEvent(eventObj);
}
var _logLevel = 3;
var _logLevels = ["FATAL", "ERROR", "WARN", "INFO", "DEBUG"];
}
Symbol 176 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var l = queue.length;
var i;
i = 0;
while (i < l) {
var o = queue[i];
if (o == handler) {
queue.splice(i, 1);
return(undefined);
}
i++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var queueName = ("__q_" + eventObj.type);
var queue = queueObj[queueName];
if (queue != undefined) {
var i;
for (i in queue) {
var o = queue[i];
var oType = typeof(o);
if ((oType == "object") || (oType == "movieclip")) {
if (o.handleEvent != undefined) {
o.handleEvent(eventObj);
}
if (o[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
o[eventObj.type](eventObj);
}
}
} else {
o.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var queueName = ("__q_" + event);
if (this[queueName] == undefined) {
this[queueName] = new Array();
}
_global.ASSetPropFlags(this, queueName, 1);
_removeEventListener(this[queueName], event, handler);
this[queueName].push(handler);
}
function removeEventListener(event, handler) {
var queueName = ("__q_" + event);
_removeEventListener(this[queueName], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 177 MovieClip [__Packages.org.fivepecks.logger.OutputWindowView] Frame 0
class org.fivepecks.logger.OutputWindowView
{
function OutputWindowView () {
}
function logMessage(evtObj) {
trace((evtObj.level + ": ") + evtObj.message);
}
}
Symbol 178 MovieClip [__Packages.org.fivepecks.logger.LCView] Frame 0
class org.fivepecks.logger.LCView
{
var _log, _outgoingConnectionName, _incomingConnectionName, _incoming_lc, _outgoing_lc;
function LCView (controllingLog) {
_log = controllingLog;
var swfName = "";
var wholeURL = _root._url;
var tempArray = wholeURL.split("/");
var tempName = tempArray.pop();
if (tempName.indexOf("\\") == -1) {
swfName = tempName;
} else {
var tempArray2 = tempName.split("\\");
swfName = tempArray2.pop();
}
swfName = unescape(swfName);
_outgoingConnectionName = swfName + "_log_lc";
_incomingConnectionName = swfName + "_feedback_lc";
_incoming_lc = new LocalConnection();
_incoming_lc.controller = this;
_incoming_lc.changeLevel = function (newLevel) {
this.controller._log.setLevel(newLevel);
};
_incoming_lc.connect(_incomingConnectionName);
}
function logMessage(evtObj) {
var lvl = evtObj.level;
var msg = evtObj.message;
_outgoing_lc = new LocalConnection();
_outgoing_lc.send(_outgoingConnectionName, "logMessage", lvl, msg);
}
}
Symbol 179 MovieClip [__Packages.mvc_specific.MVC] Frame 0
class mvc_specific.MVC
{
var mvc_model, mvc_controller, mvc_view;
function MVC (tOb) {
mvc_model = new mvc_specific.MVCModel(tOb);
mvc_controller = new mvc_specific.MVCController(mvc_model);
mvc_view = new mvc_specific.MVCView(mvc_model, mvc_controller);
mvc_model.addObserver(mvc_view);
}
static function main(tOb) {
var mvc = (new mvc_specific.MVC(tOb));
mvc.mvc_model.initializeView();
mvc.mvc_model.switchMap(0);
return(mvc);
}
static var log = org.fivepecks.logger.Logger.getInstance();
}
Symbol 180 MovieClip [__Packages.util.Observable] Frame 0
class util.Observable
{
var observers;
function Observable () {
observers = new Array();
}
function addObserver(o) {
if (o == null) {
return(false);
}
var i = 0;
while (i < observers.length) {
if (observers[i] == o) {
return(false);
}
i++;
}
observers.push(o);
return(true);
}
function removeObserver(o) {
var len = observers.length;
var i = 0;
while (i < len) {
if (observers[i] == o) {
observers.splice(i, 1);
return(true);
}
i++;
}
return(false);
}
function notifyObservers(infoObj) {
if (infoObj == undefined) {
infoObj = null;
}
if (!changed) {
return(undefined);
}
var observersSnapshot = observers.slice(0);
clearChanged();
var i = (observersSnapshot.length - 1);
while (i >= 0) {
observersSnapshot[i].update(this, infoObj);
i--;
}
}
function clearObservers() {
observers = new Array();
}
function setChanged() {
changed = true;
}
function clearChanged() {
changed = false;
}
function hasChanged() {
return(changed);
}
function countObservers() {
return(observers.length);
}
var changed = false;
}
Symbol 181 MovieClip [__Packages.util.Observer] Frame 0
interface util.Observer
{
}
Symbol 182 MovieClip [__Packages.mvc_specific.MVCModel] Frame 0
class mvc_specific.MVCModel extends util.Observable
{
var scoreURL, points, curMap, tileManager, hero, enemyManager, propManager, weaponManager, time, clock, clockListener, setChanged, notifyObservers, curLevel, arrLevelStart;
function MVCModel (tOb) {
super();
scoreURL = tOb.scoreURL;
points = 0;
curMap = 0;
createChildren(tOb);
}
function createChildren(tOb) {
var tileInit = tOb.tileManagerInit;
tileInit.tileH = tileH;
tileInit.tileW = tileW;
tileManager = new tile.TileManager(tileInit);
var heroInit = tOb.heroInit;
heroInit.tileH = tileH;
heroInit.tileW = tileW;
heroInit.model = this;
heroInit.tileManager = tileManager;
heroInit.x = (heroInit.x * tileW) + (tileW / 2);
heroInit.y = (heroInit.y * tileH) + (tileH / 2);
hero = new characters.Hero(tOb.heroInit);
hero.move(1, 0, 0);
var enemyInit = tOb.enemyManagerInit;
enemyInit.tileH = tileH;
enemyInit.tileW = tileW;
enemyInit.hero = hero;
enemyInit.model = this;
enemyInit.tileManager = tileManager;
enemyManager = new characters.EnemyManager(enemyInit);
var propInit = tOb.propManagerInit;
propInit.tileH = tileH;
propInit.tileW = tileW;
propInit.hero = hero;
propInit.model = this;
propManager = new props.PropManager(propInit);
var weaponInit = {};
weaponInit.tileH = tileH;
weaponInit.tileW = tileW;
weaponInit.hero = hero;
weaponInit.model = this;
weaponInit.tileManager = tileManager;
var max = tileManager.arrTiles.length;
var arrWeapons = [];
while (max--) {
var arrTmp = [];
arrWeapons.push(arrTmp);
}
weaponInit.arrWeapons = arrWeapons;
weaponManager = new weapons.WeaponManager(weaponInit);
time = tOb.time;
clock = new timer.TimerDownEvent(time);
clockListener = {model:this};
clockListener.timerFinished = function () {
this.model.update([this.model.points, this.model.clock.displayTime(), this.model.hero, this.model.enemyManager.arrCurrentEnemies, this.model.tileManager.arrCurrentMovingTiles, this.model.weaponManager.arrCurrentWeapons], "end");
};
clock.addEventListener("timerFinished", clockListener);
clock.startClock();
}
function initializeView() {
var infoObj = {msg:"initialize", arrCurrentTiles:tileManager.arrCurrentTiles, hero:hero, scoreURL:scoreURL};
setChanged();
notifyObservers(infoObj);
}
function restart(str) {
if (str == "nextLevel") {
curLevel++;
}
weaponManager.clearAllWeapons();
switchMap(arrLevelStart[curLevel].map);
resetHeroPos(curLevel);
}
function resetHeroPos(num) {
hero.x = (arrLevelStart[num].xTile * tileW) + (tileW / 2);
hero.y = (arrLevelStart[num].yTile * tileH) + (tileH / 2);
hero.move(0, 1, 0);
}
function switchMap(num) {
var arrLastMovingTiles = tileManager.arrCurrentMovingTiles;
var arrLastEnemies = enemyManager.arrCurrentEnemies;
var arrLastProps = propManager.arrCurrentProps;
var arrLastItems = tileManager.arrCurrentItems;
var arrLastWeapons = weaponManager.arrCurrentWeapons;
tileManager.switchMap(num);
enemyManager.switchMap(num);
propManager.switchMap(num);
weaponManager.switchMap(num);
var infoObj = {msg:"switchMap", arrCurrentTiles:tileManager.arrCurrentTiles, arrCurrentEnemies:enemyManager.arrCurrentEnemies, arrCurrentProps:propManager.arrCurrentProps, arrCurrentMovingTiles:tileManager.arrCurrentMovingTiles, arrCurrentWeapons:weaponManager.arrCurrentWeapons, arrLastWeapons:arrLastWeapons, arrCurrentItems:tileManager.arrCurrentItems, arrLastMovingTiles:arrLastMovingTiles, arrLastEnemies:arrLastEnemies, arrLastProps:arrLastProps, arrLastItems:arrLastItems};
setChanged();
notifyObservers(infoObj);
}
function detectKeys() {
var keyPressed = false;
var ob = hero;
if (Key.isDown(32) && (!lastSpaceBar)) {
lastSpaceBar = true;
ob.useWeapon();
} else if (Key.isDown(38)) {
keyPressed = ob.move(0, -1);
} else if (Key.isDown(40)) {
keyPressed = ob.move(0, 1);
} else if (Key.isDown(39)) {
keyPressed = ob.move(1, 0);
} else if (Key.isDown(37)) {
keyPressed = ob.move(-1, 0);
}
if (!Key.isDown(32)) {
lastSpaceBar = false;
}
ob.keyPressed = keyPressed;
update([points, clock.displayTime(), hero, enemyManager.arrCurrentEnemies, tileManager.arrCurrentMovingTiles, weaponManager.arrCurrentWeapons]);
}
function updateObjects() {
weaponManager.move();
enemyManager.move();
propManager.checkProps();
update([points, clock.displayTime(), hero, enemyManager.arrCurrentEnemies, tileManager.arrCurrentMovingTiles, weaponManager.arrCurrentWeapons, propManager.arrCurrentProps]);
}
function updateSound(strSound) {
update([strSound], "doSound");
}
function update(arrObjects, msg) {
var infoObj;
infoObj = {msg:((msg == undefined) ? "update" : (msg)), arrObjects:arrObjects};
setChanged();
notifyObservers(infoObj);
}
function addWeapon(weapon) {
var infoObj = {msg:"addWeapon", weapon:weapon};
setChanged();
notifyObservers(infoObj);
}
function addNewEnemy(enemy) {
var infoObj = {msg:"addNewEnemy", enemy:enemy};
setChanged();
notifyObservers(infoObj);
}
function removeClip(clip) {
var infoObj = {msg:"removeClip", clip:clip};
setChanged();
notifyObservers(infoObj);
}
function resetWeapons(arrWeapons) {
var infoObj = {msg:"resetWeapons", arrWeapons:arrWeapons};
setChanged();
notifyObservers(infoObj);
}
function victimDie(enemy) {
enemy.killed = true;
updateSound("scream");
updateScore();
}
function updateScore() {
points = points + 10;
}
static var log = org.fivepecks.logger.Logger.getInstance();
var tileH = 30;
var tileW = 30;
var numLevel = 0;
var lastSpaceBar = true;
var name = "MVCModel";
}
Symbol 183 MovieClip [__Packages.tile.TileManager] Frame 0
class tile.TileManager
{
var tileW, tileH, lastMap, curMap;
function TileManager (tOb) {
tileW = tOb.tileW;
tileH = tOb.tileH;
create(tOb);
}
function create(tOb) {
var arrMaster = tOb.obCreateTiles.arrMaster;
var arrMoving = tOb.obCreateTiles.arrMoving;
var maxxx = arrMaster.length;
while (maxxx--) {
var arr = arrMaster[maxxx];
var max = arr.length;
var arrTmpRoom = new Array();
var arrTmpItem = new Array();
while (max--) {
var maxx = arr[max].length;
var arrTmp = new Array();
while (maxx--) {
var tile = createTile(arr[max][maxx], max, maxx);
arrTmp.unshift(tile);
if (tile.type != undefined) {
arrTmpItem.unshift({type:tile.type, x:maxx * tileW, y:max * tileH});
}
}
arrTmpRoom.unshift(arrTmp);
}
arrTiles.unshift(arrTmpRoom);
arrItems.unshift(arrTmpItem);
}
var max = arrMoving.length;
while (max--) {
arrTmpRoom = [];
var maxx = arrMoving[max].length;
while (maxx--) {
arrTmpRoom.unshift(createMovingTile(arrMoving[max][maxx]));
}
arrMovingTiles.unshift(arrTmpRoom);
}
arrCurrentTiles = arrTiles[0];
arrCurrentItems = arrItems[0];
arrCurrentMovingTiles = arrMovingTiles[0];
}
function createTile(num, max, maxx) {
var obTile = {};
switch (num) {
case 0 :
obTile = {walkable:true, frame:1};
break;
case 1 :
obTile = {walkable:false, frame:2};
break;
case 2 :
obTile = {walkable:true, frame:3, door:true, type:2, map:1, xTile:1, yTile:10};
break;
case 3 :
obTile = {walkable:true, frame:3, door:true, type:3, map:0, xTile:14, yTile:9};
break;
case 4 :
obTile = {walkable:true, frame:4, cloud:true};
break;
case 5 :
obTile = {walkable:true, frame:5, cloud:true};
break;
case 6 :
obTile = {walkable:true, frame:6, cloud:true};
break;
case 7 :
obTile = {walkable:true, frame:3, type:7, door:true, map:2, xTile:1, yTile:4};
break;
case 8 :
obTile = {walkable:true, frame:3, type:8, door:true, map:1, xTile:14, yTile:9};
break;
case 9 :
obTile = {walkable:false, frame:2, ladder:true, type:"ladder"};
break;
case 10 :
obTile = {walkable:true, frame:1, ladder:true, type:"ladder"};
break;
case 11 :
obTile = {walkable:true, frame:1, ladder:true, type:"vine"};
break;
case 12 :
obTile = {walkable:true, frame:3, type:12, door:true, map:3, xTile:1, yTile:4};
break;
case 13 :
obTile = {walkable:true, frame:3, type:13, door:true, map:2, xTile:14, yTile:4};
}
obTile.name = (("t_" + max) + "_") + maxx;
return(obTile);
}
function createMovingTile(tile) {
switch (tile.type) {
case "verticalWide" :
tile.width = tileW * 2;
tile.height = tileH / 2;
break;
case "vertical" :
tile.width = tileW;
tile.height = tileH / 2;
break;
case "horizontalWide" :
tile.width = tileW * 2;
tile.height = tileH / 2;
break;
case "horizontal" :
tile.width = tileW;
tile.height = tileH / 2;
}
tile.tileMax = tile.tileMax * tileW;
tile.tileMin = tile.tileMin * tileW;
tile.x = tile.xTile * tileW;
tile.y = tile.yTile * tileH;
tile.tileH = tileH;
tile.tileW = tileW;
tile.yMax = tile.y + tile.height;
tile.yMin = tile.y;
tile.xMax = tile.x + tile.width;
tile.xMin = tile.x;
tile.lastX = tile.x;
return(tile);
}
function switchMap(num) {
lastMap = curMap;
curMap = num;
arrCurrentItems = arrItems[curMap];
arrCurrentTiles = arrTiles[curMap];
arrCurrentMovingTiles = arrMovingTiles[curMap];
}
function moveMovingTiles(char) {
var max = arrCurrentMovingTiles.length;
while (max--) {
var tile = arrCurrentMovingTiles[max];
with (tile) {
if ((tile.type == "vertical") || (tile.type == "verticalWide")) {
var step = ((y = y + (sp * dirY)));
if ((step > tileMin) && (step < tileMax)) {
y = step;
} else {
y = ((dirY == 1) ? (tileMax) : (tileMin));
dirY = -dirY;
}
} else {
var step = ((x = x + (sp * dirX)));
if ((step > tileMin) && (step < tileMax)) {
lastX = sp * dirX;
x = step;
} else {
x = ((dirX == 1) ? (tileMax) : (tileMin));
dirX = -dirX;
}
}
yMax = y + height;
yMin = y - height;
xMax = x + width;
xMin = x;
}
var charYMax = (char.y + char.height);
var charYMin = (char.y - char.height);
var charXMax = (char.x + char.width);
var charXMin = (char.x - char.width);
char.movingTile = undefined;
if ((tile.type == "verticalWide") || (tile.type == "vertical")) {
if ((charXMax >= tile.xMin) && (charXMin <= tile.xMax)) {
if (charYMax <= tile.yMax) {
if (charYMax >= tile.y) {
if ((char.jumpDir >= 0) && (!char.jump)) {
char.y = tile.y - (char.height * 0.5);
char.movingTile = tile;
} else if (char.jump && (char.jumpDir == 1)) {
char.jump = false;
char.y = tile.y - (char.height * 0.5);
char.movingTile = tile;
}
}
}
}
} else if ((charYMax >= tile.yMin) && (charYMax <= tile.yMax)) {
if (charXMax >= tile.x) {
if (charXMin <= tile.xMax) {
if ((char.jumpDir >= 0) && (!char.jump)) {
char.x = char.x + tile.lastX;
char.movingTile = tile;
} else if (char.jump && (char.jumpDir == 1)) {
char.jump = false;
char.x = char.x + tile.lastX;
char.y = tile.y - char.height;
char.movingTile = tile;
}
}
}
}
}
}
static var log = org.fivepecks.logger.Logger.getInstance();
var arrCurrentTiles = new Array();
var arrTiles = new Array();
var arrCurrentMovingTiles = new Array();
var arrMovingTiles = new Array();
var arrItems = new Array();
var arrCurrentItems = new Array();
}
Symbol 184 MovieClip [__Packages.characters.EnemyManager] Frame 0
class characters.EnemyManager
{
var tileW, tileH, hero, model, tileManager;
function EnemyManager (tOb) {
tileW = tOb.tileW;
tileH = tOb.tileH;
hero = tOb.hero;
model = tOb.model;
tileManager = tOb.tileManager;
create(tOb.arrRooms);
arrCurrentEnemies = arrEnemies[0];
}
function create(arrMaster) {
var max = arrMaster.length;
while (max--) {
var maxx = arrMaster[max].length;
var arrTmp = [];
while (maxx--) {
var enemy = arrMaster[max][maxx];
var enemyType = enemy.type;
enemy.width = 13;
enemy.height = 16;
enemy.tileH = tileH;
enemy.tileW = tileW;
enemy.x = (enemy.xTile * tileW) + (tileW / 2);
enemy.y = (enemy.yTile * tileH) + (tileH / 2);
enemy.hero = hero;
enemy.hitRadius = enemy.height * 1.5;
enemy.model = model;
enemy.tileManager = tileManager;
var tmp;
tmp = new characters.Enemy(enemy);
arrTmp.unshift(tmp);
}
arrEnemies.unshift(arrTmp);
}
return(true);
}
function switchMap(num) {
var max = arrCurrentEnemies.length;
while (max--) {
removeMovieClip(arrCurrentEnemies[max].id);
}
arrCurrentEnemies = arrEnemies[num];
var max = arrCurrentEnemies.length;
while (max--) {
var enemy = arrCurrentEnemies[max];
}
}
function move() {
var max = arrCurrentEnemies.length;
while (max--) {
var enemy = arrCurrentEnemies[max];
if (enemy.killed && (!enemy.offScreen)) {
enemy.die();
} else if (enemy.killed && (enemy.offScreen)) {
removeEnemy(enemy);
addNewEnemy();
} else {
enemy.move();
}
}
}
function removeEnemy(enemy) {
var max = arrCurrentEnemies.length;
while (max--) {
if (arrCurrentEnemies[max].id == enemy.id) {
model.removeClip(enemy.id);
delete eval (arrCurrentEnemies.splice(max, 1));
}
}
}
function addNewEnemy() {
var enemy = {type:"samurai"};
enemy.sp = Math.random() + 0.1;
enemy.xTile = Math.ceil(Math.random() * 7);
enemy.yTile = Math.ceil(Math.random() * 6);
enemy.turn = Math.ceil((Math.random() * 120) + 60);
var dir = ((Math.floor(Math.random() * 2) == 1) ? 1 : -1);
enemy.dirX = dir;
enemy.lastDir = "L";
enemy.width = 13;
enemy.height = 16;
enemy.tileH = tileH;
enemy.tileW = tileW;
enemy.x = (enemy.xTile * tileW) + (tileW / 2);
enemy.y = (enemy.yTile * tileH) + (tileH / 2);
enemy.hero = hero;
enemy.hitRadius = enemy.height * 1.5;
enemy.model = model;
enemy.tileManager = tileManager;
var tmp = (new characters.Enemy(enemy));
model.addNewEnemy(tmp);
arrCurrentEnemies.push(tmp);
}
static var log = org.fivepecks.logger.Logger.getInstance();
var arrCurrentEnemies = new Array();
var arrEnemies = new Array();
var name = "EnemyManager";
}
Symbol 185 MovieClip [__Packages.characters.Character] Frame 0
class characters.Character
{
var tileH, tileW, model, tileManager, x, y, sp, xTile, yTile, width, height, dirX, hero, turn, type, lastDir, hitRadius, downY, upY, leftX, rightX, upLeft, downLeft, upRight, downRight, yDist, xDist, jumpSpeed, gravity, climbing, jump, climbSpeed, dirWeapon;
function Character (tOb) {
tileH = tOb.tileH;
tileW = tOb.tileW;
model = tOb.model;
tileManager = tOb.tileManager;
x = tOb.x;
y = tOb.y;
sp = tOb.sp;
xTile = tOb.xTile;
yTile = tOb.yTile;
width = tOb.width;
height = tOb.height;
dirX = tOb.dirX;
hero = tOb.hero;
turn = tOb.turn;
type = tOb.type;
lastDir = tOb.dir;
hitRadius = tOb.hitRadius;
}
function getCorners(x, y) {
downY = Math.floor(((y + height) - 1) / tileH);
upY = Math.floor((y - height) / tileH);
leftX = Math.floor((x - width) / tileW);
rightX = Math.floor(((x + width) - 1) / tileW);
upLeft = tileManager.arrCurrentTiles[upY][leftX].walkable;
downLeft = tileManager.arrCurrentTiles[downY][leftX].walkable;
upRight = tileManager.arrCurrentTiles[upY][rightX].walkable;
downRight = tileManager.arrCurrentTiles[downY][rightX].walkable;
}
function die() {
if (killed && (!offScreen)) {
y = y + dieSpeed;
getCorners(x + width, y);
if (downY >= tileManager.arrCurrentTiles.length) {
offScreen = true;
}
}
}
function checkHit() {
var numDist = Math.floor(Math.sqrt((xDist * xDist) + (yDist * yDist)));
if (numDist < hitRadius) {
if ((hero.jumpDir == 1) && (hero.y <= y)) {
killed = true;
lastDir = lastDir + "Die";
} else {
model.heroDie();
}
}
}
function doJump() {
jumpSpeed = jumpSpeed + gravity;
if (jumpSpeed > tileH) {
jumpSpeed = tileH;
}
if (jumpSpeed < 0) {
move(0, -1, -1);
} else if (jumpSpeed > 0) {
move(0, 1, 1);
}
return(true);
}
function fall() {
climbing = false;
if (!jump) {
getCorners(x, y + 1);
if (downLeft && (downRight)) {
jumpSpeed = 0;
jump = true;
}
}
}
function onCloud() {
var leftCloud = tileManager.arrCurrentTiles[downY][leftX].cloud;
var rightCloud = tileManager.arrCurrentTiles[downY][rightX].cloud;
if ((leftCloud || (rightCloud)) && (yTile != downY)) {
return(true);
}
return(false);
}
function checkUpLadder() {
var downY = Math.floor(((y + height) - 1) / tileH);
var upY = Math.floor(((y - height) - sp) / tileW);
var upLadder = tileManager.arrCurrentTiles[upY][xTile].ladder;
var downLadder = tileManager.arrCurrentTiles[downY][xTile].ladder;
var upBlock = tileManager.arrCurrentTiles[upY][xTile].walkable;
if (upLadder || (upBlock)) {
if (upLadder || (downLadder)) {
return(true);
}
} else {
y = (yTile * tileH) + height;
update(0, -1, "U");
return(false);
}
}
function checkDownLadder() {
var downY = Math.floor(((sp + y) + height) / tileH);
var downLadder = tileManager.arrCurrentTiles[downY][xTile].ladder;
if (downLadder) {
return(true);
}
fall();
}
function climb(dirY) {
climbing = true;
jump = false;
jumpDir = 0;
y = y + (climbSpeed * dirY);
x = (xTile * tileW) + (tileW / 2);
update(0, dirY, "U");
return(true);
}
function useWeapon() {
if ((lastDir == "R") || (lastDir == "L")) {
dirWeapon = ((lastDir == "R") ? 1 : -1);
model.weaponManager.addWeapon({x:x + (dirWeapon * width), y:y, prey:model.enemyManager.arrCurrentEnemies, dir:dirWeapon, type:"bullet"});
}
}
function move() {
}
function update() {
}
var killed = false;
var offScreen = false;
var dieSpeed = 30;
var jumpDir = 0;
}
Symbol 186 MovieClip [__Packages.characters.Enemy] Frame 0
class characters.Enemy extends characters.Character
{
var dirX, getCorners, sp, x, height, y, upRight, width, upLeft, lastDir, turn, xDist, hero, yDist, xTile, tileW, yTile, tileH;
function Enemy (tOb) {
super(tOb);
}
function move() {
if (dirX == 1) {
getCorners(x + (sp * dirX), y + height);
if (upRight) {
dirX = randomMove(dirX);
} else {
dirX = -1;
}
} else {
getCorners(x + ((sp * dirX) - width), y + height);
if (upLeft) {
dirX = randomMove(dirX);
} else {
dirX = 1;
}
}
x = x + (sp * dirX);
lastDir = ((dirX > 0) ? "R" : "L");
update();
}
function randomMove(xDir) {
var newDir = xDir;
var ran = Math.floor(Math.random() * turn);
if (!ran) {
newDir = -xDir;
}
return(newDir);
}
function update(dirX, dirY) {
xDist = x - hero.x;
yDist = y - hero.y;
xTile = Math.floor(x / tileW);
yTile = Math.floor(y / tileH);
}
}
Symbol 187 MovieClip [__Packages.weapons.WeaponManager] Frame 0
class weapons.WeaponManager
{
var tileH, tileW, model, tileManager;
function WeaponManager (tOb) {
tileH = tOb.tileH;
tileW = tOb.tileW;
arrWeapons = tOb.arrWeapons;
arrCurrentWeapons = arrWeapons[0];
model = tOb.model;
tileManager = tOb.tileManager;
}
function switchMap(num) {
arrCurrentWeapons = arrWeapons[num];
}
function createWeapon(weapon) {
var weaponType = weapon.type;
weapon.width = 10;
weapon.height = 20;
weapon.tileW = tileW;
weapon.tileH = tileH;
weapon.tileManager = tileManager;
weapon.model = model;
weapon.weaponManager = this;
var tmp = ((weaponType == "bullet") ? (new weapons.Bullet(weapon)) : false);
return(tmp);
}
function addWeapon(tOb) {
var weapon = createWeapon(tOb);
arrCurrentWeapons.push(weapon);
model.addWeapon(weapon);
return(true);
}
function move() {
var max = arrCurrentWeapons.length;
while (max--) {
arrCurrentWeapons[max].move();
}
}
function removeWeapon(clip) {
var max = arrCurrentWeapons.length;
while (max--) {
if (arrCurrentWeapons[max].id == clip) {
delete eval (arrCurrentWeapons.splice(max, 1));
model.removeClip(clip);
return;
}
}
}
function clearAllWeapons() {
var max = arrCurrentWeapons.length;
var arrTmp = [];
while (max--) {
arrTmp.push(arrCurrentWeapons[max].id);
}
model.resetWeapons(arrTmp);
var max = arrWeapons.length;
while (max--) {
arrWeapons[max] = [];
}
}
var arrCurrentWeapons = new Array();
var arrWeapons = new Array();
}
Symbol 188 MovieClip [__Packages.weapons.Weapon] Frame 0
class weapons.Weapon
{
var tileH, tileW, model, tileManager, weaponManager, downY, height, upY, leftX, width, rightX, upLeft, downLeft, upRight, downRight, dirX, sp, x, y, xTile, prey, id, yTile;
function Weapon (tOb) {
tileH = 30;
tileW = 30;
model = tOb.model;
tileManager = tOb.tileManager;
weaponManager = tOb.weaponManager;
}
function getCorners(x, y) {
downY = Math.floor(((y + height) - 1) / tileH);
upY = Math.floor((y - height) / tileH);
leftX = Math.floor((x - width) / tileW);
rightX = Math.floor(((x + width) - 1) / tileW);
upLeft = tileManager.arrCurrentTiles[upY][leftX].walkable;
downLeft = tileManager.arrCurrentTiles[downY][leftX].walkable;
upRight = tileManager.arrCurrentTiles[upY][rightX].walkable;
downRight = tileManager.arrCurrentTiles[downY][rightX].walkable;
}
function move() {
if (dirX == 1) {
getCorners(x + ((sp * dirX) + width), y + height);
if (upRight) {
x = x + ((sp * dirX) + width);
} else if (lastX < 1) {
x = ((xTile + 1) * tileW) - width;
lastX++;
} else {
remove();
}
} else {
getCorners(x + ((sp * dirX) - width), y + height);
if (upLeft) {
x = x + ((sp * dirX) - width);
} else {
x = (xTile * tileW) - width;
remove();
}
}
update();
checkHit();
}
function checkHit() {
var max = prey.length;
var tmpPrey;
while (max--) {
tmpPrey = prey[max];
var xDist = (x - tmpPrey.x);
var yDist = (y - tmpPrey.y);
if (Math.sqrt((xDist * xDist) + (yDist * yDist)) < width) {
model.victimDie(tmpPrey);
weaponManager.removeWeapon(id);
}
}
}
function update() {
xTile = Math.floor(x / tileW);
yTile = Math.floor(y / tileH);
}
function remove() {
weaponManager.removeWeapon(id);
}
var lastX = 0;
}
Symbol 189 MovieClip [__Packages.weapons.Bullet] Frame 0
class weapons.Bullet extends weapons.Weapon
{
var sp, x, y, width, height, type, prey, dirX;
function Bullet (tOb) {
super(tOb);
sp = 4;
x = tOb.x;
y = tOb.y;
width = tOb.width;
height = tOb.height;
type = "bullet";
prey = tOb.prey;
dirX = tOb.dir;
}
}
Symbol 190 MovieClip [__Packages.props.PropManager] Frame 0
class props.PropManager
{
var tileH, tileW, hero, model;
function PropManager (tOb) {
tileH = tOb.tileH;
tileW = tOb.tileW;
hero = tOb.hero;
model = tOb.model;
create(tOb.arrProps);
arrCurrentProps = arrProps[0];
}
function create(arrMaster) {
var max = arrMaster.length;
while (max--) {
var maxx = arrMaster[max].length;
var arrTmp = [];
while (maxx--) {
var obProp = arrMaster[max][maxx];
var tmp = createProp(obProp);
arrTmp.unshift(tmp);
}
arrProps.unshift(arrTmp);
}
}
function removeProp(id) {
var max = arrCurrentProps.length;
while (max--) {
if (arrCurrentProps[max].id == id) {
model.removeClip(id);
delete eval (arrCurrentProps.splice(max, 1));
return;
}
}
}
function switchMap(num) {
arrCurrentProps = arrProps[num];
}
function createProp(obProp) {
var prop = (new props.Prop(obProp));
var propType = prop.type;
if (propType == "jewel") {
prop.width = 10;
prop.height = 10;
}
prop.x = (prop.xTile * tileW) + (tileW / 2);
prop.y = (prop.yTile * tileH) + (tileH * 0.67);
prop.hero = hero;
prop.tileW = tileW;
prop.tileH = tileH;
prop.propManager = this;
return(prop);
}
function addProp(tOb) {
var prop = createProp(tOb);
arrCurrentProps.push(prop);
}
function checkProps() {
var max = arrCurrentProps.length;
while (max--) {
arrCurrentProps[max].checkHit();
}
}
static var log = org.fivepecks.logger.Logger.getInstance();
var arrProps = [];
var arrCurrentProps = [];
var name = "PropManager";
}
Symbol 191 MovieClip [__Packages.props.Prop] Frame 0
class props.Prop
{
var xTile, yTile, type, propManager, hero, x, y, width, id;
function Prop (tOb) {
xTile = tOb.xTile;
yTile = tOb.yTile;
type = tOb.type;
propManager = tOb.propManager;
}
function checkHit() {
var xDist = (x - hero.x);
var yDist = (y - hero.y);
if (Math.sqrt((xDist * xDist) + (yDist * yDist)) < (width + hero.width)) {
propManager.removeProp(id);
}
}
}
Symbol 192 MovieClip [__Packages.characters.Hero] Frame 0
class characters.Hero extends characters.Character
{
var walkSpeed, getCorners, x, sp, y, upLeft, upRight, height, tileH, yTile, downLeft, downRight, width, tileW, xTile, lastDir, tileManager;
function Hero (tOb) {
super(tOb);
walkSpeed = tOb.sp;
}
function move(dirX, dirY) {
getCorners(x, y + (sp * dirY));
if (dirY == -1) {
if (upLeft && (upRight)) {
y = y + (sp * dirY);
} else {
y = (yTile * tileH) + height;
}
}
if (dirY == 1) {
if (downLeft && (downRight)) {
y = y + (sp * dirY);
} else {
y = ((yTile + 1) * tileH) - height;
}
}
getCorners(x + (sp * dirX), y);
if (dirX == -1) {
if (downLeft && (upLeft)) {
x = x + (sp * dirX);
} else {
x = (xTile * tileW) + width;
}
lastDir = "L";
}
if (dirX == 1) {
if (upRight && (downRight)) {
x = x + sp;
} else {
x = ((xTile + 1) * tileW) - width;
}
lastDir = "R";
}
update(dirX, dirY);
return(true);
}
function update(dirX, dirY) {
xTile = Math.floor(x / tileW);
yTile = Math.floor(y / tileH);
var tile = tileManager.arrCurrentTiles[yTile][xTile];
if (tile.door) {
xTile = tile.xTile;
yTile = tile.yTile;
if (Math.abs(dirX) == 1) {
x = Math.floor((xTile * tileW) + width);
} else {
y = Math.floor((yTile * tileH) + height);
}
}
}
}
Symbol 193 MovieClip [__Packages.timer.TimerDownEvent] Frame 0
class timer.TimerDownEvent
{
var numTimeLeft, numTimeOffset, numTempTime, numMin, numSec, strMinParse, strSecParse, strReturn, numInterval, numGetTimer, numLastTime;
function TimerDownEvent (totalTime) {
numTimeLeft = totalTime;
timeOffset = (0);
mx.events.EventDispatcher.initialize(this);
}
function dispatchEvent() {
}
function addEventListener() {
}
function removeEventListener() {
}
function get timeLeft() {
return(numTimeLeft);
}
function set timeLeft(numTime) {
numTimeLeft = numTime;
//return(timeLeft);
}
function get timeOffset() {
return(numTimeOffset);
}
function set timeOffset(numTime) {
numTimeOffset = numTime;
//return(timeOffset);
}
function displayTime() {
numTempTime = Math.round(timeLeft / 1000);
if (numTempTime >= 0) {
if (numTempTime > 59) {
numMin = Math.floor(numTempTime / 60);
numSec = numTempTime - (numMin * 60);
} else {
numMin = 0;
numSec = numTempTime;
}
if (numMin == 0) {
strMinParse = "0";
} else {
strMinParse = String(numMin);
}
if ((numSec < 10) && (numSec > 0)) {
strSecParse = "0" + numSec;
} else if (numSec == 0) {
strSecParse = "00";
} else {
strSecParse = String(numSec);
}
strReturn = (strMinParse + ":") + strSecParse;
return(strReturn);
}
}
function startClock() {
if (timeLeft >= 1) {
timeOffset = (getTimer());
numInterval = setInterval(this, "decrement", 250);
}
}
function stopClock() {
clearInterval(numInterval);
}
function lastCheck() {
numGetTimer = getTimer();
numLastTime = numGetTimer - timeOffset;
timeOffset = (numGetTimer);
return(numLastTime);
}
function decrement() {
timeLeft = timeLeft - lastCheck();
if (((timeLeft == null) || (timeLeft <= 0)) || (timeLeft == undefined)) {
stopClock();
timerFinished();
}
}
function timerFinished() {
var eventObj = {target:this, type:"timerFinished"};
dispatchEvent(eventObj);
}
function kill() {
stopClock();
}
}
Symbol 194 MovieClip [__Packages.mvc.Controller] Frame 0
interface mvc.Controller
{
}
Symbol 195 MovieClip [__Packages.mvc.View] Frame 0
interface mvc.View
{
}
Symbol 196 MovieClip [__Packages.mvc.AbstractController] Frame 0
class mvc.AbstractController implements mvc.Controller
{
var model, view;
function AbstractController (m) {
setModel(m);
}
function setModel(m) {
model = m;
}
function getModel() {
return(model);
}
function setView(v) {
view = v;
}
function getView() {
return(view);
}
}
Symbol 197 MovieClip [__Packages.mvc_specific.MVCController] Frame 0
class mvc_specific.MVCController extends mvc.AbstractController
{
var intervalId, model, view;
function MVCController (cm) {
super(cm);
intervalId = setInterval(this, "updateObjects", 30);
}
function updateModel() {
with (model) {
detectKeys();
}
}
function updateObjects() {
with (model) {
updateObjects();
}
}
function pauseUpdates() {
clearInterval(intervalId);
_root.onEnterFrame = null;
}
function restartUpdates(str) {
with (model) {
restart(str);
}
_root.onEnterFrame = function () {
this.game.mvc_controller.updateModel();
};
intervalId = setInterval(this, "updateObjects", 30);
with (view) {
changeState("active");
}
}
function click(e) {
switch (e.target._name) {
case "btnSubmit" :
with (view) {
submitScore();
}
return;
case "stop" :
return;
case "restart" :
}
}
static var log = org.fivepecks.logger.Logger.getInstance();
}
Symbol 198 MovieClip [__Packages.mvc.AbstractView] Frame 0
class mvc.AbstractView implements util.Observer, mvc.View
{
var model, controller;
function AbstractView (m, c) {
setModel(m);
if (!(c === undefined)) {
setController(c);
}
}
function defaultController(model) {
return(null);
}
function setModel(m) {
model = m;
}
function getModel() {
return(model);
}
function setController(c) {
controller = c;
getController().setView(this);
}
function getController() {
if (controller === undefined) {
setController(defaultController(getModel()));
}
return(controller);
}
function update(o, infoObj) {
}
}
Symbol 199 MovieClip [__Packages.mvc_specific.MVCView] Frame 0
class mvc_specific.MVCView extends mvc.AbstractView
{
var mcPath, mcBG, mcClock, mcScore, mcAudio, mcFinalScreen, mcHero, strState, controller, intervalPauseId;
function MVCView (m, c) {
super(m, c);
createChildren(_root);
changeState("active");
}
function createChildren(path) {
mcPath = path.createEmptyMovieClip("mcTile", path.getNextHighestDepth());
mcBG = mcPath.attachMovie("mcGameBG", "mcGameBG", mcPath.getNextHighestDepth());
mcBG.cacheAsBitmap = true;
mcPath._xscale = (mcPath._yscale = 160);
mcPath._x = mcPath._x - 40;
mcPath._y = mcPath._y - 42;
mcClock = path.attachMovie("mcClock", "mcClock", path.getNextHighestDepth(), {_x:8, _y:5});
mcScore = path.attachMovie("mcScore", "mcScore", path.getNextHighestDepth(), {_x:335, _y:5});
mcAudio = path.attachMovie("mcAudio", "mcAudio", path.getNextHighestDepth());
mcFinalScreen = path.attachMovie("mcFinalScreen", "mcFinalScreen", path.getNextHighestDepth(), {_visible:false});
doSound("game");
Selection.setFocus(null);
}
function setTiles(arrCurrentTiles) {
var max = arrCurrentTiles.length;
while (max--) {
var maxx = arrCurrentTiles[max].length;
while (maxx--) {
var tile = arrCurrentTiles[max][maxx];
var tilePath = mcPath.attachMovie("tile", tile.name, mcPath.getNextHighestDepth(), {_x:maxx * tileW, _y:max * tileH});
tile.id = tilePath;
tilePath.cacheAsBitmap = true;
}
}
}
function setHero(hero) {
mcHero = mcPath.attachMovie("mcHero", "mcHero", mcPath.getNextHighestDepth(), {_x:hero.x, _y:hero.y});
hero.id = mcHero;
mcHero.cacheAsBitmap = true;
}
function switchMap(arrCurrentTiles, arrCurrentProps, arrCurrentItems, arrCurrentEnemies, arrCurrentMovingTiles, arrCurrentWeapons, arrLastProps, arrLastItems, arrLastEnemies, arrLastMovingTiles, arrLastWeapons) {
var max = arrCurrentTiles.length;
while (max--) {
var maxx = arrCurrentTiles[max].length;
while (maxx--) {
var tile = arrCurrentTiles[max][maxx];
mcPath[tile.name].gotoAndStop(tile.frame);
}
}
var arrLast = [arrLastWeapons, arrLastEnemies, arrLastMovingTiles, arrLastProps, arrLastItems];
var arrCurrent = [arrCurrentWeapons, arrCurrentEnemies, arrCurrentMovingTiles, arrCurrentProps, arrCurrentItems];
max = arrLast.length;
while (max--) {
var maxx = arrLast[max].length;
while (maxx--) {
removeMovieClip(arrLast[max][maxx].id);
}
}
max = arrCurrent.length;
while (max--) {
maxx = arrCurrent[max].length;
while (maxx--) {
var depth = mcPath.getNextHighestDepth();
var tmp = arrCurrent[max][maxx];
var id = mcPath.attachMovie(tmp.type, tmp.type + depth, depth, {_x:tmp.x, _y:tmp.y});
tmp.id = id;
tmp.id.cacheAsBitmap = true;
}
}
}
function addWeapon(weapon) {
var depth = mcPath.getNextHighestDepth();
weapon.id = mcPath.attachMovie(weapon.type, weapon.type + depth, depth, {_x:weapon.x, _y:weapon.y});
weapon.id.cacheAsBitmap = true;
doSound("shotgun");
}
function removeClip(clip) {
removeMovieClip(clip);
}
function updateObjects(arrObjects) {
if (strState == "active") {
var points = arrObjects.shift();
mcScore.score = points;
var time = arrObjects.shift();
if (time.length) {
mcClock.time = time;
}
var tmp = arrObjects.shift();
with (tmp) {
if (keyPressed) {
if ((lastDir == "R") || (lastDir == "L")) {
id.gotoAndStop(lastDir);
}
id.clip.play();
} else {
id.clip.gotoAndStop("rest");
}
id._x = x;
id._y = y;
}
var max = arrObjects.length;
while (max--) {
var maxx = arrObjects[max].length;
while (maxx--) {
tmp = arrObjects[max][maxx];
with (tmp) {
id.gotoAndStop(lastDir);
id.clip.play();
id._x = x;
id._y = y;
}
}
}
}
}
function changeCharDepth(id) {
mcHero.swapDepths(mcPath.getNextHighestDepth());
}
function end(arrObjects) {
changeState("end");
with (controller) {
pauseUpdates();
}
var points = arrObjects.shift();
if (points.length) {
mcScore.score = points;
}
var time = arrObjects.shift();
if (time.length) {
mcClock.time = time;
}
for (var prop in mcPath) {
mcPath[prop].clip.clip.stop();
}
doSound("stopGame");
setReward();
}
function changeState(str) {
strState = str;
}
function addNewEnemy(enemy) {
var depth = mcPath.getNextHighestDepth();
enemy.id = mcPath.attachMovie(enemy.type, enemy.type + depth, depth, {_x:enemy.x, _y:enemy.y});
enemy.id.cacheAsBitmap = true;
}
function resetWeapons(arrWeapons) {
var max = arrWeapons.length;
while (max--) {
removeMovieClip(arrWeapons[max]);
}
}
function doSound(str) {
if (str == "scream") {
str = str + String(Math.floor(Math.random() * 5));
} else if (str == "shotgun") {
str = str + String(Math.floor(Math.random() * 2));
} else if (str == "yeehaw") {
str = (Math.floor(Math.random() * 2) ? "yeehaw" : "hehehe");
}
mcAudio.gotoAndStop(str);
mcAudio.gotoAndStop("rest");
}
function initializeScores(strURL) {
}
function setReward() {
var num = 0;
finalScore = Number(mcScore.score);
var i = 0;
while (i < 20) {
if (finalScore >= Number(_root["SCORE" + i])) {
log.debug((((("VIEW " + finalScore) + " beats ") + i) + "'s ") + Number(_root["SCORE" + i]));
num = i;
break;
}
i++;
}
numRank = 0;
if (i <= 6) {
numRank = 3;
} else if ((i > 6) && (i <= 13)) {
numRank = 2;
} else if ((i > 13) && (i < 20)) {
numRank = 1;
}
doSound("title");
mcFinalScreen._visible = true;
log.debug((((("VIEW: numRank " + numRank) + "...num ") + num) + "...finalScore ") + finalScore);
var duration = 1000;
intervalPauseId = setInterval(this, "executeCallback", duration, numRank);
}
function executeCallback(numRank) {
if (intervalCount > 1) {
trace("executeCallback intervalId: " + intervalPauseId);
mcScore._visible = false;
mcClock._visible = false;
mcPath._visible = false;
mcFinalScreen._visible = false;
clearInterval(intervalPauseId);
_root.gotoAndStop("reward" + numRank);
}
intervalCount++;
}
function update(o, ob) {
switch (ob.msg) {
case "initialize" :
setTiles(ob.arrCurrentTiles);
setHero(ob.hero);
case "switchMap" :
switchMap(ob.arrCurrentTiles, ob.arrCurrentProps, ob.arrCurrentItems, ob.arrCurrentEnemies, ob.arrCurrentMovingTiles, ob.arrCurrentWeapons, ob.arrLastProps, ob.arrLastItems, ob.arrLastEnemies, ob.arrLastMovingTiles, ob.arrLastWeapons);
changeCharDepth(ob.hero.id);
return;
case "update" :
updateObjects(ob.arrObjects);
return;
case "addWeapon" :
addWeapon(ob.weapon);
return;
case "removeClip" :
removeClip(ob.clip);
return;
case "end" :
end(ob.arrObjects);
return;
case "resetWeapons" :
resetWeapons(ob.arrWeapons);
return;
case "addNewEnemy" :
addNewEnemy(ob.enemy);
doSound("yeehaw");
return;
case "doSound" :
doSound(ob.arrObjects[0]);
return;
default :
log.info("The view is reporting an update without an appropriate case - " + ob.msg);
}
}
static var log = org.fivepecks.logger.Logger.getInstance();
var name = "MVCView";
var tileH = 30;
var tileW = 30;
var arrItems = [];
var finalScore = 0;
var intervalCount = 0;
var numRank = 0;
}
Symbol 28 MovieClip [mcAudio] Frame 1
stop();
Symbol 40 MovieClip Frame 16
gotoAndPlay (3);
Symbol 53 MovieClip Frame 1
gotoAndStop(_root.beltColor);
Symbol 56 MovieClip Frame 9
gotoAndPlay (1);
Symbol 57 MovieClip [mcHero] Frame 1
stop();
Symbol 61 MovieClip Frame 17
gotoAndPlay (3);
Symbol 62 MovieClip [samurai] Frame 1
stop();
Symbol 103 Button
on (release) {
_root.gotoAndStop("game");
}
Symbol 117 MovieClip Frame 20
stop();