Frame 1
_focusrect = false;
System.security.allowDomain("www.disney.go.com");
System.security.allowDomain("disney.go.com");
System.security.allowDomain("psc.disney.go.com");
System.security.allowDomain("apsc.disney.go.com");
System.security.allowDomain("tv.disney.go.com");
System.security.allowDomain("atv.disney.go.com");
System.security.allowDomain("scores.disney.go.com");
gameID = "dc_ad_hr";
subject = "American Dragon - High Risk Rescue";
playerScore = 0;
playerName = "";
fsdPlayAgain = function () {
theDoge.unloadMovie();
_global.Packaging.onButtonPlayAgain();
};
stop();
Instance of Symbol 11 MovieClip "loader" in Frame 1
onClipEvent (enterFrame) {
var l_pc = Math.ceil((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (l_pc == 100) {
_parent.gotoAndPlay("PerformanceCheck");
} else {
this.loader.gotoAndStop(l_pc);
}
this.pc = l_pc + "%";
}
Instance of Symbol 123 MovieClip in Frame 2
onClipEvent (load) {
function fStyleNumber(_nNumber, _nMinimumChar) {
_sNumber = String(_nNumber);
_sNewString = "";
_nlength = _sNumber.length;
_nlength = _nlength / 3;
if (_nlength <= 1) {
_sNewNumber = _sNumber;
if (_sNewNumber.length < _nMinimumChar) {
_sNewNumber = "0" + _sNewNumber;
}
return(_sNewNumber);
}
_nLoop = _nlength;
while (_nLoop > 1) {
_sNewString = (" " + _sNumber.substr(-3)) + _sNewString;
_sNumber = _sNumber.substr(0, -3);
_nLoop--;
}
_sNewNumber = _sNumber + _sNewString;
if (_sNewNumber.length < _nMinimumChar) {
_sNewNumber = "0" + _sNewNumber;
}
return(_sNewNumber);
}
function getScores() {
if (gProxyObj == undefined) {
listScores();
} else {
gProxyObj.getScores(cbFunc2);
}
}
function submitScore() {
gProxyObj.submitScore(_global.C.TotalScore, cbFunc);
}
function initHiScores() {
gProxyObj.setGame_Id("xs_insane");
}
function getScoreString() {
var _local5 = "Oops! The high score list isn't available right now!";
if (gProxyObj != undefined) {
var _local7 = gProxyObj.getScoreCount();
if (_local7 > 0) {
var _local1;
var _local6;
var _local3;
var _local4;
_local5 = "";
_local1 = 0;
while (_local1 < _local7) {
_local6 = gProxyObj.getScoreItem(_local1);
_local3 = _local6[0];
_local4 = fStyleNumber(_local6[1]);
spaceNb = (30 - _local3.length) - _local4.length;
spaceTXT = "";
var _local2 = 0;
while (_local2 < spaceNb) {
spaceTXT = spaceTXT + " ";
_local2++;
}
if (_local1 < 9) {
_local5 = _local5 + ((((((_local1 + 1) + " ") + _local3) + spaceTXT) + _local4) + newline);
} else if (_local1 < 99) {
_local5 = _local5 + ((((((_local1 + 1) + " ") + _local3) + spaceTXT) + _local4) + newline);
} else {
_local5 = _local5 + ((((((_local1 + 1) + " ") + _local3) + spaceTXT) + _local4) + newline);
}
_local1++;
}
} else {
_local5 = "Whoops, the high scores seem to have escaped!";
}
}
return(_local5);
}
function listScores() {
_global.theStage.txt_highScore.text = getScoreString();
if (_global.theStage.txt_highScore.maxscroll <= _global.theStage.txt_highScore.scroll) {
_global.theStage.scrollBar._visible = false;
}
}
function cbFunc(thisBool) {
if (thisBool) {
listScores();
} else {
_global.theStage.txt_highScore.text = "Oops! The high score list isn\u2019t available right now!";
_global.theStage.scrollBar._visible = false;
}
}
function cbFunc2(thisBool) {
Debug.trace("cbFunc2");
if (thisBool) {
listScores();
} else {
_global.theStage.txt_highScore.text = "Oops! The high score list isn\u2019t available right now!";
_global.theStage.scrollBar._visible = false;
}
}
function mute() {
SoundActive = false;
_global.SoundCTRL.muteAllSounds();
_global.Hud.Son.gotoAndStop(2);
}
function unmute() {
SoundActive = true;
_global.SoundCTRL.unmuteAllSounds();
_global.Hud.Son.gotoAndStop(1);
}
function initGame(bPlayAgain) {
Score = 0;
Life = 5;
Level = 1;
goToScreen("level" + Level, true);
_global.SoundCTRL.fadeOutSound("MusicLoop2");
_global.SoundCTRL.playSound("MusicLoop", 30, 100000);
resetTimer();
GameActive = true;
}
function endGame(endType) {
Score = _global.Game.Pers.Point;
_global.SoundCTRL.clearSound();
if (endType == "lose") {
goToScreen("Lose", true);
calculateBonus(true);
} else {
goToScreen("Win", true);
calculateBonus(false);
}
}
function reInitGame() {
Score = 0;
Life = 5;
goToScreen("level" + Level, true);
_global.SoundCTRL.fadeOutSound("MusicLoop2");
_global.SoundCTRL.playSound("MusicLoop", 30, 100000);
}
function levelUp() {
Level++;
_global.Transition.gotoAndStop("NextLevel");
NextScreen = "level" + Level;
Reset = true;
}
function resumeGame() {
_global.Game.G_Resume = true;
}
function resetTimer() {
Time = 0;
}
function increaseTime() {
if (!_global.Game.G_Pause) {
Time++;
}
refreshTime();
}
function refreshTime() {
var _local4 = Math.floor(Time / 60);
var _local3 = Time % 60;
if (_local3 < 10) {
var _local2 = "0" + String(_local3);
} else {
var _local2 = String(_local3);
}
_global.Hud.Minute.text = _local4;
_global.Hud.MinuteShadow.text = _local4;
_global.Hud.Seconde.text = _local2.slice(0, 1);
_global.Hud.SecondeShadow.text = _local2.slice(0, 1);
_global.Hud.Seconde2.text = _local2.slice(1, 2);
_global.Hud.Seconde2Shadow.text = _local2.slice(1, 2);
}
function calculateBonus(bLoose) {
TimeBonus = 0;
if (bLoose) {
TimeBonus = 0;
} else if (Time < 300) {
TimeBonus = 50000;
} else if (Time < 420) {
TimeBonus = 40000;
} else if (Time < 600) {
TimeBonus = 30000;
} else if (Time < 1200) {
TimeBonus = 20000;
} else if (Time < 3600) {
TimeBonus = 10000;
}
TotalScore = TimeBonus + Score;
}
function refreshScore() {
_global.theStage.xBonus.text = Score;
_global.theStage.timeBonus.text = TimeBonus;
_global.theStage.totalPoints.text = Score + TimeBonus;
}
function showHelp(inGame) {
if (inGame) {
_global.Game.G_Pause = true;
_global.Popup.gotoAndStop("Instructions");
} else {
_global.Popup.gotoAndStop("Instructions");
_global.theStage.gotoAndStop("Reset");
}
}
function helpBack() {
_global.Popup.prevFrame();
}
function helpNext() {
_global.Popup.nextFrame();
}
function goToScreen(Screen, ResetLevel) {
_global.Transition.gotoAndStop("Transition");
NextScreen = Screen;
Reset = ResetLevel;
}
function resetScreen() {
if (Reset) {
_root.gotoAndStop("Reset");
}
_global.Popup.gotoAndStop(1);
}
function showScreen() {
_global.theStage.gotoAndStop(NextScreen);
refreshTime();
if ((NextScreen == "Lose") || (NextScreen == "Win")) {
_global.SoundCTRL.playSound("MusicLoop2", 30, 100000);
refreshScore();
} else if (NextScreen.indexOf("level") != -1) {
_global.Popup.gotoAndStop(Level + "Start");
}
}
function beginLevel() {
_global.Popup.gotoAndStop(1);
_global.C.ActivateHud();
_global.Game.G_Resume = true;
}
function endLevel(CurrentPoint, CurrentLife) {
Life = CurrentLife;
Score = CurrentPoint;
_global.Popup.gotoAndStop(Level + "End");
}
function endTransition() {
_global.Transition.gotoAndStop(1);
}
function ActivateHud() {
_global.Hud.btnHelp.enabled = true;
_global.Hud.Son.btnMute.enabled = true;
}
function DesactivateHud() {
_global.Hud.btnHelp.enabled = false;
_global.Hud.Son.btnMute.enabled = false;
}
function getAgentID() {
getURL ("http://www.nick.com/all_nick/specials/x/jragent.jhtml", "_blank");
}
_global.C = this;
var Reset = false;
var Time = 0;
var NextScreen = "";
var GameActive = false;
var SoundActive = true;
var TotalScore = 0;
}
Frame 10
com.sarbakan.utils.PerformanceWatcher.start(35);
loader.pc = "";
loader.loader.gotoAndStop(100);
Frame 45
_global.PerformanceTestResult = com.sarbakan.utils.PerformanceWatcher.fps;
com.sarbakan.utils.PerformanceWatcher.stop();
gotoAndStop ("Packaging");
Frame 46
stop();
Frame 56
stop();
_global.C.initGame();
Instance of Symbol 1157 MovieClip in Frame 56
onClipEvent (load) {
this._xscale = 100;
this._yscale = 100;
this._x = 0;
this._y = 510;
}
Frame 66
stop();
_global.C.initGame();
Instance of Symbol 1209 MovieClip in Frame 66
onClipEvent (load) {
this._xscale = 100;
this._yscale = 100;
this._x = 0;
this._y = 510;
}
Frame 76
stop();
_global.C.initGame();
Instance of Symbol 1230 MovieClip in Frame 76
onClipEvent (load) {
this._xscale = 100;
this._yscale = 100;
this._x = 0;
this._y = 510;
}
Frame 86
stop();
_global.C.initGame();
Instance of Symbol 1374 MovieClip in Frame 86
onClipEvent (load) {
this._xscale = 100;
this._yscale = 100;
this._x = -300;
this._y = 440;
}
Frame 96
stop();
_global.C.initGame();
Instance of Symbol 1393 MovieClip in Frame 96
onClipEvent (load) {
this._xscale = 100;
this._yscale = 100;
this._x = -400;
this._y = 440;
}
Frame 106
stop();
_global.C.initGame();
Instance of Symbol 1408 MovieClip "Game" in Frame 106
onClipEvent (load) {
this._xscale = 100;
this._yscale = 100;
this._x = -400;
this._y = 440;
}
Instance of Symbol 1495 MovieClip in Frame 106
onClipEvent (load) {
_parent.Game.Control.CreerMedusaSister(this);
}
Frame 116
gotoAndStop(_global.resetDestination);
Symbol 1496 MovieClip [__Packages.Debug] Frame 0
class Debug
{
static var lc;
function Debug () {
}
static function clear() {
lc = new LocalConnection();
lc.send("trace", "clear");
}
static function setLevel(pLvl) {
level = pLvl;
}
static function trace(pMsg, pLvl) {
var _local1;
if (pLvl != undefined) {
_local1 = pLvl;
} else {
_local1 = level;
}
lc = new LocalConnection();
lc.send("trace", "trace", pMsg, _local1);
}
static function traceObject(o, pRecurseDepth, pLvl, pIndent) {
var _local7;
var _local5;
var _local6;
if (pLvl != undefined) {
_local6 = pLvl;
} else {
_local6 = level;
}
if (pRecurseDepth == undefined) {
_local7 = 0;
} else {
_local7 = pRecurseDepth;
}
if (pIndent == undefined) {
_local5 = 0;
} else {
_local5 = pIndent;
}
for (var _local8 in o) {
var _local3 = "";
var _local1 = 0;
while (_local1 < _local5) {
_local3 = _local3 + " ";
_local1++;
}
var _local2 = o[_local8].toString();
if (o[_local8] instanceof Array) {
_local2 = "[Array]";
}
if (_local2 == "[object Object]") {
_local2 = "[Object]";
}
trace(((_local3 + _local8) + ": ") + _local2, _local6);
if (_local7 > 0) {
traceObject(o[_local8], _local7 - 1, _local6, _local5 + 1);
}
}
}
static var level = 0;
static var DEBUG = 0;
static var INFO = 1;
static var WARN = 2;
static var ERROR = 3;
static var FATAL = 4;
}
Symbol 1497 MovieClip [__Packages.com.sarbakan.utils.PerformanceWatcher] Frame 0
class com.sarbakan.utils.PerformanceWatcher
{
static var nMovieFPS, bActive, oEnterFrameListener, nCurrentFPS, mcDebug, nUpdateCount, nLastGetTimer;
function PerformanceWatcher () {
}
static function start(l_nMovieFPS) {
nMovieFPS = l_nMovieFPS;
if (!bActive) {
bActive = true;
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = mx.utils.Delegate.create(com.sarbakan.utils.PerformanceWatcher, update);
MovieClip.addListener(oEnterFrameListener);
}
nCurrentFPS = nMovieFPS;
reset();
}
static function stop() {
if (bActive) {
bActive = false;
MovieClip.removeListener(oEnterFrameListener);
stopDebug();
}
}
static function addListener(l_listener, l_nMinFPS, l_bDelete) {
aListeners.push({listener:l_listener, nMinFPS:l_nMinFPS, bDelete:l_bDelete});
}
static function removeListener(l_listener) {
for (var _local2 in aListeners) {
if (aListeners[_local2].listener == l_listener) {
aListeners.splice(_local2, 1);
}
}
}
static function get fps() {
return(nCurrentFPS);
}
static function startDebug(l_mcTimeline) {
mcDebug = l_mcTimeline.createEmptyMovieClip("PerformanceWatcherDebug", DEBUG_DEPTH);
mcDebug._x = (Stage.width - DEBUG_RIGHT_MARGIN) - 50;
mcDebug._y = DEBUG_TOP_MARGIN;
mcDebug.createTextField("field", 2, 0, 0, 50, 50);
var _local1 = new TextFormat();
_local1.font = DEBUG_FONT;
_local1.size = DEBUG_FONT_SIZE;
_local1.color = DEBUG_FONT_COLOR;
_local1.align = "right";
mcDebug.field.setNewTextFormat(_local1);
mcDebug.field.selectable = false;
mcDebug.createTextField("fieldShadow", 1, 1, 1, 50, 50);
var _local2 = new TextFormat();
_local2.font = DEBUG_FONT;
_local2.size = DEBUG_FONT_SIZE;
_local2.color = DEBUG_FONT_SHADOW_COLOR;
_local2.align = "right";
mcDebug.fieldShadow.setNewTextFormat(_local2);
mcDebug.fieldShadow.selectable = false;
}
static function stopDebug() {
if (mcDebug != undefined) {
mcDebug.removeMovieClip();
}
}
static function update() {
if ((++nUpdateCount) == nMovieFPS) {
computeFrameRate();
updateDebug();
notifyListeners();
}
}
static function reset() {
nUpdateCount = 0;
nLastGetTimer = getTimer();
}
static function computeFrameRate() {
var _local1 = getTimer() - nLastGetTimer;
var _local2 = _local1 / 1000;
nCurrentFPS = Math.round(nMovieFPS / _local2);
reset();
}
static function notifyListeners() {
var _local1 = new Array();
for (var _local2 in aListeners) {
if (aListeners[_local2].nMinFPS >= nCurrentFPS) {
aListeners[_local2].listener(nCurrentFPS);
if (aListeners[_local2].bDelete) {
_local1.push(aListeners[_local2].listener);
}
}
}
for (var _local2 in _local1) {
removeListener(_local1[_local2]);
}
}
static function updateDebug() {
if (mcDebug != undefined) {
mcDebug.field.text = nCurrentFPS + " fps";
mcDebug.fieldShadow.text = nCurrentFPS + " fps";
}
}
static var DEBUG_DEPTH = 123456;
static var DEBUG_RIGHT_MARGIN = 0;
static var DEBUG_TOP_MARGIN = 0;
static var DEBUG_FONT = "Verdana";
static var DEBUG_FONT_SIZE = 10;
static var DEBUG_FONT_COLOR = 16777215;
static var DEBUG_FONT_SHADOW_COLOR = 0;
static var aListeners = new Array();
}
Symbol 1498 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 1499 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 1500 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 1501 MovieClip [__Packages.HighRisk.PackagingManager] Frame 0
class HighRisk.PackagingManager
{
var mc, bMuted, bInPackaging, sGameQuality, bShadowDisabled, bInGame;
function PackagingManager (l_timeline) {
mc = l_timeline;
initButtons();
mc.stop();
_global.Snd = new SoundController(mc);
startMusicPackaging();
bMuted = false;
bInPackaging = true;
sGameQuality = "medium";
bShadowDisabled = false;
if (_global.PerformanceTestResult < 18) {
bShadowDisabled = true;
}
if (_global.PerformanceTestResult < 12) {
sGameQuality = "low";
}
_global.HUD.hide();
}
function showWinScreen() {
_global.HUD.hide();
mc._parent.gotoAndStop("Packaging2");
show("win");
}
function showLoseScreen() {
_global.HUD.hide();
mc._parent.gotoAndStop("Packaging2");
show("lose");
}
function showNextScreen() {
_global.HUD.hide();
mc._parent.gotoAndStop("Packaging2");
show("next");
}
function showMenu() {
_global.HUD.hide();
show("menu");
_global.Game.G_Pause = true;
}
function onButtonPlayAgain() {
_global.boss = false;
_global.level = 1;
_global.lives = BASE_LIVES;
_global.dragonPower = 100;
_global.energy = 100;
bInGame = true;
mc._parent.gotoAndStop("Game_LEVEL1");
hide();
_global.HUD.show();
_global.HUD.resetScore();
}
function show(l_label) {
_quality = "high";
mc.gotoAndStop(l_label);
initButtons();
if (!bInPackaging) {
startMusicPackaging();
}
bInPackaging = true;
}
function hide() {
_quality = sGameQuality;
mc.gotoAndStop("hidden");
startMusicGame();
bInPackaging = false;
}
function initButtons() {
mc.play.onRelease = mx.utils.Delegate.create(this, onButtonPlay);
mc.playagain.onRelease = mx.utils.Delegate.create(this, onButtonPlayAgain);
mc.howto.onRelease = mx.utils.Delegate.create(this, onButtonHowTo);
mc.next.onRelease = mx.utils.Delegate.create(this, onButtonNext);
mc.nextLevel.onRelease = mx.utils.Delegate.create(this, onButtonNextLevel);
mc.back.onRelease = mx.utils.Delegate.create(this, onButtonBack);
mc.backFirst.onRelease = mx.utils.Delegate.create(this, onButtonBack);
mc.hiscore.onRelease = mx.utils.Delegate.create(this, onButtonHiScore);
mc.help.onRelease = mx.utils.Delegate.create(this, onButtonHelp);
mc.quit.onRelease = mx.utils.Delegate.create(this, onButtonQuit);
mc.sound.soundOn.onRelease = mx.utils.Delegate.create(this, onButtonSound);
mc.sound.soundOff.onRelease = mx.utils.Delegate.create(this, onButtonSound);
if (bMuted) {
mc.sound.soundOn._visible = false;
mc.sound.soundOff._visible = true;
} else {
mc.sound.soundOn._visible = true;
mc.sound.soundOff._visible = false;
}
if (bInGame) {
mc.backFirst._visible = false;
mc.backShadow._visible = false;
}
}
function onButtonPlay() {
if (!bInGame) {
bInGame = true;
_global.boss = false;
_global.level = 1;
_global.lives = BASE_LIVES;
_global.dragonPower = 100;
_global.energy = 100;
mc._parent.gotoAndStop("Game_LEVEL" + _global.level);
hide();
} else {
hide();
_global.Game.G_Pause = false;
_global.HUD.show();
}
}
function onButtonHowTo() {
mc.gotoAndStop("instructions");
initButtons();
}
function onButtonNext() {
mc.nextFrame();
initButtons();
}
function onButtonNextLevel() {
_global.HUD.increaseScore(350 * _global.lives, true);
_global.HUD.increaseScore(10 * _global.energy, true);
_global.level++;
_global.boss = false;
mc._parent.gotoAndStop("Game_LEVEL" + _global.level);
hide();
_global.HUD.show();
}
function onButtonBack() {
mc.prevFrame();
initButtons();
}
function startMusicPackaging() {
_global.Snd.stopSound("music_game");
_global.Snd.playSound("music_packaging", 60, 99999999, false);
}
function startMusicGame() {
_global.Snd.stopSound("music_packaging");
_global.Snd.playSound("music_game", 60, 99999999, false);
}
function onButtonHiScore() {
mc._parent.playerScore = _global.HUD.nScore;
show("hiscore");
}
function onButtonHelp() {
show("instructions");
}
function onButtonQuit() {
showLoseScreen();
}
function onButtonSound() {
if (bMuted) {
bMuted = false;
_global.Snd.unmuteAllSounds();
} else {
bMuted = true;
_global.Snd.muteAllSounds();
}
if (bMuted) {
mc.sound.soundOn._visible = false;
mc.sound.soundOff._visible = true;
} else {
mc.sound.soundOn._visible = true;
mc.sound.soundOff._visible = false;
}
}
static var BASE_LIVES = 3;
}
Symbol 1502 MovieClip [__Packages.SoundController] Frame 0
class SoundController
{
var mcSoundFX, SOUND_FADE_SPEED, bMute, oRootSound;
function SoundController (l_mcContainer) {
l_mcContainer.createEmptyMovieClip("soundFX", 2);
l_mcContainer.createEmptyMovieClip("music", 3);
mcSoundFX = l_mcContainer.soundFX;
SOUND_FADE_SPEED = 5;
bMute = false;
oRootSound = new Sound(_root);
}
function clearSound() {
for (var _local2 in mcSoundFX) {
mcSoundFX[_local2].onEnterFrame = function () {
this.oSound.setVolume(this.oSound.getVolume() - this.oSound.SOUND_FADE_SPEED);
if (this.oSound.getVolume() <= 0) {
this.oSound.stop();
this.removeMovieClip();
}
};
}
}
function fadeOutSound(l_sLinkage) {
mcSoundFX["oClip" + l_sLinkage].onEnterFrame = function () {
this.oSound.setVolume(this.oSound.getVolume() - this.oSound.SOUND_FADE_SPEED);
if (this.oSound.getVolume() <= 0) {
this.oSound.stop();
this.removeMovieClip();
}
};
}
function stopSound(l_sID) {
mcSoundFX["oClip" + l_sID].oSound.stop(l_sID);
mcSoundFX["oClip" + l_sID].removeMovieClip();
}
function muteAllSounds() {
bMute = true;
for (var _local2 in mcSoundFX) {
mcSoundFX[_local2].initVolume = mcSoundFX[_local2].oSound.getVolume();
mcSoundFX[_local2].onEnterFrame = function () {
this.oSound.setVolume(this.oSound.getVolume() - this.oSound.SOUND_FADE_SPEED);
if (this.oSound.getVolume() <= 0) {
delete this.onEnterFrame;
}
};
}
oRootSound.setVolume(0);
}
function unmuteAllSounds() {
bMute = false;
for (var _local2 in mcSoundFX) {
mcSoundFX[_local2].onEnterFrame = function () {
this.oSound.setVolume(this.oSound.getVolume() + this.oSound.SOUND_FADE_SPEED);
if (this.oSound.getVolume() >= this.initVolume) {
delete this.onEnterFrame;
}
};
}
oRootSound.setVolume(100);
}
function playSound(l_sLinkage, l_nVolume, l_nLoop, l_bUnique) {
nNextDepth++;
if (l_nLoop == undefined) {
l_nLoop = 0;
}
if (mcSoundFX["oClip" + l_sLinkage] == undefined) {
mcSoundFX.createEmptyMovieClip("oClip" + l_sLinkage, nNextDepth);
var l_oClip = mcSoundFX["oClip" + l_sLinkage];
} else if (!l_bUnique) {
mcSoundFX.createEmptyMovieClip("oClip" + nNextDepth, nNextDepth);
var l_oClip = mcSoundFX["oClip" + nNextDepth];
}
l_oClip.oSound = new Sound(l_oClip);
var _local2 = l_oClip.oSound;
_local2.attachSound(l_sLinkage);
_local2.onSoundComplete = function () {
l_oClip.removeMovieClip();
delete l_oClip;
};
_local2.maxVolume = l_nVolume;
_local2.SOUND_FADE_SPEED = SOUND_FADE_SPEED;
if (bMute) {
l_oClip.initVolume = l_nVolume;
_local2.setVolume(0);
} else {
_local2.setVolume(l_nVolume);
}
_local2.start(0, l_nLoop);
return(_local2);
}
static var nNextDepth = 0;
}
Symbol 1503 MovieClip [__Packages.HighRisk.HUD] Frame 0
class HighRisk.HUD
{
var mc, mcFade, nScore, oScoreField, bFading, fadeListener;
function HUD (l_timeline) {
mc = l_timeline;
mcFade = mc._parent.fade;
nScore = 0;
oScoreField = new HighRisk.DigitBitmapField([mc.score1, mc.score2, mc.score3, mc.score4, mc.score5, mc.score6]);
mc.menu.onRelease = mx.utils.Delegate.create(this, onButtonMenu);
}
function update() {
mc.level.gotoAndStop(_global.level);
updateBar(mc.barPower, _global.dragonPower);
updateBar(mc.barEnergy, _global.energy);
mc.life1._visible = false;
mc.life2._visible = false;
mc.life3._visible = false;
var _local3 = 0;
while (_local3 <= _global.lives) {
mc["life" + _local3]._visible = true;
_local3++;
}
if (oScoreField.getContent() < nScore) {
oScoreField.setContent(oScoreField.getContent() + 50);
if (oScoreField.getContent() > nScore) {
oScoreField.setContent(nScore);
}
}
}
function fade(listener) {
if (!bFading) {
bFading = true;
mcFade.gotoAndPlay("out");
fadeListener = listener;
}
}
function show() {
mc._visible = true;
}
function hide() {
mc._visible = false;
}
function onFadeMiddle() {
fadeListener();
bFading = false;
}
function onButtonMenu() {
_global.Packaging.showMenu();
}
function increaseScore(l_nValue, l_bInstant) {
nScore = nScore + l_nValue;
if (l_bInstant) {
oScoreField.setContent(nScore);
}
}
function resetScore() {
nScore = 0;
}
function updateBar(l_mc, l_pc) {
l_mc.destWidth = Math.round((100 - l_pc) * 0.89);
animateBar(l_mc);
}
function animateBar(l_mc) {
if (l_mc._width < l_mc.destWidth) {
l_mc._width = l_mc._width + 1;
} else if (l_mc._width > l_mc.destWidth) {
l_mc._width = l_mc._width - 1;
}
}
}
Symbol 1504 MovieClip [__Packages.HighRisk.DigitBitmapField] Frame 0
class HighRisk.DigitBitmapField
{
var mcDigitList, nNumber;
function DigitBitmapField (l_mcDigitList) {
mcDigitList = l_mcDigitList;
setContent(0);
}
function setContent(l_number) {
nNumber = l_number;
update();
}
function getContent() {
return(nNumber);
}
function update() {
var _local3 = getNumberToPaddedString();
var _local2 = 0;
while (_local2 < mcDigitList.length) {
mcDigitList[_local2].gotoAndStop(Number(_local3.charAt(_local2)) + 1);
_local2++;
}
}
function getNumberToPaddedString() {
var _local2 = String(nNumber);
while (_local2.length < mcDigitList.length) {
_local2 = "0" + _local2;
}
return(_local2);
}
}
Symbol 1505 MovieClip [__Packages.com.sarbakan.utils.KeyManager] Frame 0
class com.sarbakan.utils.KeyManager
{
var oKeyList;
function KeyManager () {
mx.transitions.OnEnterFrameBeacon.init();
MovieClip.addListener(this);
oKeyList = new Object();
}
function onEnterFrame() {
setKey();
}
function addKeyListener(l_nKeyCode, l_sKeyName) {
oKeyList[l_sKeyName] = new Object();
oKeyList[l_sKeyName].nKeyCode = l_nKeyCode;
this[l_sKeyName] = false;
}
function setKey() {
var _local2;
for (_local2 in oKeyList) {
if (Key.isDown(oKeyList[_local2].nKeyCode)) {
this[_local2] = true;
} else {
this[_local2] = false;
}
}
}
}
Symbol 15 MovieClip [BorderBox] Frame 1
stop();
Symbol 17 MovieClip [BottomBox] Frame 1
stop();
Symbol 19 MovieClip [TopBox] Frame 1
stop();
Symbol 42 MovieClip Frame 1
_visible = false;
Symbol 60 MovieClip [JackDragon_FireAnim] Frame 1
stop();
Symbol 60 MovieClip [JackDragon_FireAnim] Frame 21
stop();
Symbol 69 MovieClip [Medusa_Blast] Frame 1
stop();
Symbol 69 MovieClip [Medusa_Blast] Frame 21
stop();
Symbol 85 MovieClip [NetBall] Frame 1
stop();
Symbol 85 MovieClip [NetBall] Frame 10
stop();
Symbol 119 MovieClip Frame 2
stop();
Symbol 126 Button
on (keyPress "<Left>") {
return(undefined);
}
on (keyPress "<Right>") {
return(undefined);
}
on (keyPress "<Up>") {
return(undefined);
}
on (keyPress "<Down>") {
return(undefined);
}
on (keyPress "<Space>") {
return(undefined);
}
Symbol 514 MovieClip Frame 1
_global.Packaging = new HighRisk.PackagingManager(this);
Instance of Symbol 199 MovieClip in Symbol 514 MovieClip Frame 11
onClipEvent (load) {
stop();
}
Instance of Symbol 294 MovieClip in Symbol 514 MovieClip Frame 12
onClipEvent (load) {
stop();
}
Instance of Symbol 400 MovieClip in Symbol 514 MovieClip Frame 14
onClipEvent (load) {
stop();
}
Instance of Symbol 400 MovieClip in Symbol 514 MovieClip Frame 14
onClipEvent (load) {
stop();
}
Symbol 514 MovieClip Frame 61
theDoge.loadMovie(_parent.fsd, 1);
Symbol 558 MovieClip Frame 1
_global.HUD = new HighRisk.HUD(this);
Symbol 560 MovieClip Frame 2
stop();
Symbol 573 MovieClip Frame 1
this._visible = false;
Symbol 573 MovieClip Frame 2
_global.Game.addAlphaZone(_parent);
stop();
Symbol 593 MovieClip Frame 2
_parent._parent._parent.Control.Creer_PBalcony(this);
stop();
Symbol 598 MovieClip Frame 1
stop();
Symbol 598 MovieClip Frame 11
stop();
Symbol 599 MovieClip Frame 2
_parent._parent._parent.Control.CreerLevier(this._name, this._x, this._y, _parent._parent._parent.Control.onSwitchLadder);
stop();
Symbol 603 MovieClip Frame 1
stop();
Symbol 603 MovieClip Frame 11
stop();
Symbol 603 MovieClip Frame 21
stop();
Symbol 604 MovieClip Frame 2
_parent._parent._parent.Control.CreerLevier(this._name, this._x, this._y, _parent._parent._parent.Control.onSwitchLift);
stop();
Symbol 609 MovieClip Frame 8
_global.Snd.playSound("ladder", 200, 1, true);
Symbol 611 MovieClip Frame 1
stop();
Symbol 612 MovieClip Frame 2
_parent._parent._parent.Control.CreerLadder(this);
stop();
Symbol 621 MovieClip Frame 2
_parent._parent._parent.Control.Creer_PBalconyOpen(this);
stop();
Symbol 641 MovieClip Frame 6
_global.Snd.playSound("chair", 100, 1, false);
Symbol 642 MovieClip Frame 1
stop();
Symbol 642 MovieClip Frame 10
stop();
Symbol 643 MovieClip Frame 2
_parent._parent._parent.Control.CreerBouncingChair(this);
stop();
Symbol 694 MovieClip Frame 1
stop();
Symbol 694 MovieClip Frame 10
stop();
Symbol 694 MovieClip Frame 20
stop();
Symbol 694 MovieClip Frame 30
stop();
Symbol 694 MovieClip Frame 40
stop();
Symbol 741 MovieClip Frame 1
stop();
Symbol 741 MovieClip Frame 10
stop();
Symbol 741 MovieClip Frame 20
stop();
Symbol 741 MovieClip Frame 30
stop();
Symbol 741 MovieClip Frame 40
stop();
Symbol 742 MovieClip Frame 1
stop();
Symbol 742 MovieClip Frame 2
stop();
Symbol 742 MovieClip Frame 11
stop();
Symbol 757 MovieClip Frame 2
_global.Snd.playSound("window", 100, 1, false);
Symbol 760 MovieClip Frame 1
stop();
Symbol 760 MovieClip Frame 10
stop();
Symbol 760 MovieClip Frame 21
stop();
Symbol 760 MovieClip Frame 31
stop();
Symbol 760 MovieClip Frame 41
stop();
Symbol 761 MovieClip Frame 2
_parent._parent._parent.Control.CreerHuntWindow(this);
stop();
Symbol 762 MovieClip Frame 1
_global.Snd.playSound("web", 100, 1, true);
Symbol 762 MovieClip Frame 20
stop();
Symbol 774 MovieClip Frame 5
stop();
Symbol 775 MovieClip Frame 1
stop();
Symbol 775 MovieClip Frame 10
stop();
Symbol 775 MovieClip Frame 21
stop();
Symbol 775 MovieClip Frame 31
stop();
Symbol 775 MovieClip Frame 41
stop();
Symbol 776 MovieClip Frame 2
_parent._parent._parent.Control.CreerDragonObstacle(this);
stop();
Symbol 792 MovieClip Frame 2
_parent._parent._parent.Control.Creer_PRoofTop(this);
stop();
Symbol 813 MovieClip Frame 1
_global.Snd.playSound("crumble", 100, 1, true);
Symbol 814 MovieClip Frame 1
stop();
Symbol 814 MovieClip Frame 10
stop();
Symbol 815 MovieClip Frame 2
_parent._parent._parent.Control.CreerWall(this);
stop();
Symbol 825 MovieClip Frame 1
_global.Snd.playSound("electric_wire", 100, 1, true);
Symbol 826 MovieClip Frame 1
stop();
Symbol 826 MovieClip Frame 10
stop();
Symbol 827 MovieClip Frame 2
_parent._parent._parent.Control.CreerDragonObstacle(this);
stop();
Symbol 838 MovieClip Frame 2
_parent._parent._parent.Control.CreerElevator(this);
stop();
Symbol 845 MovieClip Frame 2
_parent._parent._parent.Control.Creer_PBox(this);
stop();
Symbol 848 MovieClip Frame 1
stop();
Symbol 849 MovieClip Frame 2
_parent._parent._parent.Control.CreerBonus("Power", this);
stop();
Symbol 852 MovieClip Frame 1
stop();
Symbol 853 MovieClip Frame 2
_parent._parent._parent.Control.CreerBonus("Energy", this);
stop();
Symbol 857 MovieClip Frame 1
stop();
Symbol 858 MovieClip Frame 2
_parent._parent._parent.Control.CreerBonus("Score", this);
stop();
Symbol 893 MovieClip Frame 4
_global.Snd.playSound("swirl", 100, 1, false);
Symbol 925 MovieClip Frame 9
_global.Snd.playSound("blast", 100, 1, false);
Symbol 954 MovieClip Frame 4
_global.Snd.playSound("soldierAttack", 100, 1, false);
Symbol 967 MovieClip Frame 1
stop();
Symbol 967 MovieClip Frame 10
stop();
Symbol 967 MovieClip Frame 20
stop();
Symbol 967 MovieClip Frame 30
stop();
Symbol 967 MovieClip Frame 40
stop();
Symbol 968 MovieClip Frame 2
_parent._parent._parent.Control.CreerHuntSoldier(this);
Symbol 968 MovieClip Frame 3
stop();
Symbol 968 MovieClip Frame 15
stop();
Symbol 969 MovieClip Frame 1
stop();
Instance of Symbol 593 MovieClip in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 838 MovieClip "switchALift" in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
distance = 545;
}
Instance of Symbol 838 MovieClip "switchBLift" in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
distance = 435;
}
Instance of Symbol 838 MovieClip "switchCLift" in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
distance = 260;
}
Instance of Symbol 593 MovieClip in Symbol 969 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Symbol 969 MovieClip Frame 2
_parent._parent.Control.CreerFloor1(this, this._x, this._y);
stop();
Symbol 970 MovieClip Frame 2
stop();
Symbol 997 MovieClip Frame 5
_global.Snd.playSound("land", 75, 1, false);
Symbol 1055 MovieClip Frame 4
_global.Snd.playSound("jakeAttack", 100, 1, false);
Symbol 1091 MovieClip Frame 6
_global.Snd.playSound("morph", 150, 1, false);
Symbol 1093 MovieClip Frame 2
_global.Snd.playSound("morph", 150, 1, false);
Symbol 1094 MovieClip Frame 1
stop();
Symbol 1094 MovieClip Frame 8
stop();
Symbol 1094 MovieClip Frame 17
stop();
Symbol 1094 MovieClip Frame 25
stop();
Symbol 1094 MovieClip Frame 35
stop();
Symbol 1094 MovieClip Frame 44
stop();
Symbol 1094 MovieClip Frame 53
stop();
Symbol 1094 MovieClip Frame 63
stop();
Symbol 1094 MovieClip Frame 74
stop();
Symbol 1094 MovieClip Frame 83
stop();
Symbol 1094 MovieClip Frame 93
stop();
Symbol 1094 MovieClip Frame 103
stop();
Symbol 1094 MovieClip Frame 111
stop();
Symbol 1094 MovieClip Frame 121
stop();
Symbol 1094 MovieClip Frame 143
stop();
Symbol 1112 MovieClip Frame 20
stop();
Symbol 1126 MovieClip Frame 10
_global.Snd.playSound("dragonFire", 150, 1, false);
Symbol 1146 MovieClip Frame 3
_global.Snd.playSound("whip", 100, 1, false);
Symbol 1148 MovieClip Frame 5
_global.Snd.playSound("morph", 150, 1, false);
Symbol 1149 MovieClip Frame 1
stop();
Symbol 1149 MovieClip Frame 8
stop();
Symbol 1149 MovieClip Frame 17
stop();
Symbol 1149 MovieClip Frame 24
stop();
Symbol 1149 MovieClip Frame 62
stop();
Symbol 1150 MovieClip Frame 1
Obj.gotoAndStop(_parent.Control.Pers.Etat);
stop();
Symbol 1150 MovieClip Frame 2
Obj.gotoAndStop(_parent.Control.Pers.Etat);
stop();
Symbol 1150 MovieClip Frame 3
Obj.gotoAndStop(_parent.Control.Pers.Etat);
stop();
Symbol 1150 MovieClip Frame 4
Obj.gotoAndStop(_parent.Control.Pers.Etat);
stop();
Instance of Symbol 1152 MovieClip "Sol" in Symbol 1154 MovieClip Frame 1
onClipEvent (load) {
}
Instance of Symbol 560 MovieClip "Control" in Symbol 1157 MovieClip Frame 1
onClipEvent (load) {
function ObjBg(PosX, PosY) {
this.Nom = "Bg";
this.PosX = PosX;
this.PosY = PosY;
this.ParallaxPosX = 0;
this.ParallaxPosY = 0;
this.ParallaxSkyPosX = 0;
this.ParallaxSkyPosY = 0;
this.ParallaxCityPosX = 0;
this.ParallaxCityPosY = 0;
this.ParallaxRateSky = 1.2;
this.ParallaxRateCity = 1.1;
this.MoveX = 0;
this.MoveY = 0;
this.MaxDw = 0;
this.MaxUp = 0;
this.MaxG = 0;
this.MaxD = 0;
this.InvPosX = PosX * -1;
this.InvPosY = PosY * -1;
this.DeadX = PosX;
this.DeadY = PosY;
this.CurrentScreen = 1;
this.OldScreen = 0;
this.MaxYDie = 5000;
this.CenterX = 300;
this.CenterY = 370;
this.SpdXD = 15;
this.SpdXG = -15;
this.SpdYDw = 20;
this.SpdYUp = -20;
this.SpdYUpForce = 0;
this.InPause = false;
this.NoCamUpdate = false;
this.CamOnMedusa = false;
}
function ObjBox(Nom, PosX, PosY, Type, Dir) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.MoveX = 0;
this.MoveY = 0;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 75;
this.LgOutD = 525;
this.LgOutUp = 25;
this.LgOutDw = 475;
this.LgHitG = 34;
this.LgHitD = 35;
this.LgHitUp = 25;
this.LgHitDw = 26;
this.HitRightX;
this.HitLeftX;
this.PushDir = Dir;
this.Dir = Pers.Dir;
if (Dir == "D") {
_parent.Bg[1][Nom]._xscale = -100;
}
this.FlagUse = false;
this.LandSide = "Center";
this.MinionBlock = 0;
this.Etat = "Wait";
this.EtatOld = "Sleep";
this.FixedFlag = false;
_parent.Collider.Sol.attachMovie("TopBox", Nom, _parent.Collider.Sol.getNextHighestDepth());
_parent.Collider.Wall.attachMovie("BorderBox", Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Ceil.attachMovie("BottomBox", Nom, _parent.Collider.Ceil.getNextHighestDepth());
this.frTurn = 20;
this.SoundPush = false;
this.WebDestroyed = false;
this.MoveBox();
}
function ObjPers(PosX, PosY, Perso) {
this.nGetHitLeft = 0;
this.nGetHitRight = 0;
this.nGetHitTop = 0;
this.Nom = "Pers";
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.DirOld = "D";
this.Point = _global.C.Score;
this.Life = _global.C.Life;
this.SpdXMinion = 3;
this.SpdXNormal = 15;
this.SpdXBase = this.SpdXNormal;
this.SpdXNow = 0;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.FrontX = 0;
this.FrontY = 0;
this.BottomFrontX = 0;
this.BottomBackX = 0;
this.BackX = 0;
this.HitGrdPoint = 0;
this.WallHitBloc = 2;
this.SpdYNow = 0;
this.SpdYUpBase = 1.7;
this.SpdYUp = this.SpdYUpBase;
this.SpdYMax = 30;
this.SpdYFall = 2.2;
this.SpdYFly = 5;
this.SpdXHitBase = 0;
this.SpdYHitBase = -4;
this.SpdStartJump = -17;
this.SolOut = 2;
this.SolHitMin = 5;
this.MaxSol = 3;
this.HitGrd = false;
this.SolForJump = 6;
this.DistYFall = 0;
this.DistYFallMax = 900;
this.autoSwitchDragon = false;
this.DistYLand = 80;
this.CanHit = false;
this.CanBeHit = true;
this.FrWalkNow = 1;
this.InPause = false;
this.FrJump = 1;
this.FrFall = 1;
this.FrLand = 13;
this.FrGetHit = 7;
this.FrGetHitCount = 0;
this.FrBoomTir = 9;
this.FrFinBoom = 6;
this.FrDead = 20;
this.FrDeadCount = 0;
this.aCharacter = ["Jake", "Dragon"];
this.ICharacter = 0;
this.Perso = this.aCharacter[this.ICharacter];
this.updatePerso();
this.LgGetShootX = 20;
this.LgGetShootUp = 72;
this.LgGetShootUpBas = 44;
this.FrInvincibleCount = 0;
this.FrInvincible = 20;
this.Invincible = false;
this.FrSwitchCharacter = 15;
this.FrSwitchCharacterCount = 0;
this.bCanSwitch = true;
this.bJumpRelease = true;
this.SpdXBaseJumpKick = 20;
this.bComboCheck = false;
this.nFrDelayCombo = 15;
this.nFrDelayComboCount = 0;
this.bCanAttack = true;
this.bAttackRelease = true;
this.bSkipDie = false;
this.mcHitGetHurt = null;
this.HitPointX = 0;
this.HitPointY = 0;
this.nDragonPowerRythm = 25;
this.nDragonPowerCount = 0;
this.DragonHitTop = 0;
this.DragonHitBottom = 0;
this.DragonHeight = 130;
this.onLadderID = null;
this.ClimbedDistance = 0;
this.ladderDisabledMax = 15;
this.ladderDisabledCount = this.ladderDisabledMax;
this.onBouncingID = null;
this.bounceCount = 0;
this.bounceCountMax = 3;
this.bouncingDisabledMax = 15;
this.bouncingDisabledCount = this.bouncingDisabledMax;
this.bHitAttack = false;
this.FrShootFire = 15;
this.FrAttackTailHit = 9;
this.CurrentFireID = null;
if (_global.boss) {
this.WaitForActions = true;
} else {
this.WaitForActions = false;
}
}
function ObjPersBall(Type, Nom, PosX, PosY, Dir, HitBullet, Speed, Tab, HitSound, Rotation, SpdX, SpdY) {
this.Nom = Nom;
this.Type = Type;
this.HitSound = HitSound;
this.Tab = Tab;
this.Etat = "Move";
this.EtatOld = "Idle";
this.Dir = Dir;
this.OldDir = "D";
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 50;
this.LgOutD = 600;
this.LgOutUp = 0;
this.LgOutDw = 500;
this.CanBeKill = false;
if (Dir == "D") {
this.SpdX = Speed;
} else {
this.SpdX = -1 * Speed;
_parent.Bg[1][Nom]._xscale = -100;
}
this.InPause = false;
this.FrHit = HitBullet;
this.FrHide = 1;
if (Type == "Fire") {
Pers.CurrentFireID = Nom;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = Nom;
this.LgOutG = 1100;
this.LgOutD = 1100;
_parent.Bg[1][Nom]._xscale = -100;
_parent.Bg[1][Nom]._rotation = Rotation;
this.SpdX = SpdX;
this.SpdY = SpdY;
}
}
function ObjSwitch(Nom, PosX, PosY) {
this.Nom = Nom;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 20;
this.LgOnY = 20;
this.PosX = PosX;
this.PosY = PosY;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrBaisse = 13;
}
function ObjElevator(mc, Axis, Min, Max) {
this.Nom = mc._name;
this.mc = mc;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 750;
this.LgOutG = 200;
this.LgOutUp = 500;
this.LgOutDw = 900;
this.Speed = 2;
this.frWaitCount = 0;
this.frWaitTime = 30;
this.LgOnX = 200;
this.LgOnY = 25;
this.PersOn = false;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = mc._x + 40;
this.PosY = mc._y + 140;
this.Axis = Axis;
this.Min = this["Pos" + Axis] + Min;
this.Max = this["Pos" + Axis] + Max;
this.Active = false;
this.InPause = false;
this.Dir = -1;
this.CanReposition = false;
this.RepositionCount = 0;
this.RepositionDelay = 30;
_parent.Collider.Sol.attachMovie("GroundElevator", this.Nom, _parent.Collider.Sol.getNextHighestDepth());
_global.Game.CreerOverlay(mc._name + "ramp", "AM_RampeAscenseur01_overlay", {x:mc._x, y:mc._y + 140});
this.MoveElevator();
}
function ObjLevier(Nom, PosX, PosY, listener) {
this.Nom = Nom;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 30;
this.LgOnY = 100;
this.PosX = PosX;
this.PosY = PosY;
this.PersYCorrection = 60;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrFinLevelCount = 0;
this.FrFinLevel = 70;
this.Active = true;
this.listener = listener;
}
function pointsGetAngle(l_x1, l_y1, l_x2, l_y2) {
var _local4 = 0;
var _local3 = 0;
var _local1 = 0;
var _local2 = 0;
_local4 = (l_x1 - l_x2) * -1;
_local3 = (l_y1 - l_y2) * -1;
_local1 = Math.atan2(_local3, _local4);
_local1 = (_local1 * 180) / Math.PI;
if (_local1 < 0) {
_local1 = _local1 * -1;
_local2 = 180 - _local1;
_local1 = 180 + _local2;
}
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
function pointsGetDistance(l_x1, l_y1, l_x2, l_y2) {
var _local1 = Math.sqrt(Math.pow(Math.abs(l_x2 - l_x1), 2) + Math.pow(Math.abs(l_y2 - l_y1), 2));
return(_local1);
}
function ObjLadder(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.obj;
this.Etat = "Off";
this.EtatOld = "Off";
this.LgOnX = 70;
this.LgOnY = 265;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
}
function ObjBouncingChair(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.Obj;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOnX = 70;
this.LgOnY = 50;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
_global.Game.CreerPlateforme({x:this.PosX, y:this.PosY}, 73);
}
function ObjHuntSoldier(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 115;
this.AttackDelayCount = 0;
this.AttackChance = 0.03;
this.ShieldChance = 0.25;
this.HurtCount = 0;
}
function ObjHuntWindow(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "IdleClose";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 450;
this.LgOutDw = 450;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.AttackDelay = 100;
this.AttackDelayCount = 0;
if (PosX < 150) {
this.HuntID = "A";
this.FlipPosition = 20;
} else {
this.HuntID = "B";
this.FlipPosition = -20;
}
this.OpenRangeDown = 450;
this.OpenRangeUp = -20;
this.OpenChanceDragon = 0.85;
this.OpenChanceJake = 0.1;
this.HuntEtat = "idle";
this.AttackDelay = 100;
this.AttackDelayCount = 0;
this.AttackChance = 0.85;
this.FlipDelay = 10;
this.FlipDelayCount = 0;
this.CloseDelay = 100;
this.closeDelayCount = 0;
this.CloseChance = 0.5;
this.FrThrow = 11;
}
function ObjMedusa(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -60;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSparkID = null;
this.HasAttacked = false;
G_Medusa = this;
_global.Medusa = this;
}
function ObjMedusaSister(mc, Type, Nom, PosX, PosY) {
this.mc = mc;
this.Nom = Nom;
this.Perso = Type;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -110;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSister = "SisterRight";
this.CurrentAction = "Idle";
this.MedusaAttack = false;
}
function ObjWall(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
_parent.Collider.Wall.attachMovie("WallHit", this.Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Wall[Nom]._x = PosX;
_parent.Collider.Wall[Nom]._y = PosY;
this.FrRemoveWallHit = 4;
}
function ObjDragonObstacle(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
}
function ObjAntenna(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.ChargedDelay = 300;
this.ChargedCount = 0;
}
function ObjBonus(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.CanBeKill = false;
}
_global.Game = this;
this.KeyListener = new com.sarbakan.utils.KeyManager();
KeyListener.addKeyListener(39, "R");
KeyListener.addKeyListener(37, "L");
KeyListener.addKeyListener(40, "Dw");
KeyListener.addKeyListener(38, "Up");
KeyListener.addKeyListener(32, "Dragon");
KeyListener.addKeyListener(66, "Attack");
KeyListener.addKeyListener(78, "Action");
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
G_CheckPause = function () {
if ((Pers.Etat != "Die") and (Pers.Etat != "Dead")) {
if (G_PauseOut && (!G_Pause)) {
G_Pause = true;
_parent.ControlBall.stop();
_parent._parent.Popup.gotoAndStop("Pause");
if (_global.C.SoundActive) {
_global.SoundCTRL.muteAllSounds();
}
_global.C.DesactivateHud();
} else if ((G_Resume == true) and (G_Pause == true)) {
G_PauseOut = false;
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
KeyListener.Up = false;
KeyListener.UpRelease = true;
KeyListener.Dw = false;
KeyListener.L = false;
KeyListener.R = false;
KeyListener.X = false;
KeyListener.Z = false;
KeyListener.Sp = false;
Music.VolDest = 70;
Music.Etat = "FadeIn";
G_Pause = false;
G_Resume = false;
_parent._parent.Popup.gotoAndStop(1);
if (_global.C.SoundActive) {
_global.SoundCTRL.unmuteAllSounds();
}
_global.C.ActivateHud();
if (_parent.ControlBall._currentframe != 1) {
_parent.ControlBall.play();
}
}
}
};
CreerBg = function (PosX, PosY) {
this.Bg = new ObjBg(PosX, PosY);
};
ObjBg.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
CheckScreen();
if (!NoCamUpdate) {
ScrollBg();
}
}
}
};
ObjBg.prototype.ScrollBg = function () {
with (this) {
if (CamOnMedusa) {
Pers.TrueX = _global.Medusa.TrueX;
Pers.TrueY = _global.Medusa.TrueY;
}
if ((PosY <= MaxDw) and (PosY >= MaxUp)) {
if (Pers.TrueX > (CenterX + 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else {
if ((CenterX - Pers.TrueX) > SpdXG) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXG;
}
if ((PosX + MoveX) < MaxG) {
MoveX = MaxG - PosX;
}
}
} else if (Pers.TrueX < (CenterX - 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
} else {
if ((CenterX - Pers.TrueX) < SpdXD) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXD;
}
if ((PosX + MoveX) > MaxD) {
MoveX = MaxD - PosX;
}
}
} else {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
}
}
}
if ((PosX <= MaxD) and (PosX >= MaxG)) {
if (Pers.TrueY > (CenterY + 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxUp - PosY;
} else {
MoveY = SpdYDw;
}
} else {
if ((CenterY - Pers.TrueY) > SpdYUp) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYUp;
}
if ((PosY + MoveY) < MaxUp) {
MoveY = MaxUp - PosY;
}
}
} else if (Pers.TrueY < (CenterY - 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
} else {
if ((CenterY - Pers.TrueY) < SpdYDw) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYDw;
}
if ((PosY + MoveY) > MaxDw) {
MoveY = MaxDw - PosY;
}
}
} else {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYDw;
}
} else if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
}
}
}
_parent._x = Math.floor(_parent._x + MoveX);
PosX = _parent._x;
InvPosX = PosX * -1;
MoveX = 0;
_parent._y = Math.floor(_parent._y + MoveY);
PosY = _parent._y;
InvPosY = PosY * -1;
_global.MoveY = MoveY;
MoveY = 0;
_parent.ParallaxSky._y = (Math.floor(_parent._y / (-ParallaxRateSky)) + 350) + 30;
ParallaxSkyPosY = _parent.ParallaxSky._y;
_parent.ParallaxCity._y = (Math.floor(_parent._y / (-ParallaxRateCity)) + 140) + 30;
ParallaxCityPosY = _parent.ParallaxCity._y;
}
};
CreerBox = function (Nom, PosX, PosY, Type, Dir) {
if (this[Nom] == null) {
this[Nom] = new ObjBox(Nom, PosX, PosY, Type, Dir);
G_TabBox.push(Nom);
}
};
ObjBox.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBox.prototype.Wait = function () {
with (this) {
if (Type == "moveable") {
CheckPush();
}
CheckHitGrd();
CheckSleep();
CheckFall();
if (Type == "destroyable") {
CheckDestroy();
}
}
};
ObjBox.prototype.Fall = function () {
with (this) {
CheckHitGrd();
SetSpdFall();
MoveBox();
if (((Nom == "BoxDestroyWeb") && (!WebDestroyed)) && (TrueY > 350)) {
_global.Game.WebDestroyable.Etat = "Destroy";
WebDestroyed = true;
}
}
};
ObjBox.prototype.Land = function () {
with (this) {
CheckHitGrd();
SetSpdLand();
MoveBox();
if ((TrueX > 0) && (TrueX < 500)) {
_global.SoundCTRL.playSound("BoxLand", 100, 0);
}
}
};
ObjBox.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe >= _parent.Bg[1][Nom].Etat._totalframes) {
_parent.Bg[1][Nom].Etat.stop();
_parent.Collider.Sol[Nom].removeMovieClip();
_parent.Collider.Ceil[Nom].removeMovieClip();
_parent.Collider.Wall[Nom].removeMovieClip();
}
}
};
ObjBox.prototype.LandFin = function () {
with (this) {
Etat = "Wait";
Pers.PushedBox = 0;
}
};
ObjBox.prototype.Fixed = function () {
with (this) {
CheckSleep();
}
};
ObjBox.prototype.CheckPush = function () {
with (this) {
if (Pers.Etat == "Push") {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.PushPoint)) {
Dir = Pers.Dir;
if (Dir == "D") {
this.MoveX = 2;
} else if (Dir == "G") {
this.MoveX = -2;
}
CheckWall();
if (Pers.Dir != PushDir) {
MoveX = 0;
}
MoveBox();
Pers.PushedBox = this;
if (MoveX != 0) {
_global.Snd.playSound("push", 100, 999, true);
}
}
} else {
_global.Snd.stopSound("push");
}
}
};
ObjBox.prototype.CheckDestroy = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjBox.prototype.CheckHitGrd = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (_parent.Collider.Sol.hitTest(HitX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitRightX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitLeftX, HitY, true)) {
HitGrd = true;
} else {
HitGrd = false;
}
}
};
ObjBox.prototype.SetSpdFall = function () {
with (this) {
MaxMoveY = 15;
MoveY = MoveY + 5;
if (MoveY > MaxMoveY) {
MoveY = MaxMoveY;
}
aCheckPoint = [TrueX, HitLeftX, HitRightX];
for (CheckPointI in aCheckPoint) {
var activePointX = aCheckPoint[CheckPointI];
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 2), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 4), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
}
}
};
ObjBox.prototype.SetSpdLand = function () {
with (this) {
while ((_parent.Collider.Sol.hitTest(TrueX, TrueY + MoveY, true) || (_parent.Collider.Sol.hitTest(HitLeftX, TrueY + MoveY, true))) || (_parent.Collider.Sol.hitTest(HitRightX, TrueY + MoveY, true))) {
MoveY--;
}
if (MoveY < 1) {
MoveY = 1;
Etat = "LandFin";
}
}
};
ObjBox.prototype.CheckFall = function () {
with (this) {
if (HitGrd == true) {
MoveY = 0;
Etat = "Wait";
} else {
Etat = "Fall";
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
MoveX = 0;
MoveY = 0;
}
}
};
ObjBox.prototype.CheckWall = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (Pers.Dir == "G") {
HitX = HitX + (MoveX - LgHitG);
} else if (Pers.Dir == "D") {
HitX = HitX + (MoveX + LgHitD);
}
if (_parent.Collider.Wall.hitTest(HitX, HitY, true)) {
MoveX = 0;
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
}
}
};
ObjBox.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjBox.prototype.MoveBox = function () {
with (this) {
PosX = Number(PosX + MoveX);
PosY = Number(PosY + MoveY);
_parent.Bg[1][Nom]._x = PosX;
_parent.Bg[1][Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY - 15;
_parent.Collider.Wall[Nom]._x = PosX + 30;
_parent.Collider.Wall[Nom]._y = PosY + 4;
_parent.Collider.Ceil[Nom]._x = PosX;
_parent.Collider.Ceil[Nom]._y = PosY + 40;
}
};
ObjBox.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (FixedFlag) {
Etat = "Fixed";
} else {
Etat = "Wait";
}
}
}
};
ObjBox.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = (PosY + _parent._y) + LgHitDw;
HitRightX = TrueX + LgHitD;
HitLeftX = TrueX - LgHitG;
}
};
ObjBox.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if ((NewAction == "Turn") || (NewAction == "Fixed")) {
_parent.Bg[1][Nom].gotoAndStop(NewAction + Dir);
} else {
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
_parent.Bg[1][Nom].Etat.box.gotoAndStop(Type);
_parent.Bg[1][Nom].Etat.box.box.gotoAndStop(Type);
}
};
ObjBox.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
SetTruePos();
this[Etat]();
}
}
};
ObjPers.prototype.IdleJake = function () {
with (this) {
DistYFall = 0;
KeepDeadPos = true;
bCanAttack = true;
if (Life > 0) {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckPush();
CheckJump();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusJake = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.RunJake = function () {
with (this) {
bCanAttack = true;
DistYFall = 0;
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckJump();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartJake = function () {
with (this) {
Pers.bouncingDisabledCount = 0;
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
} else if (DistYFall >= DistYFallMax) {
autoSwitchDragon = true;
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingJake = function () {
with (this) {
CheckGetFire();
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (!_global.Game[onBouncingID].CheckPersOn()) {
bounceCount = 0;
Pers.onBouncingID = null;
}
if (_parent.Pers.Obj.Etat._currentframe >= 3) {
if (_global.energy <= 0) {
_global.energy = 0;
Etat = "Die";
}
}
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.ClimbingJake = function () {
with (this) {
SpdXNow = 0;
SpdYNow = 0;
CheckHitGrd();
if ((Pers.ClimbedDistance > 30) && (HitGrd)) {
Etat = "Idle";
Pers.ladderDisabledCount = 0;
} else if (KeyListener.Action) {
Etat = "Fall";
} else {
if (KeyListener.L) {
SpdXNow = -2;
} else if (KeyListener.R) {
SpdXNow = 2;
}
if (KeyListener.Up) {
SpdYNow = -3;
} else if (KeyListener.Dw) {
SpdYNow = 3;
}
SetMoveX();
SetMoveY();
CheckWall(FrontX, FrontY - 15);
CheckWall(BackX, FrontY - 15);
CheckWall(FrontX, FrontY);
CheckWall(BackX, FrontY);
CheckWall(FrontX, FrontY + 15);
CheckWall(BackX, FrontY + 15);
CheckWall(FrontX, FrontY + 30);
CheckWall(BackX, FrontY + 30);
CheckWall(FrontX, FrontY + 45);
CheckWall(BackX, FrontY + 45);
MovePers();
Pers.ClimbedDistance++;
}
if ((SpdXNow != 0) || (SpdYNow != 0)) {
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
_parent.Pers.Obj.Etat.gotoAndStop(1);
} else {
_parent.Pers.Obj.Etat.nextFrame();
}
} else {
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.ActivateJake = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.HurtJake = function () {
with (this) {
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetJake = function () {
with (this) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
}
};
ObjPers.prototype.AttackJake = function () {
with (this) {
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == Math.round(_parent.Pers.Obj.Etat._totalframes / 2)) {
bHitAttack = true;
} else {
bHitAttack = false;
}
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.GetHitJake = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireJake = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformJake = function () {
with (this) {
DistYFall = 0;
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 1;
Etat = "Idle";
nDragonPowerCount = 0;
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.PushJake = function () {
with (this) {
CheckHitGrd();
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (!KeyListener.Action) {
Etat = "Idle";
} else if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (PushedBox != 0) {
MoveX = PushedBox.MoveX;
} else {
MoveX = 0;
}
} else {
var AddBlock = (35 * NumDir);
var i = 0;
while (i != AddBlock) {
if (_parent.Collider.Wall.hitTest(PushPointX + i, PushPointY, true)) {
goToTarget = true;
if (((i > 5) && (NumDir == 1)) || ((i < -5) && (NumDir == -1))) {
MoveX = 5 * NumDir;
} else {
MoveX = i;
}
break;
}
i = i + NumDir;
}
}
MovePers();
}
};
ObjPers.prototype.TransformFallJake = ObjPers.prototype.TransformJake;
ObjPers.prototype.DieJake = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
if (FrDeadCount == 0) {
_global.lives--;
_global.Snd.stopSound("lift");
_global.Snd.stopSound("push");
if (_global.lives == 0) {
_global.Packaging.showLoseScreen();
} else {
_global.HUD.fade(resetLevel);
}
}
FrDeadCount++;
}
}
};
ObjPers.prototype.SleepJake = function () {
};
ObjPers.prototype.IdleDragon = function () {
with (this) {
bCanAttack = true;
KeepDeadPos = true;
if (Life > 0) {
SetSpdDragon();
SetMoveX();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdDragon();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusDragon = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.FlyDragon = function () {
with (this) {
bCanAttack = true;
SetSpdDragon();
SetMoveX();
SetMoveY();
CheckDragonObstacle();
CheckWall(FrontX, FrontY);
CheckCeilDragon();
CheckSolDragon();
CheckGroundDragon();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartDragon = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
this["CheckAttack" + Perso]();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingDragon = function () {
with (this) {
CheckGetFire();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe >= this.nFrTotalAnim) {
if (Life <= 0) {
Etat = "Die";
} else {
Etat = "Idle";
}
}
}
};
ObjPers.prototype.HurtDragon = function () {
with (this) {
MovePers();
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
Etat = "Idle";
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetDragon = ObjPers.prototype.HurtDragon;
ObjPers.prototype.AttackTailDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrAttackTailHit) {
bHitAttack = true;
} else {
bHitAttack = false;
}
}
};
ObjPers.prototype.AttackFireDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrShootFire) {
if (Dir == "D") {
CreerFireBall(PosX + 70, PosY - 70, Dir);
} else {
CreerFireBall(PosX - 70, PosY - 70, Dir);
}
}
}
};
ObjPers.prototype.GetHitDragon = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireDragon = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 0;
Etat = "Fall";
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.DieDragon = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
FrDeadCount++;
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.SleepDragon = function () {
};
CreerPers = function (PosX, PosY, Perso) {
this.Pers = new ObjPers(PosX, PosY, Perso);
};
ObjPers.prototype.CharacterSwitch = function () {
with (this) {
if (Etat == "Fall") {
Etat = "TransformFall";
} else {
Etat = "Transform";
}
}
};
ObjPers.prototype.HeroChange = function (NewHero) {
with (this) {
Perso = NewHero;
updatePerso();
}
};
ObjPers.prototype.GetHitGeneral = function () {
with (this) {
SetSpdXHit();
CheckWall(BackX, TrueY);
CheckHitGrd();
CheckSol();
MovePers();
CheckDie();
}
};
ObjPers.prototype.CheckGetFire = function () {
with (this) {
var NbMinionBall = G_TabMinionBall.length;
if ((NbMinionBall > 0) && (Perso != "TuesdayDisguised")) {
var i = 0;
while (i < NbMinionBall) {
var BallX = _parent.Control[G_TabMinionBall[i]].PosX;
var BallY = _parent.Control[G_TabMinionBall[i]].PosY;
if (((((BallX >= (PosX - GetFireG)) and (BallX <= (PosX + GetFireD))) and (BallY >= (PosY - GetFireUp))) and (BallY <= (PosY + GetFireDw))) && (!Invincible)) {
Etat = "GetFire";
if (_parent.Control[G_TabMinionBall[i]].Dir == "D") {
Dir = "G";
} else if (_parent.Control[G_TabMinionBall[i]].Dir == "G") {
Dir = "D";
}
_parent.Control[G_TabMinionBall[i]].Etat = "Hit";
}
i++;
}
}
}
};
ObjPers.prototype.InvincibleInit = function () {
with (this) {
Invincible = true;
}
};
ObjPers.prototype.InvincibleEnd = function () {
with (this) {
Invincible = false;
FrInvincibleCount = 0;
_parent.Pers._visible = true;
}
};
ObjPers.prototype.InvincibleCheck = function () {
with (this) {
if (Invincible) {
if (FrInvincibleCount >= FrInvincible) {
InvincibleEnd();
CanBeHit = true;
} else {
FrInvincibleCount++;
if ((FrInvincibleCount % 3) == 0) {
_parent.Pers._visible = !_parent.Pers._visible;
}
}
}
}
};
ObjPers.prototype.SetSpdXHit = function () {
with (this) {
MoveX = SpdXNow;
if (SpdXNow > 0) {
SpdXNow = SpdXNow * 0.7;
}
if (Dir eq "D") {
MoveX = MoveX * -1;
}
}
};
ObjPers.prototype.SetSpdXJake = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX - WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase * -1;
}
} else {
Etat = "Idle";
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdDragon = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (KeyListener.Dw == true) {
SpdYNow = SpdYFly;
} else if (KeyListener.Up == true) {
SpdYNow = SpdYFly * -1;
} else {
SpdYNow = 0;
}
if ((SpdXNow == 0) && (SpdYNow == 0)) {
Etat = "Idle";
} else {
Etat = "Fly";
}
}
};
ObjPers.prototype.SetSpdXJump = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(TrueX + WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(TrueX - WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdXJumpKick = function () {
with (this) {
if (Dir == "G") {
if (SpdXNow < -5) {
SpdXNow = SpdXNow + 2;
} else {
SpdXNow = -5;
}
} else if (Dir == "D") {
if (SpdXNow > 5) {
SpdXNow = SpdXNow - 2;
} else {
SpdXNow = 5;
}
}
}
};
ObjPers.prototype.SetMoveX = function () {
with (this) {
MoveX = SpdXNow;
}
};
ObjPers.prototype.SetMoveY = function () {
with (this) {
MoveY = SpdYNow;
}
};
ObjPers.prototype.CheckWall = function (CoordX, CoordY) {
with (this) {
if (MoveX != 0) {
if (MoveX > 0) {
var WallStop = WallHitBloc;
} else {
var WallStop = (-1 * WallHitBloc);
}
var WallHit1 = (MoveX / 3);
var WallHit2 = (WallHit1 * 2);
var WallHit3 = (WallHit1 * 4);
if (_parent.Collider.Wall.hitTest(CoordX + WallStop, CoordY, true)) {
MoveX = 0;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit1, CoordY, true)) {
MoveX = WallHitBloc;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit2, CoordY, true)) {
MoveX = WallHit1;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit3, CoordY, true)) {
MoveX = WallHit2;
} else if (_parent.Collider.Wall.hitTest(CoordX + MoveX, CoordY, true)) {
MoveX = WallHit2;
}
}
}
};
ObjPers.prototype.CheckDragonObstacle = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Dragon.hitTest(TopX, TopY + MoveY, true)) {
MoveY = DragonHitTop;
} else if (_parent.Collider.Dragon.hitTest(BottomFrontX, (TopY + MoveY) + DragonHeight, true) or _parent.Collider.Dragon.hitTest(BottomBackX, (TopY + MoveY) + DragonHeight, true)) {
MoveY = DragonHitBottom;
}
}
}
};
ObjPers.prototype.CheckCeil = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
Etat = "Fall";
DistYFall = 0;
}
}
}
};
ObjPers.prototype.CheckSolDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Sol.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckCeilDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
}
}
}
};
ObjPers.prototype.CheckGroundDragon = function () {
with (this) {
if (MoveY > 0) {
if (_parent.Collider.Sol.hitTest(BottomFrontX, TrueY - _parent.Pers.Obj.HitBottomFront._y, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckJump = function () {
with (this) {
if (Etat != "Push") {
if ((!KeyListener.Up) && (!bJumpRelease)) {
bJumpRelease = true;
}
if (((KeyListener.Up == true) && (HitGrd == true)) && (bJumpRelease)) {
bJumpRelease = false;
if (Etat == "Run") {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
} else {
Etat = "JumpStart";
}
}
}
}
};
ObjPers.prototype.CheckPush = function () {
with (this) {
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (KeyListener.Action && (((Dir == "G") && (KeyListener.L)) || ((Dir == "D") && (KeyListener.R)))) {
Etat = "Push";
}
}
}
};
ObjPers.prototype.CheckAttackJake = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "Attack";
}
}
};
ObjPers.prototype.CheckAttackDragon = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackTail";
}
if ((KeyListener.Action == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackFire";
}
}
};
ObjPers.prototype.CheckFall = function () {
with (this) {
if (SpdYNow >= SpdYFall) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.CheckDie = function () {
with (this) {
if (_global.energy <= 0) {
_global.dragonPower = 0;
Etat = "Fall";
}
}
};
ObjPers.prototype.MovePers = function () {
with (this) {
if ((Pers.TrueX + MoveX) < 30) {
MoveX = (TrueX * -1) + 30;
} else if ((Pers.TrueX + MoveX) > 520) {
MoveX = 520 - Pers.TrueX;
}
PosX = _parent.Pers._x + MoveX;
_parent.Pers._x = PosX;
MoveX = 0;
PosY = _parent.Pers._y + MoveY;
_parent.Pers._y = PosY;
MoveY = 0;
}
};
ObjPers.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
TopX = TrueX;
TopY = TrueY + _parent.Pers.Obj.HitTop._y;
FrontX = _parent.Pers.Obj.HitFront._x;
FrontY = TrueY + _parent.Pers.Obj.HitFront._y;
BottomFrontX = _parent.Pers.Obj.HitBottomFront._x;
BottomBackX = _parent.Pers.Obj.HitBottomBack._x;
BackX = _parent.Pers.Obj.HitBack._x;
if (Dir == "G") {
FrontX = TrueX - FrontX;
BottomFrontX = TrueX - BottomFrontX;
BottomBackX = TrueX - BottomBackX;
BackX = TrueX - BackX;
} else if (Dir == "D") {
FrontX = TrueX + FrontX;
BottomFrontX = TrueX + BottomFrontX;
BottomBackX = TrueX + BottomBackX;
BackX = TrueX + BackX;
}
}
};
ObjPers.prototype.CheckHitGrd = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = TrueX;
CheckY = TrueY;
aCheckPoints = [CheckX, BottomFrontX, BottomBackX];
} else {
aCheckPoints = [CheckX];
}
for (var i in aCheckPoints) {
if (_parent.Collider.Sol.hitTest(aCheckPoints[i], CheckY + MaxSol, true) and (SpdYNow >= 0)) {
HitGrd = true;
HitGrdPoint = aCheckPoints[i];
if ((onBouncingID != null) && (_global.Game[onBouncingID].CheckPersOn() != true)) {
Pers.SpdYUp = Pers.SpdYUpBase;
}
break;
}
HitGrd = false;
HitGrdPoint = TrueX;
}
}
};
ObjPers.prototype.CheckSol = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = HitGrdPoint;
CheckY = TrueY;
}
if (_parent.Collider.Sol.hitTest(CheckX, CheckY, true) and (SpdYNow >= 0)) {
SpdYNow = 0;
var InSol = true;
while (InSol == true) {
MoveY = MoveY - SolOut;
InSol = _parent.Collider.Sol.hitTest(CheckX, CheckY + MoveY, true);
}
} else if (SpdYNow >= 0) {
if (HitGrd == true) {
SpdYNow = 0;
MoveY = SpdYNow;
} else {
SpdYNow = SpdYNow + SpdYUp;
if (Etat == "JumpKick") {
SpdYNow = SpdYNow + 1;
}
if (SpdYNow > SpdYMax) {
SpdYNow = SpdYMax;
}
var SolHit1 = (SpdYNow / 3);
var SolHit2 = (SolHit1 * 2);
if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit1, true)) {
MoveY = SolHitMin;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit2, true)) {
MoveY = SolHit1;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SpdYNow, true)) {
MoveY = SolHit2;
} else {
MoveY = SpdYNow;
}
}
} else {
SpdYNow = SpdYNow + SpdYUp;
MoveY = SpdYNow;
}
if (MoveY > 0) {
DistYFall = DistYFall + MoveY;
}
}
};
ObjPers.prototype.setState = function (l_sNewState) {
with (this) {
EtatOld = Etat;
Etat = l_sNewState;
var nOldTransformFr = _parent.Pers.Obj.Transform._currentframe;
_parent.Pers.Obj.gotoAndStop(l_sNewState);
_parent.Pers.Obj.Etat.gotoAndPlay(1);
this.nFrTotalAnim = _parent.Pers.Obj.Etat._totalframes;
_parent.Pers.Obj.Transform.gotoAndStop(1);
if ((Etat == "Die") && (bSkipDie)) {
_parent.Pers.Obj.Etat.gotoAndPlay(9);
}
if ((nOldTransformFr < 15) && (nOldTransformFr > 5)) {
_parent.Pers.Obj.Transform.gotoAndPlay(nOldTransformFr);
}
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
}
};
ObjPers.prototype.updatePerso = function () {
var nCurrentFrame;
with (this) {
nCurrentFrame = _parent.Pers.Obj.Etat._currentframe;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
_parent.Pers.Obj.Etat.gotoAndPlay(nCurrentFrame);
nGetHitLeft = -1 * _parent.Pers.Obj.HitBack._x;
nGetHitRight = _parent.Pers.Obj.HitFront._x;
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
ComboKick = 0;
mcHitGetHurt = _parent.Pers.Obj.HitGetHurt;
}
};
ObjPers.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
}
};
ObjPers.prototype.Actions = function () {
with (this) {
if (WaitForActions) {
SetTruePos();
CheckHitGrd();
CheckSol();
CheckFall();
WaitForActions = false;
} else if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Pers.Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Pers.Obj.Etat.play();
}
SetTruePos();
InvincibleCheck();
this[Etat + aCharacter[ICharacter]]();
CheckCharSwitch();
CheckHit();
CheckEndLevel();
}
}
};
ObjPers.prototype.CheckCharSwitch = function () {
with (this) {
if (ICharacter == 1) {
if ((KeyListener.Dragon || (_global.dragonPower == 0)) && (Etat != "HurtNet")) {
CharacterSwitch();
} else if ((++nDragonPowerCount) == nDragonPowerRythm) {
_global.dragonPower--;
nDragonPowerCount = 0;
if (_global.dragonPower < 0) {
_global.dragonPower = 0;
}
}
} else {
if (((KeyListener.Dragon || (autoSwitchDragon)) && (bCanSwitch)) && (_global.dragonPower > 0)) {
autoSwitchDragon = false;
bCanSwitch = false;
FrSwitchCharacterCount = FrSwitchCharacter;
CharacterSwitch();
}
if (!bCanSwitch) {
FrSwitchCharacterCount--;
if (FrSwitchCharacterCount == 0) {
bCanSwitch = true;
}
}
}
}
};
ObjPers.prototype.CheckEndLevel = function () {
with (this) {
if (!_global.boss) {
if (((_global.level == 1) && (PosY <= -3930)) && (PosX >= 390)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if ((_global.level == 2) && (PosY <= -4670)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if (((_global.level == 3) && (PosY <= -5800)) && (PosX <= 105)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
}
}
};
ObjPers.prototype.CheckHit = function () {
with (this) {
if (KeyListener.X && (CanBeHit)) {
this.GetHit();
}
}
};
CreerNetBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("NetBall", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Net", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerFireBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("JackDragon_FireAnim", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Fire", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerSparkBall = function (PosX, PosY, Dir, Rotation, SpdX, SpdY) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("Medusa_Blast", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Spark", _local4, PosX, PosY, Dir, 8, 0, G_TabPersBall, "SlimeSplat", Rotation, SpdX, SpdY);
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
ObjPersBall.prototype.Move = function () {
with (this) {
_parent.Bg[1][Nom]._x = PosX + SpdX;
PosX = PosX + SpdX;
if (SpdY) {
_parent.Bg[1][Nom]._y = PosY + SpdY;
PosY = PosY + SpdY;
}
SetTruePos();
CheckHit();
CheckOut();
}
};
ObjPersBall.prototype.Hit = function () {
with (this) {
if ((Type == "Net") && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
Pers.Etat = "HurtNet";
_global.Snd.playSound("hurtNet", 100, 1, false);
CanBeKill = true;
}
}
};
ObjPersBall.prototype.End = function () {
with (this) {
if (((Type == "Fire") || (Type == "Spark")) && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.Burn = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckHit = function () {
with (this) {
if (Type == "Net") {
if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Burn";
_global.Game[Pers.CurrentFireID].Etat = "End";
} else if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.Hit))) {
Etat = "Hit";
}
}
if (((Type == "Spark") && (Pers.Etat != "Activate")) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.HitFront))) {
Pers.Etat = "Hurt";
Etat = "End";
}
if (((Type == "Spark") && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1].FinalHit))) && (G_Medusa.Etat != "Die")) {
_global.HUD.increaseScore(10000);
_parent.Control.Bg.CamOnMedusa = true;
G_Medusa.Etat = "Die";
}
}
};
ObjPersBall.prototype.CheckOut = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckKill = function () {
with (this) {
if (CanBeKill == true) {
KillBall();
}
}
};
ObjPersBall.prototype.KillBall = function () {
with (this) {
if (Tab == G_TabPersBall) {
G_TabPersBall.splice(PersBallI, 1);
PersBallI = PersBallI - 1;
} else if (Tab == G_TabMinionBall) {
G_TabMinionBall.splice(MinionBallI, 1);
MinionBallI = MinionBallI - 1;
}
delete _parent.Control[Nom];
_parent.Bg[1][Nom].removeMovieClip();
if (Type == "Fire") {
Pers.CurrentFireID = null;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = null;
}
}
};
ObjPersBall.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjPersBall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
};
ObjPersBall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Etat.play();
}
this[Etat]();
CheckKill();
}
}
};
CreerSwitch = function (Nom, PosX, PosY) {
if (this[Nom] == null) {
this[Nom] = new ObjSwitch(Nom, PosX, PosY);
G_TabSwitch.push(Nom);
}
};
ObjSwitch.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjSwitch.prototype.Idle = function () {
with (this) {
CheckPersOn();
CheckBoxOn();
CheckSleep();
}
};
ObjSwitch.prototype.Baisse = function () {
with (this) {
if (_parent[Nom].Etat._currentframe >= FrBaisse) {
_global.SoundCTRL.playSound("SwitchOn", 100, 0);
_parent[Nom].Activate();
Etat = "Active";
}
}
};
ObjSwitch.prototype.Active = function () {
with (this) {
CheckSleep();
if (!FlagBoxUse) {
CheckRelease();
}
}
};
ObjSwitch.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
FlagUse = true;
Etat = "Baisse";
}
}
};
ObjSwitch.prototype.CheckBoxOn = function () {
with (this) {
var Box = Pers.PushedBox;
if ((Pers.Etat == "Push") && (Box != 0)) {
if (Box.Dir == "G") {
if (((((Box.PosX - Box.LgHitG) >= (PosX - LgOnX)) and ((Box.PosX - Box.LgHitG) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Etat = "Baisse";
Activate();
}
} else if (Box.Dir == "D") {
if (((((Box.PosX + Box.LgHitD) >= (PosX - LgOnX)) and ((Box.PosX + Box.LgHitD) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
} else if ((Box.Etat == "LandFin") && (Box != 0)) {
if ((((Box.PosX >= (PosX - LgOnX)) and (Box.PosX <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
Box.Dir = "";
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
}
};
ObjSwitch.prototype.CheckRelease = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
} else {
Etat = "Idle";
FlagUse = false;
_parent[Nom].Desactivate();
_global.SoundCTRL.playSound("SwitchOff", 100, 0);
}
}
};
ObjSwitch.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjSwitch.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjSwitch.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjSwitch.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerElevator = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjElevator(l_mcElement, "Y", 0, -1 * l_mcElement.distance);
G_TabElevator.push(l_mcElement._name);
}
};
this.onSwitchLift = function (l_Nom) {
with (this) {
if (_global.Game[l_Nom + "Lift"].Active == true) {
_global.Game[l_Nom + "Lift"].Active = false;
_global.Game[l_Nom].Etat = "Idle";
_global.Snd.stopSound("lift");
} else {
_global.Game[l_Nom + "Lift"].Active = true;
_global.Game[l_Nom].Etat = "IdleActivate";
_global.Snd.playSound("lift", 100, 999, true);
}
}
};
ObjElevator.prototype.Sleep = function () {
with (this) {
CheckActif();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Idle = function () {
with (this) {
CheckSleep();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Wait = function () {
with (this) {
if (frWaitCount >= frWaitTime) {
Etat = "Idle";
frWaitCount = 0;
} else {
frWaitCount++;
}
}
};
ObjElevator.prototype.SetMove = function () {
with (this) {
CheckPersOn();
CheckLimit();
MoveElevator();
}
};
ObjElevator.prototype.MoveElevator = function () {
with (this) {
this["Pos" + Axis] = this["Pos" + Axis] + this["Move" + Axis];
_parent[Nom]._x = PosX;
_parent[Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY;
if (PersOn) {
Pers["Move" + Axis] = this["Move" + Axis];
Pers.MovePers();
}
UpdateLift();
}
};
ObjElevator.prototype.UpdateLift = function () {
with (this) {
var cableH = (this["Pos" + Axis] - Max);
mc.Obj.cable1._height = cableH;
mc.Obj.cable2._height = cableH;
mc._y = mc._y + this["Move" + Axis];
mc._parent[Nom.substr(0, -4)]._y = mc._parent[Nom.substr(0, -4)]._y + this["Move" + Axis];
_global.Game[Nom.substr(0, -4)].PosY = _global.Game[Nom.substr(0, -4)].PosY + this["Move" + Axis];
_global.Game._parent.overlay[Nom + "ramp"]._y = _global.Game._parent.overlay[Nom + "ramp"]._y + this["Move" + Axis];
_global.Game._parent.Bg[1][Nom + "ramp"]._y = _global.Game._parent.Bg[1][Nom + "ramp"]._y + this["Move" + Axis];
}
};
ObjElevator.prototype.CheckLimit = function () {
with (this) {
this["Move" + Axis] = Speed * Dir;
if ((Dir == -1) && ((this["Pos" + Axis] + this["Move" + Axis]) <= Max)) {
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = false;
CanReposition = true;
RepositionCount = 0;
Dir = 0;
}
if ((Dir == 1) && ((this["Pos" + Axis] + this["Move" + Axis]) >= Min)) {
CanReposition = false;
Dir = -1;
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = true;
_global.Game[Nom.substr(0, -4)].Etat = "Idle";
}
}
};
ObjElevator.prototype.CheckReposition = function () {
with (this) {
if (CanReposition) {
CheckPersOn();
if (!PersOn) {
if ((++RepositionCount) == RepositionDelay) {
RepositionCount = 0;
CanReposition = false;
Active = true;
Dir = 1;
_global.Snd.playSound("lift", 100, 999, true);
}
}
}
}
};
ObjElevator.prototype.Activate = function () {
with (this) {
Active = true;
}
};
ObjElevator.prototype.Desactivate = function () {
with (this) {
Active = false;
}
};
ObjElevator.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
PersOn = true;
} else {
PersOn = false;
}
}
};
ObjElevator.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
Etat = "Idle";
if (Active) {
CheckLimit();
MoveElevator();
}
}
}
};
ObjElevator.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjElevator.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjElevator.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLevier = function (Nom, PosX, PosY, listener) {
if (this[Nom] == null) {
this[Nom] = new ObjLevier(Nom, PosX, PosY, listener);
G_TabLevier.push(Nom);
}
};
ObjLevier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjLevier.prototype.Idle = function () {
with (this) {
if (Active) {
CheckPersOn();
CheckSleep();
}
}
};
ObjLevier.prototype.IdleActivate = ObjLevier.prototype.Idle;
ObjLevier.prototype.Activate = function () {
with (this) {
if (Pers.ICharacter == 0) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.Etat == "Activate")) && (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes)) {
listener(Nom);
}
}
}
};
ObjLevier.prototype.CheckPersOn = function () {
with (this) {
if ((Pers.ICharacter == 0) && (Pers.Etat != "Push")) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.HitGrd == true)) && (Pers.CanBeHit || (Pers.Invincible))) {
if (KeyListener.Action) {
Pers.canJumpCount = 0;
Etat = "Activate";
Pers.Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
}
}
} else if (((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
} else if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
};
ObjLevier.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjLevier.prototype.CheckSleep = function () {
};
ObjLevier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjLevier.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLadder = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjLadder(l_mcElement);
G_TabLadder.push(l_mcElement._name);
}
};
this.onSwitchLadder = function (l_Nom) {
with (this) {
_global.Game[l_Nom + "Ladder"].Etat = "Opening";
}
};
ObjLadder.prototype.Off = function () {
with (this) {
}
};
ObjLadder.prototype.Opening = function () {
with (this) {
if (mc.etat._currentframe == mc.etat._totalframes) {
Etat = "On";
}
}
};
ObjLadder.prototype.On = function () {
with (this) {
CheckPersOn();
}
};
ObjLadder.prototype.CheckPersOn = function () {
with (this) {
if (Pers.ladderDisabledCount >= Pers.ladderDisabledMax) {
if (((((Pers.PosX >= PosX) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= PosY)) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
if (((Pers.ICharacter == 0) && (Pers.Etat != "Climbing")) && (Pers.Etat != "Hurt")) {
if ((KeyListener.Up && (Pers.PosY >= (PosY + 70))) || (KeyListener.Dw && (Pers.PosY <= (PosY + 165)))) {
Pers.onLadderID = Nom;
Pers.Etat = "Climbing";
Pers.ClimbedDistance = 0;
}
}
} else if ((Pers.Etat == "Climbing") && (Pers.onLadderID == Nom)) {
if (Pers.PosX < PosX) {
Pers.ChangeDir("G");
}
if (Pers.PosX > (PosX + LgOnX)) {
Pers.ChangeDir("D");
}
Pers.Etat = "Fall";
Pers.onLadderID = null;
}
} else {
Pers.ladderDisabledCount++;
}
}
};
ObjLadder.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjLadder.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerBouncingChair = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBouncingChair(l_mcElement);
G_TabChair.push(l_mcElement._name);
}
};
ObjBouncingChair.prototype.Idle = function () {
with (this) {
if (CheckPersOn()) {
Etat = "Bounce";
if ((Pers.onBouncingID == Nom) && (Pers.HitGrd)) {
Pers.onBouncingID = null;
}
}
}
};
ObjBouncingChair.prototype.Bounce = function () {
with (this) {
if (mc.Etat._currentframe == 9) {
BouncePers();
}
if (mc.Etat._currentframe == mc.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjBouncingChair.prototype.CheckPersOn = function () {
with (this) {
if ((((((((Pers.ICharacter == 0) && (Pers.Etat != "Idle")) && (Pers.Etat != "Run")) and (Pers.PosX >= PosX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
return(true);
}
}
};
ObjBouncingChair.prototype.BouncePers = function () {
with (this) {
if (CheckPersOn()) {
Pers.SpdYUp = Pers.SpdYUpBase;
if (Pers.onBouncingID != Nom) {
Pers.onBouncingID = Nom;
Pers.bounceCount = 0;
} else {
Pers.bounceCount++;
if (Pers.bounceCount > 0) {
Pers.bounceCount = Pers.bounceCountMax;
}
Pers.SpdYUp = Pers.SpdYUp - (Pers.bounceCount * 0.34);
}
Pers.Etat = "JumpStart";
} else if (Pers.HitGrd) {
Pers.onBouncingID = null;
}
}
};
ObjBouncingChair.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjBouncingChair.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerHuntSoldier = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntSoldier";
this[l_mcElement._name] = new ObjHuntSoldier(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntSoldier.push(l_mcElement._name);
}
};
ObjHuntSoldier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntSoldier.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckShield();
CheckDir();
CheckHurt();
CheckSleep();
}
};
ObjHuntSoldier.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Stunned = ObjHuntSoldier.prototype.Hurt;
ObjHuntSoldier.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack1 = function () {
with (this) {
if (((Pers.Etat != "Hurt") && (_parent.Bg[1][Nom].Obj.Etat._currentframe >= 9)) && (_parent.Bg[1][Nom].Obj.Etat._currentframe <= 25)) {
if (_parent.Bg[1][Nom].Obj.Etat.wave.hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack2 = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 7) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
_global.Snd.playSound("hurtJake", 100, 1, false);
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjHuntSoldier.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if ((Etat != "Shield") && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
if ((++HurtCount) == 3) {
enemyHitScore();
Etat = "Stunned";
HurtCount = 0;
} else {
Etat = "Hurt";
}
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
}
};
ObjHuntSoldier.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjHuntSoldier.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Math.abs(Pers.PosY - PosY) < 180) && (Math.random() < AttackChance)) {
if (Math.abs(Pers.PosX - PosX) < 150) {
Etat = "Attack2";
} else {
Etat = "Attack1";
}
AttackDelayCount = 0;
}
}
};
ObjHuntSoldier.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntSoldier.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjHuntSoldier.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntSoldier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjHuntSoldier.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerHuntWindow = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntWindow";
this[l_mcElement._name] = new ObjHuntWindow(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntWindow.push(l_mcElement._name);
}
};
ObjHuntWindow.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntWindow.prototype.IdleClose = function () {
with (this) {
CheckCanOpen();
CheckSleep();
}
};
ObjHuntWindow.prototype.IdleOpen = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt._currentframe == 1) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.gotoAndStop(HuntID);
SetHuntEtat("Appear");
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
}
if ((HuntEtat == "Appear") && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
SetHuntEtat("idle");
}
if (HuntEtat == "idle") {
CheckFlip();
CheckAttack();
}
if (((HuntEtat == "disappear") || (HuntEtat == "flee")) && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat.stop();
Etat = "Close";
if (HuntEtat == "flee") {
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = -80;
}
}
if (HuntEtat == "Throw") {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes) {
SetHuntEtat("idle");
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == FrThrow) {
var l_dir = "G";
if (HuntID == "A") {
l_dir = "D";
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
if (l_dir == "D") {
l_dir = "G";
} else {
l_dir = "D";
}
}
var l_netY = 70;
if (PosY < Pers.TrueY) {
l_netY = l_netY + (Math.abs(Pers.PosY - TrueY) - 150);
} else {
l_netY = l_netY - Math.abs(Pers.PosY - TrueY);
}
if (l_netY > 120) {
l_netY = 120;
}
if (l_netY < 20) {
l_netY = 20;
}
CreerNetBall(PosX, PosY + l_netY, l_dir);
_global.Snd.playSound("net", 130, 1, false);
}
}
CheckCanClose();
CheckHurt();
CheckSleep();
}
};
ObjHuntWindow.prototype.Open = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleOpen";
AttackDelayCount = AttackDelay * 0.9;
}
}
};
ObjHuntWindow.prototype.Close = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleClose";
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
}
};
ObjHuntWindow.prototype.CheckCanOpen = function () {
with (this) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == null) {
if (_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] >= _global.Game.G_WindowOpenDelay) {
if ((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown))) {
if (((Pers.ICharacter == 0) && (Math.random() <= OpenChanceJake)) || ((Pers.ICharacter == 1) && (Math.random() <= OpenChanceDragon))) {
Etat = "Open";
_global.Game["G_HuntWindowCurrent" + HuntID] = Nom;
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = 0;
}
}
}
}
}
};
ObjHuntWindow.prototype.CheckCanClose = function () {
with (this) {
if (CloseDelayCount < CloseDelay) {
CloseDelayCount++;
} else if ((HuntEtat != "disappear") && ((!((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown)))) || ((Pers.ICharacter == 0) && (Math.random() <= CloseChance)))) {
if (Math.random() <= OpenChance) {
SetHuntEtat("disappear");
CloseDelayCount = 0;
}
}
}
};
ObjHuntWindow.prototype.CheckFlip = function () {
with (this) {
if (FlipDelayCount < FlipDelay) {
FlipDelayCount++;
} else {
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
FlipDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Pers.ICharacter == 1) && (Math.abs(Pers.PosY - PosY) < 300)) {
SetHuntEtat("Throw");
AttackDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckHurt = function () {
with (this) {
if ((((HuntEtat == "idle") || (HuntEtat == "Throw")) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].Obj.hitTest(_parent.Pers.Obj.HitFront))) {
SetHuntEtat("flee");
enemyHitScore();
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
};
ObjHuntWindow.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "IdleClose";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntWindow.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == Nom) {
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
Etat = "Sleep";
}
}
};
ObjHuntWindow.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntWindow.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.window.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.overlay.gotoAndStop(G_CurrentLevel);
}
};
ObjHuntWindow.prototype.SetHuntEtat = function (newEtat) {
with (this) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.gotoAndStop(newEtat);
HuntEtat = newEtat;
}
};
ObjHuntWindow.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusa = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "Medusa";
this[l_mcElement._name] = new ObjMedusa(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusa.push(l_mcElement._name);
}
};
ObjMedusa.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckDir();
CheckHurt();
}
};
ObjMedusa.prototype.Captured = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showNextScreen();
}
}
};
ObjMedusa.prototype.Die = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showWinScreen();
}
}
};
ObjMedusa.prototype.Laugh = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Attack = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe < FrPrepareAttack) {
CheckDir();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrPrepareAttack) {
if (Pers.ICharacter == 0) {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 1.5));
} else {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 3));
}
NextAttackRotation = Math.round(pointsGetAngle(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY));
var l_dst = pointsGetDistance(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY);
var l_step = (l_dst / 20);
NextAttackRotationSpdX = (Pers.TrueX - G_Medusa.TrueX) / l_step;
NextAttackRotationSpdY = (l_PersY - G_Medusa.TrueY) / l_step;
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrAttack) {
var l_PosX = PosX;
CreerSparkBall(PosX, PosY - 95, Dir, NextAttackRotation, NextAttackRotationSpdX, NextAttackRotationSpdY);
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
HasAttacked = true;
Etat = "Idle";
}
CheckHurt();
}
};
ObjMedusa.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjMedusa.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Laugh";
}
}
}
};
ObjMedusa.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjMedusa.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if (Math.random() < AttackChance) {
Etat = "Attack";
HasAttacked = false;
AttackDelayCount = 0;
}
}
};
ObjMedusa.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjMedusa.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjMedusa.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjMedusa.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusaSister = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "MedusaSister";
this[l_mcElement._name] = new ObjMedusaSister(l_mcElement, Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusaSister.push(l_mcElement._name);
}
};
ObjMedusaSister.prototype.UpdateSister = function (SisterID) {
with (this) {
if (CurrentSister == SisterID) {
mc[SisterID].gotoAndStop(CurrentAction);
} else {
mc[SisterID].gotoAndStop("Idle");
}
}
};
ObjMedusaSister.prototype.UpdatePosition = function () {
with (this) {
var l_maxOffset = 70;
var l_posX = Math.abs(_parent.Control.Bg.PosX);
mc._x = -((l_posX / 450) * l_maxOffset);
mc._y = mc._y + (_global.MoveY / 2.5);
if (mc._y < 145) {
mc._y = 145;
}
}
};
ObjMedusaSister.prototype.UpdateAttack = function () {
with (this) {
if ((CurrentAction == "Idle") && (!MedusaAttack)) {
if ((++AttackDelayCount) == AttackDelay) {
if (CurrentSister == "SisterLeft") {
CurrentSister = "SisterRight";
} else {
CurrentSister = "SisterLeft";
}
CurrentAction = "Charge";
AttackDelayCount = 0;
}
} else if (CurrentAction == "Charge") {
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
var PersY = Math.abs(_global.Game.Pers.PosY);
switch (true) {
case PersY < 100 :
CurrentAction = "Attack3";
break;
case PersY < 250 :
CurrentAction = "Attack2";
break;
case PersY >= 250 :
CurrentAction = "Attack1";
}
}
} else if (((CurrentAction == "Attack1") || (CurrentAction == "Attack2")) || (CurrentAction == "Attack3")) {
if (mc[CurrentSister].Etat._currentframe == 9) {
if ((Pers.Etat != "Activate") && (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Pers))) {
Pers.Etat = "Hurt";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna1)) {
_global.Game.Antenna1.Etat = "Charged";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna2)) {
_global.Game.Antenna2.Etat = "Charged";
}
}
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
CurrentAction = "Idle";
if (CurrentSister == "SisterRight") {
MedusaAttack = true;
G_Medusa.HasAttacked = false;
}
}
}
if (!MedusaAttack) {
G_Medusa.AttackDelayCount = 0;
} else if (G_Medusa.HasAttacked) {
MedusaAttack = false;
}
}
};
ObjMedusaSister.prototype.Actions = function () {
with (this) {
UpdatePosition();
UpdateAttack();
UpdateSister("SisterLeft");
UpdateSister("SisterRight");
}
};
CreerWall = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjWall(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabWall.push(l_mcElement._name);
}
};
ObjWall.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjWall.prototype.Idle = function () {
with (this) {
CheckHurt();
CheckSleep();
}
};
ObjWall.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrRemoveWallHit) {
_parent.Collider.Wall[Nom].removeMovieClip();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Out";
}
}
};
ObjWall.prototype.CheckHurt = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjWall.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjWall.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjWall.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjWall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.wall.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.wall.gotoAndStop(G_CurrentLevel);
}
};
ObjWall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerDragonObstacle = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjDragonObstacle(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabDragonObstacle.push(l_mcElement._name);
}
};
ObjDragonObstacle.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjDragonObstacle.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjDragonObstacle.prototype.Hit = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.HitBoss = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 4) {
_global.Game.Web.Etat = "Fall";
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.Fall = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == (_parent.Bg[1][Nom].Obj.Etat._totalframes - 1)) {
G_Medusa.Etat = "Captured";
}
}
};
ObjDragonObstacle.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_parent.Bg[1][Nom].Obj.Etat.stop();
}
}
};
ObjDragonObstacle.prototype.CheckHit = function () {
with (this) {
if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitTop) || (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitBottomFront)))) {
Pers.Etat = "Hurt";
Etat = "Hit";
Pers.InvincibleEnd();
Pers.MoveY = 40;
}
}
};
ObjDragonObstacle.prototype.CheckActif = function () {
with (this) {
if (_global.boss || (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep"))) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjDragonObstacle.prototype.CheckSleep = function () {
with (this) {
if (((((!_global.boss) && (PosX < (Bg.InvPosX - LgOutG))) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjDragonObstacle.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjDragonObstacle.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjDragonObstacle.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerAntenna = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjAntenna(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabAntenna.push(l_mcElement._name);
}
};
ObjAntenna.prototype.Idle = function () {
with (this) {
CheckHit();
}
};
ObjAntenna.prototype.Charged = function () {
with (this) {
CheckHit();
if ((++ChargedCount) == ChargedDelay) {
Etat = "Idle";
ChargedCount = 0;
}
}
};
ObjAntenna.prototype.CheckHit = function () {
with (this) {
if ((G_Medusa.CurrentSparkID != null) && (Pers.Etat != "Hurt")) {
if (_parent.Bg[1][Nom].Obj.Hit.hitTest(_parent.Bg[1][G_Medusa.CurrentSparkID])) {
Etat = "Charged";
ChargedCount = 0;
if ((_global.level == 1) && (_global.Game.Web.Etat != "Fall")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Web.Etat = "Fall";
_global.HUD.increaseScore(1000);
}
if ((((_global.level == 2) && (_global.Game.Antenna1.Etat == "Charged")) && (_global.Game.Antenna2.Etat == "Charged")) && (_global.Game.Wire.Etat != "HitBoss")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Wire.Etat = "HitBoss";
_global.HUD.increaseScore(2000);
}
}
}
}
};
ObjAntenna.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjAntenna.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if (Etat == "Charged") {
_global.Snd.playSound("antenna", 250, 1, false);
}
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjAntenna.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerBonus = function (type, l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBonus(type, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabBonus.push(l_mcElement._name);
}
};
ObjBonus.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjBonus.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBonus.prototype.CheckHit = function () {
with (this) {
if (((Pers.ICharacter == 0) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj))) || ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.Hit)))) {
switch (Type) {
case "Score" :
_global.Score = _global.Score + 500;
_global.Snd.playSound("energy", 200, 1, false);
_global.HUD.increaseScore(500);
break;
case "Life" :
if (_global.lives < 3) {
_global.lives++;
}
_global.Snd.playSound("life", 200, 1, false);
_global.HUD.increaseScore(200);
break;
case "Energy" :
_global.energy = _global.energy + 50;
if (_global.energy > 100) {
_global.energy = 100;
}
_global.Snd.playSound("bonus", 300, 1, false);
_global.HUD.increaseScore(200);
break;
case "Power" :
_global.dragonPower = 100;
_global.Snd.playSound("power", 300, 1, false);
_global.HUD.increaseScore(200);
}
KillBonus();
}
}
};
ObjBonus.prototype.KillBonus = function () {
with (this) {
G_TabBonus.splice(BonusI, 1);
BonusI = BonusI - 1;
delete _parent.Control[Nom];
_parent.Bg[1][Nom].swapDepths(90210);
_parent.Bg[1][Nom].removeMovieClip();
}
};
ObjBonus.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
Etat = "Idle";
}
}
};
ObjBonus.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjBonus.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjBonus.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
CheckKill();
}
}
};
this.cnt = 0;
this.G_CurrentLevel = _global.level;
switch (G_CurrentLevel) {
case 1 :
this.G_MaxEnemyHit = 28;
break;
case 2 :
this.G_MaxEnemyHit = 28;
break;
case 3 :
this.G_MaxEnemyHit = 38;
}
G_MaxEnemyHitCount = 0;
this.G_Pause = true;
this.G_PauseOut = false;
this.G_PRealese = true;
this.G_Resume = false;
this.G_TabBox = new Array();
this.G_TabSwitch = new Array();
this.G_TabDoor = new Array();
this.G_TabElevator = new Array();
this.G_TabPersBall = new Array();
this.G_TabLevier = new Array();
this.G_TabLadder = new Array();
this.G_TabChair = new Array();
this.G_TabHuntSoldier = new Array();
this.G_TabHuntWindow = new Array();
this.G_TabMedusa = new Array();
this.G_TabMedusaSister = new Array();
this.G_TabWall = new Array();
this.G_TabDragonObstacle = new Array();
this.G_TabAntenna = new Array();
this.G_TabBonus = new Array();
this.G_NextPersBall = 1;
this.G_NextPersBallDepth = 10000;
this.G_NextMinionBall = 1;
this.G_NextMinionBallDepth = 20000;
this.G_OverlayDepth = 0;
this.G_HuntWindowCurrentA = null;
this.G_HuntActiveSinceA = 0;
this.G_HuntWindowCurrentB = null;
this.G_HuntActiveSinceB = 0;
this.G_AlphaZones = new Array();
this.G_Medusa = null;
this.G_WindowOpenDelay = 20;
this.G_WindowAOpenDelayCount = 0;
this.G_WindowBOpenDelayCount = 0;
this.addAlphaZone = function (mc) {
if (_global.Packaging.bShadowDisabled) {
mc._visible = false;
}
};
this.resetLevel = function () {
_global.dragonPower = 100;
_global.energy = 100;
if (_global.boss) {
_global.resetDestination = "Game_BOSS" + _global.level;
} else {
_global.resetDestination = "Game_LEVEL" + _global.level;
}
_parent._parent.gotoAndStop("Reset");
};
this.bossStart = function () {
_global.boss = true;
_global.resetDestination = "Game_BOSS" + _global.level;
_parent._parent.gotoAndStop("Reset");
};
this.enemyHitScore = function () {
if ((++G_MaxEnemyHitCount) < G_MaxEnemyHit) {
_global.HUD.increaseScore(100);
}
};
this.Creer_PBalcony = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 235);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PRoofTop = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
var pt = new Object();
pt = {x:l_mcElement._x - 5, y:l_mcElement._y + 95};
var mcCeil = _parent.Collider.Ceil;
mcCeil.moveTo(pt.x, pt.y);
mcCeil.beginFill(16711935);
pt.x = pt.x + 115;
pt.y = pt.y - 70;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x + 115;
pt.y = pt.y + 70;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y - 80;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x - 230;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y + 80;
mcCeil.lineTo(pt.x, pt.y);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBalconyOpen = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + (l_mcElement._parent._y + 10);
CreerPlateforme(pt, 235);
if (l_mcElement.flipped) {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01OverlayFlip", {x:pt.x + 32, y:pt.y}, true);
CreerObstacle({x:pt.x + 19, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
} else {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01Overlay", {x:pt.x + 120, y:pt.y + 0.5}, true);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 195, y:pt.y}, 15, 15);
}
_parent.overlay[l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
_parent.Bg[1][l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBox = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 70);
CreerObstacle(pt, 70, 70);
}
};
this.CheckVisible = function () {
if ((this._y < (Bg.InvPosY - Stage.height)) or (this._y > (Bg.InvPosY + Stage.height))) {
this._visible = false;
} else {
this._visible = true;
}
};
this.CreerObstacle = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Wall;
var _local4 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local4.moveTo(pt.x, pt.y);
_local4.beginFill(16711935);
_local4.lineTo(pt.x, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y);
_local4.lineTo(pt.x, pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711680);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerObstacleDragon = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Dragon;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16776960);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerPlateforme = function (pt, l_nWidth) {
var _local3 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711935);
_local3.lineTo(pt.x, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerOverlay = function (id, linkage, pt, bReversed) {
var _local4;
var _local5;
_local5 = _parent.overlay.attachMovie(linkage, id, G_OverlayDepth++);
_local5._x = pt.x;
_local5._y = pt.y;
_local4 = _parent.Bg[1].attachMovie(linkage, id, G_OverlayDepth++);
_local4._x = pt.x;
_local4._y = pt.y;
_local4.overlay = _local5;
if (!bReversed) {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = false;
this.overlay._visible = true;
} else {
this._visible = true;
this.overlay._visible = false;
}
};
} else {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = true;
this.overlay._visible = false;
} else {
this._visible = false;
this.overlay._visible = true;
}
};
}
};
this.replaceTile = function (l_mcElement) {
var _local1 = l_mcElement._name;
var _local2 = 1499;
if (_local1.slice(0, 8) == "instance") {
} else {
l_mcElement._x = 0;
l_mcElement._y = -((Number(_local1) - 1) * _local2);
}
};
this.CreerFloor = function (l_nPosX, l_nPosY, l_nWidth, l_nHeight) {
var mcGround = _parent.Collider.Sol;
with (this) {
pt = new Object();
pt = {x:l_nPosX, y:l_nPosY};
pt.y = pt.y - l_nHeight;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor1 = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -60;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloorBoss = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -88;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 120;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 200;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 300;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 360;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 400;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 440;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor5 = function (l_mcElement) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
}
};
}
onClipEvent (enterFrame) {
BoxI = 0;
for (BoxI in G_TabBox) {
var BoxActif = G_TabBox[BoxI];
if (this[BoxActif].Etat != this[BoxActif].EtatOld) {
this[BoxActif].ChangeEtat(this[BoxActif].Etat);
}
this[BoxActif].Actions();
}
PersBallI = 0;
for (PersBallI in G_TabPersBall) {
var PersBallActif = G_TabPersBall[PersBallI];
if (this[PersBallActif].Etat != this[PersBallActif].EtatOld) {
this[PersBallActif].ChangeEtat(this[PersBallActif].Etat);
}
this[PersBallActif].Actions();
}
LevierI = 0;
for (LevierI in G_TabLevier) {
var LevierActif = G_TabLevier[LevierI];
if (this[LevierActif].Etat != this[LevierActif].EtatOld) {
this[LevierActif].ChangeEtat(this[LevierActif].Etat);
}
this[LevierActif].Actions();
}
LadderI = 0;
for (LadderI in G_TabLadder) {
var LadderActif = G_TabLadder[LadderI];
if (this[LadderActif].Etat != this[LadderActif].EtatOld) {
this[LadderActif].ChangeEtat(this[LadderActif].Etat);
}
this[LadderActif].Actions();
}
ChairI = 0;
for (ChairI in G_TabChair) {
var ChairActif = G_TabChair[ChairI];
if (this[ChairActif].Etat != this[ChairActif].EtatOld) {
this[ChairActif].ChangeEtat(this[ChairActif].Etat);
}
this[ChairActif].Actions();
}
ElevatorI = 0;
for (ElevatorI in G_TabElevator) {
var ElevatorActif = G_TabElevator[ElevatorI];
if (this[ElevatorActif].Etat != this[ElevatorActif].EtatOld) {
this[ElevatorActif].ChangeEtat(this[ElevatorActif].Etat);
}
this[ElevatorActif].Actions();
}
I = 0;
for (HuntSoldierI in G_TabHuntSoldier) {
var HuntSoldierActif = G_TabHuntSoldier[HuntSoldierI];
if (this[HuntSoldierActif].Dir != this[HuntSoldierActif].DirOld) {
this[HuntSoldierActif].ChangeDir(this[HuntSoldierActif].Dir);
}
if (this[HuntSoldierActif].Etat != this[HuntSoldierActif].EtatOld) {
this[HuntSoldierActif].ChangeEtat(this[HuntSoldierActif].Etat);
}
this[HuntSoldierActif].Actions();
}
I = 0;
for (HuntWindowI in G_TabHuntWindow) {
var HuntWindowActif = G_TabHuntWindow[HuntWindowI];
if (this[HuntWindowActif].Dir != this[HuntWindowActif].DirOld) {
this[HuntWindowActif].ChangeDir(this[HuntWindowActif].Dir);
}
if (this[HuntWindowActif].Etat != this[HuntWindowActif].EtatOld) {
this[HuntWindowActif].ChangeEtat(this[HuntWindowActif].Etat);
}
this[HuntWindowActif].Actions();
}
if (!G_Pause) {
if (_global.Game.G_HuntWindowCurrentA == null) {
_global.Game.G_WindowAOpenDelayCount++;
}
if (_global.Game.G_HuntWindowCurrentB == null) {
_global.Game.G_WindowBOpenDelayCount++;
}
}
I = 0;
for (MedusaI in G_TabMedusa) {
var MedusaActif = G_TabMedusa[MedusaI];
if (this[MedusaActif].Dir != this[MedusaActif].DirOld) {
this[MedusaActif].ChangeDir(this[MedusaActif].Dir);
}
if (this[MedusaActif].Etat != this[MedusaActif].EtatOld) {
this[MedusaActif].ChangeEtat(this[MedusaActif].Etat);
}
this[MedusaActif].Actions();
}
I = 0;
for (WallI in G_TabWall) {
var WallActif = G_TabWall[WallI];
if (this[WallActif].Dir != this[WallActif].DirOld) {
this[WallActif].ChangeDir(this[WallActif].Dir);
}
if (this[WallActif].Etat != this[WallActif].EtatOld) {
this[WallActif].ChangeEtat(this[WallActif].Etat);
}
this[WallActif].Actions();
}
I = 0;
for (DragonObstacleI in G_TabDragonObstacle) {
var DragonObstacleActif = G_TabDragonObstacle[DragonObstacleI];
if (this[DragonObstacleActif].Dir != this[DragonObstacleActif].DirOld) {
this[DragonObstacleActif].ChangeDir(this[DragonObstacleActif].Dir);
}
if (this[DragonObstacleActif].Etat != this[DragonObstacleActif].EtatOld) {
this[DragonObstacleActif].ChangeEtat(this[DragonObstacleActif].Etat);
}
this[DragonObstacleActif].Actions();
}
I = 0;
for (AntennaI in G_TabAntenna) {
var AntennaActif = G_TabAntenna[AntennaI];
if (this[AntennaActif].Dir != this[AntennaActif].DirOld) {
this[AntennaActif].ChangeDir(this[AntennaActif].Dir);
}
if (this[AntennaActif].Etat != this[AntennaActif].EtatOld) {
this[AntennaActif].ChangeEtat(this[AntennaActif].Etat);
}
this[AntennaActif].Actions();
}
I = 0;
for (MedusaSisterI in G_TabMedusaSister) {
var MedusaSisterActif = G_TabMedusaSister[MedusaSisterI];
if (this[MedusaSisterActif].Dir != this[MedusaSisterActif].DirOld) {
this[MedusaSisterActif].ChangeDir(this[MedusaSisterActif].Dir);
}
if (this[MedusaSisterActif].Etat != this[MedusaSisterActif].EtatOld) {
this[MedusaSisterActif].ChangeEtat(this[MedusaSisterActif].Etat);
}
this[MedusaSisterActif].Actions();
}
I = 0;
for (BonusI in G_TabBonus) {
var BonusActif = G_TabBonus[BonusI];
if (this[BonusActif].Dir != this[BonusActif].DirOld) {
this[BonusActif].ChangeDir(this[BonusActif].Dir);
}
if (this[BonusActif].Etat != this[BonusActif].EtatOld) {
this[BonusActif].ChangeEtat(this[BonusActif].Etat);
}
this[BonusActif].Actions();
}
if (Pers.Dir != Pers.DirOld) {
Pers.ChangeDir(Pers.Dir);
}
if (Pers.Etat != Pers.EtatOld) {
Pers.setState(Pers.Etat);
}
this.Pers.Actions();
this.Bg.Actions();
_global.HUD.update();
G_CheckPause();
}
Symbol 1157 MovieClip Frame 2
stop();
_global.C.beginLevel();
Instance of Symbol 970 MovieClip "Bg" in Symbol 1157 MovieClip Frame 2
onClipEvent (load) {
this._x = 0;
this._y = 0;
_parent.Control.CreerBg(_parent._x, _parent._y);
BG = _parent.Control.Bg;
for (var i in _parent.Bg) {
if (Number(_parent.Bg[i]._name) <= 20) {
_parent.Bg[i].gotoAndStop(2);
} else {
_parent.Bg[i].gotoAndStop(3);
}
}
BG.MaxDw1 = 4210;
BG.MaxUp1 = -200;
BG.MaxG1 = 0;
BG.MaxD1 = 0;
BG.ParallaxRateSky = 1.2;
BG.ParallaxRateCity = 1.08;
BG.CheckScreen = function () {
with (this) {
MaxDw = MaxDw1;
MaxUp = MaxUp1;
MaxG = MaxG1;
MaxD = MaxD1;
}
};
}
Instance of Symbol 1150 MovieClip "Pers" in Symbol 1157 MovieClip Frame 2
onClipEvent (load) {
_parent.Control.CreerPers(this._x, this._y, "Jake");
this.gotoAndStop("D");
_global.Game.Pers.Etat = "Sleep";
_global.Game.Pers.setState("Idle");
}
Instance of Symbol 1154 MovieClip "Collider" in Symbol 1157 MovieClip Frame 2
onClipEvent (load) {
this._visible = 0;
}
Symbol 1160 MovieClip Frame 1
stop();
Symbol 1160 MovieClip Frame 30
_global.HUD.onFadeMiddle();
Symbol 1160 MovieClip Frame 60
gotoAndStop (1);
Symbol 1186 MovieClip Frame 20
stop();
Symbol 1201 MovieClip Frame 2
_global.Snd.playSound("break", 100, 1, true);
Symbol 1201 MovieClip Frame 9
stop();
Symbol 1202 MovieClip Frame 1
stop();
Symbol 1205 MovieClip Frame 1
stop();
Symbol 1206 MovieClip Frame 2
_parent._parent._parent.Control.CreerBonus("Life", this);
stop();
Symbol 1207 MovieClip Frame 1
stop();
Instance of Symbol 593 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 593 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip "meh" in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "moveable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 838 MovieClip "switchDLift" in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
distance = 318;
}
Instance of Symbol 838 MovieClip "switchCLift" in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
distance = 260;
}
Instance of Symbol 838 MovieClip "switchBLift" in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
distance = 260;
}
Instance of Symbol 838 MovieClip "switchALift" in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
distance = 260;
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "regular", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "regular", "G");
}
Instance of Symbol 621 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1207 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Symbol 1207 MovieClip Frame 2
_parent._parent.Control.CreerFloor1(this, this._x, this._y);
stop();
Symbol 1208 MovieClip Frame 2
stop();
Instance of Symbol 560 MovieClip "Control" in Symbol 1209 MovieClip Frame 1
onClipEvent (load) {
function ObjBg(PosX, PosY) {
this.Nom = "Bg";
this.PosX = PosX;
this.PosY = PosY;
this.ParallaxPosX = 0;
this.ParallaxPosY = 0;
this.ParallaxSkyPosX = 0;
this.ParallaxSkyPosY = 0;
this.ParallaxCityPosX = 0;
this.ParallaxCityPosY = 0;
this.ParallaxRateSky = 1.2;
this.ParallaxRateCity = 1.1;
this.MoveX = 0;
this.MoveY = 0;
this.MaxDw = 0;
this.MaxUp = 0;
this.MaxG = 0;
this.MaxD = 0;
this.InvPosX = PosX * -1;
this.InvPosY = PosY * -1;
this.DeadX = PosX;
this.DeadY = PosY;
this.CurrentScreen = 1;
this.OldScreen = 0;
this.MaxYDie = 5000;
this.CenterX = 300;
this.CenterY = 370;
this.SpdXD = 15;
this.SpdXG = -15;
this.SpdYDw = 20;
this.SpdYUp = -20;
this.SpdYUpForce = 0;
this.InPause = false;
this.NoCamUpdate = false;
this.CamOnMedusa = false;
}
function ObjBox(Nom, PosX, PosY, Type, Dir) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.MoveX = 0;
this.MoveY = 0;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 75;
this.LgOutD = 525;
this.LgOutUp = 25;
this.LgOutDw = 475;
this.LgHitG = 34;
this.LgHitD = 35;
this.LgHitUp = 25;
this.LgHitDw = 26;
this.HitRightX;
this.HitLeftX;
this.PushDir = Dir;
this.Dir = Pers.Dir;
if (Dir == "D") {
_parent.Bg[1][Nom]._xscale = -100;
}
this.FlagUse = false;
this.LandSide = "Center";
this.MinionBlock = 0;
this.Etat = "Wait";
this.EtatOld = "Sleep";
this.FixedFlag = false;
_parent.Collider.Sol.attachMovie("TopBox", Nom, _parent.Collider.Sol.getNextHighestDepth());
_parent.Collider.Wall.attachMovie("BorderBox", Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Ceil.attachMovie("BottomBox", Nom, _parent.Collider.Ceil.getNextHighestDepth());
this.frTurn = 20;
this.SoundPush = false;
this.WebDestroyed = false;
this.MoveBox();
}
function ObjPers(PosX, PosY, Perso) {
this.nGetHitLeft = 0;
this.nGetHitRight = 0;
this.nGetHitTop = 0;
this.Nom = "Pers";
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.DirOld = "D";
this.Point = _global.C.Score;
this.Life = _global.C.Life;
this.SpdXMinion = 3;
this.SpdXNormal = 15;
this.SpdXBase = this.SpdXNormal;
this.SpdXNow = 0;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.FrontX = 0;
this.FrontY = 0;
this.BottomFrontX = 0;
this.BottomBackX = 0;
this.BackX = 0;
this.HitGrdPoint = 0;
this.WallHitBloc = 2;
this.SpdYNow = 0;
this.SpdYUpBase = 1.7;
this.SpdYUp = this.SpdYUpBase;
this.SpdYMax = 30;
this.SpdYFall = 2.2;
this.SpdYFly = 5;
this.SpdXHitBase = 0;
this.SpdYHitBase = -4;
this.SpdStartJump = -17;
this.SolOut = 2;
this.SolHitMin = 5;
this.MaxSol = 3;
this.HitGrd = false;
this.SolForJump = 6;
this.DistYFall = 0;
this.DistYFallMax = 900;
this.autoSwitchDragon = false;
this.DistYLand = 80;
this.CanHit = false;
this.CanBeHit = true;
this.FrWalkNow = 1;
this.InPause = false;
this.FrJump = 1;
this.FrFall = 1;
this.FrLand = 13;
this.FrGetHit = 7;
this.FrGetHitCount = 0;
this.FrBoomTir = 9;
this.FrFinBoom = 6;
this.FrDead = 20;
this.FrDeadCount = 0;
this.aCharacter = ["Jake", "Dragon"];
this.ICharacter = 0;
this.Perso = this.aCharacter[this.ICharacter];
this.updatePerso();
this.LgGetShootX = 20;
this.LgGetShootUp = 72;
this.LgGetShootUpBas = 44;
this.FrInvincibleCount = 0;
this.FrInvincible = 20;
this.Invincible = false;
this.FrSwitchCharacter = 15;
this.FrSwitchCharacterCount = 0;
this.bCanSwitch = true;
this.bJumpRelease = true;
this.SpdXBaseJumpKick = 20;
this.bComboCheck = false;
this.nFrDelayCombo = 15;
this.nFrDelayComboCount = 0;
this.bCanAttack = true;
this.bAttackRelease = true;
this.bSkipDie = false;
this.mcHitGetHurt = null;
this.HitPointX = 0;
this.HitPointY = 0;
this.nDragonPowerRythm = 25;
this.nDragonPowerCount = 0;
this.DragonHitTop = 0;
this.DragonHitBottom = 0;
this.DragonHeight = 130;
this.onLadderID = null;
this.ClimbedDistance = 0;
this.ladderDisabledMax = 15;
this.ladderDisabledCount = this.ladderDisabledMax;
this.onBouncingID = null;
this.bounceCount = 0;
this.bounceCountMax = 3;
this.bouncingDisabledMax = 15;
this.bouncingDisabledCount = this.bouncingDisabledMax;
this.bHitAttack = false;
this.FrShootFire = 15;
this.FrAttackTailHit = 9;
this.CurrentFireID = null;
if (_global.boss) {
this.WaitForActions = true;
} else {
this.WaitForActions = false;
}
}
function ObjPersBall(Type, Nom, PosX, PosY, Dir, HitBullet, Speed, Tab, HitSound, Rotation, SpdX, SpdY) {
this.Nom = Nom;
this.Type = Type;
this.HitSound = HitSound;
this.Tab = Tab;
this.Etat = "Move";
this.EtatOld = "Idle";
this.Dir = Dir;
this.OldDir = "D";
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 50;
this.LgOutD = 600;
this.LgOutUp = 0;
this.LgOutDw = 500;
this.CanBeKill = false;
if (Dir == "D") {
this.SpdX = Speed;
} else {
this.SpdX = -1 * Speed;
_parent.Bg[1][Nom]._xscale = -100;
}
this.InPause = false;
this.FrHit = HitBullet;
this.FrHide = 1;
if (Type == "Fire") {
Pers.CurrentFireID = Nom;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = Nom;
this.LgOutG = 1100;
this.LgOutD = 1100;
_parent.Bg[1][Nom]._xscale = -100;
_parent.Bg[1][Nom]._rotation = Rotation;
this.SpdX = SpdX;
this.SpdY = SpdY;
}
}
function ObjSwitch(Nom, PosX, PosY) {
this.Nom = Nom;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 20;
this.LgOnY = 20;
this.PosX = PosX;
this.PosY = PosY;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrBaisse = 13;
}
function ObjElevator(mc, Axis, Min, Max) {
this.Nom = mc._name;
this.mc = mc;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 750;
this.LgOutG = 200;
this.LgOutUp = 500;
this.LgOutDw = 900;
this.Speed = 2;
this.frWaitCount = 0;
this.frWaitTime = 30;
this.LgOnX = 200;
this.LgOnY = 25;
this.PersOn = false;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = mc._x + 40;
this.PosY = mc._y + 140;
this.Axis = Axis;
this.Min = this["Pos" + Axis] + Min;
this.Max = this["Pos" + Axis] + Max;
this.Active = false;
this.InPause = false;
this.Dir = -1;
this.CanReposition = false;
this.RepositionCount = 0;
this.RepositionDelay = 30;
_parent.Collider.Sol.attachMovie("GroundElevator", this.Nom, _parent.Collider.Sol.getNextHighestDepth());
_global.Game.CreerOverlay(mc._name + "ramp", "AM_RampeAscenseur01_overlay", {x:mc._x, y:mc._y + 140});
this.MoveElevator();
}
function ObjLevier(Nom, PosX, PosY, listener) {
this.Nom = Nom;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 30;
this.LgOnY = 100;
this.PosX = PosX;
this.PosY = PosY;
this.PersYCorrection = 60;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrFinLevelCount = 0;
this.FrFinLevel = 70;
this.Active = true;
this.listener = listener;
}
function pointsGetAngle(l_x1, l_y1, l_x2, l_y2) {
var _local4 = 0;
var _local3 = 0;
var _local1 = 0;
var _local2 = 0;
_local4 = (l_x1 - l_x2) * -1;
_local3 = (l_y1 - l_y2) * -1;
_local1 = Math.atan2(_local3, _local4);
_local1 = (_local1 * 180) / Math.PI;
if (_local1 < 0) {
_local1 = _local1 * -1;
_local2 = 180 - _local1;
_local1 = 180 + _local2;
}
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
function pointsGetDistance(l_x1, l_y1, l_x2, l_y2) {
var _local1 = Math.sqrt(Math.pow(Math.abs(l_x2 - l_x1), 2) + Math.pow(Math.abs(l_y2 - l_y1), 2));
return(_local1);
}
function ObjLadder(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.obj;
this.Etat = "Off";
this.EtatOld = "Off";
this.LgOnX = 70;
this.LgOnY = 265;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
}
function ObjBouncingChair(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.Obj;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOnX = 70;
this.LgOnY = 50;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
_global.Game.CreerPlateforme({x:this.PosX, y:this.PosY}, 73);
}
function ObjHuntSoldier(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 115;
this.AttackDelayCount = 0;
this.AttackChance = 0.03;
this.ShieldChance = 0.25;
this.HurtCount = 0;
}
function ObjHuntWindow(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "IdleClose";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 450;
this.LgOutDw = 450;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.AttackDelay = 100;
this.AttackDelayCount = 0;
if (PosX < 150) {
this.HuntID = "A";
this.FlipPosition = 20;
} else {
this.HuntID = "B";
this.FlipPosition = -20;
}
this.OpenRangeDown = 450;
this.OpenRangeUp = -20;
this.OpenChanceDragon = 0.85;
this.OpenChanceJake = 0.1;
this.HuntEtat = "idle";
this.AttackDelay = 100;
this.AttackDelayCount = 0;
this.AttackChance = 0.85;
this.FlipDelay = 10;
this.FlipDelayCount = 0;
this.CloseDelay = 100;
this.closeDelayCount = 0;
this.CloseChance = 0.5;
this.FrThrow = 11;
}
function ObjMedusa(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -60;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSparkID = null;
this.HasAttacked = false;
G_Medusa = this;
_global.Medusa = this;
}
function ObjMedusaSister(mc, Type, Nom, PosX, PosY) {
this.mc = mc;
this.Nom = Nom;
this.Perso = Type;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -110;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSister = "SisterRight";
this.CurrentAction = "Idle";
this.MedusaAttack = false;
}
function ObjWall(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
_parent.Collider.Wall.attachMovie("WallHit", this.Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Wall[Nom]._x = PosX;
_parent.Collider.Wall[Nom]._y = PosY;
this.FrRemoveWallHit = 4;
}
function ObjDragonObstacle(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
}
function ObjAntenna(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.ChargedDelay = 300;
this.ChargedCount = 0;
}
function ObjBonus(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.CanBeKill = false;
}
_global.Game = this;
this.KeyListener = new com.sarbakan.utils.KeyManager();
KeyListener.addKeyListener(39, "R");
KeyListener.addKeyListener(37, "L");
KeyListener.addKeyListener(40, "Dw");
KeyListener.addKeyListener(38, "Up");
KeyListener.addKeyListener(32, "Dragon");
KeyListener.addKeyListener(66, "Attack");
KeyListener.addKeyListener(78, "Action");
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
G_CheckPause = function () {
if ((Pers.Etat != "Die") and (Pers.Etat != "Dead")) {
if (G_PauseOut && (!G_Pause)) {
G_Pause = true;
_parent.ControlBall.stop();
_parent._parent.Popup.gotoAndStop("Pause");
if (_global.C.SoundActive) {
_global.SoundCTRL.muteAllSounds();
}
_global.C.DesactivateHud();
} else if ((G_Resume == true) and (G_Pause == true)) {
G_PauseOut = false;
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
KeyListener.Up = false;
KeyListener.UpRelease = true;
KeyListener.Dw = false;
KeyListener.L = false;
KeyListener.R = false;
KeyListener.X = false;
KeyListener.Z = false;
KeyListener.Sp = false;
Music.VolDest = 70;
Music.Etat = "FadeIn";
G_Pause = false;
G_Resume = false;
_parent._parent.Popup.gotoAndStop(1);
if (_global.C.SoundActive) {
_global.SoundCTRL.unmuteAllSounds();
}
_global.C.ActivateHud();
if (_parent.ControlBall._currentframe != 1) {
_parent.ControlBall.play();
}
}
}
};
CreerBg = function (PosX, PosY) {
this.Bg = new ObjBg(PosX, PosY);
};
ObjBg.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
CheckScreen();
if (!NoCamUpdate) {
ScrollBg();
}
}
}
};
ObjBg.prototype.ScrollBg = function () {
with (this) {
if (CamOnMedusa) {
Pers.TrueX = _global.Medusa.TrueX;
Pers.TrueY = _global.Medusa.TrueY;
}
if ((PosY <= MaxDw) and (PosY >= MaxUp)) {
if (Pers.TrueX > (CenterX + 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else {
if ((CenterX - Pers.TrueX) > SpdXG) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXG;
}
if ((PosX + MoveX) < MaxG) {
MoveX = MaxG - PosX;
}
}
} else if (Pers.TrueX < (CenterX - 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
} else {
if ((CenterX - Pers.TrueX) < SpdXD) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXD;
}
if ((PosX + MoveX) > MaxD) {
MoveX = MaxD - PosX;
}
}
} else {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
}
}
}
if ((PosX <= MaxD) and (PosX >= MaxG)) {
if (Pers.TrueY > (CenterY + 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxUp - PosY;
} else {
MoveY = SpdYDw;
}
} else {
if ((CenterY - Pers.TrueY) > SpdYUp) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYUp;
}
if ((PosY + MoveY) < MaxUp) {
MoveY = MaxUp - PosY;
}
}
} else if (Pers.TrueY < (CenterY - 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
} else {
if ((CenterY - Pers.TrueY) < SpdYDw) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYDw;
}
if ((PosY + MoveY) > MaxDw) {
MoveY = MaxDw - PosY;
}
}
} else {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYDw;
}
} else if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
}
}
}
_parent._x = Math.floor(_parent._x + MoveX);
PosX = _parent._x;
InvPosX = PosX * -1;
MoveX = 0;
_parent._y = Math.floor(_parent._y + MoveY);
PosY = _parent._y;
InvPosY = PosY * -1;
_global.MoveY = MoveY;
MoveY = 0;
_parent.ParallaxSky._y = (Math.floor(_parent._y / (-ParallaxRateSky)) + 350) + 30;
ParallaxSkyPosY = _parent.ParallaxSky._y;
_parent.ParallaxCity._y = (Math.floor(_parent._y / (-ParallaxRateCity)) + 140) + 30;
ParallaxCityPosY = _parent.ParallaxCity._y;
}
};
CreerBox = function (Nom, PosX, PosY, Type, Dir) {
if (this[Nom] == null) {
this[Nom] = new ObjBox(Nom, PosX, PosY, Type, Dir);
G_TabBox.push(Nom);
}
};
ObjBox.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBox.prototype.Wait = function () {
with (this) {
if (Type == "moveable") {
CheckPush();
}
CheckHitGrd();
CheckSleep();
CheckFall();
if (Type == "destroyable") {
CheckDestroy();
}
}
};
ObjBox.prototype.Fall = function () {
with (this) {
CheckHitGrd();
SetSpdFall();
MoveBox();
if (((Nom == "BoxDestroyWeb") && (!WebDestroyed)) && (TrueY > 350)) {
_global.Game.WebDestroyable.Etat = "Destroy";
WebDestroyed = true;
}
}
};
ObjBox.prototype.Land = function () {
with (this) {
CheckHitGrd();
SetSpdLand();
MoveBox();
if ((TrueX > 0) && (TrueX < 500)) {
_global.SoundCTRL.playSound("BoxLand", 100, 0);
}
}
};
ObjBox.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe >= _parent.Bg[1][Nom].Etat._totalframes) {
_parent.Bg[1][Nom].Etat.stop();
_parent.Collider.Sol[Nom].removeMovieClip();
_parent.Collider.Ceil[Nom].removeMovieClip();
_parent.Collider.Wall[Nom].removeMovieClip();
}
}
};
ObjBox.prototype.LandFin = function () {
with (this) {
Etat = "Wait";
Pers.PushedBox = 0;
}
};
ObjBox.prototype.Fixed = function () {
with (this) {
CheckSleep();
}
};
ObjBox.prototype.CheckPush = function () {
with (this) {
if (Pers.Etat == "Push") {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.PushPoint)) {
Dir = Pers.Dir;
if (Dir == "D") {
this.MoveX = 2;
} else if (Dir == "G") {
this.MoveX = -2;
}
CheckWall();
if (Pers.Dir != PushDir) {
MoveX = 0;
}
MoveBox();
Pers.PushedBox = this;
if (MoveX != 0) {
_global.Snd.playSound("push", 100, 999, true);
}
}
} else {
_global.Snd.stopSound("push");
}
}
};
ObjBox.prototype.CheckDestroy = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjBox.prototype.CheckHitGrd = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (_parent.Collider.Sol.hitTest(HitX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitRightX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitLeftX, HitY, true)) {
HitGrd = true;
} else {
HitGrd = false;
}
}
};
ObjBox.prototype.SetSpdFall = function () {
with (this) {
MaxMoveY = 15;
MoveY = MoveY + 5;
if (MoveY > MaxMoveY) {
MoveY = MaxMoveY;
}
aCheckPoint = [TrueX, HitLeftX, HitRightX];
for (CheckPointI in aCheckPoint) {
var activePointX = aCheckPoint[CheckPointI];
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 2), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 4), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
}
}
};
ObjBox.prototype.SetSpdLand = function () {
with (this) {
while ((_parent.Collider.Sol.hitTest(TrueX, TrueY + MoveY, true) || (_parent.Collider.Sol.hitTest(HitLeftX, TrueY + MoveY, true))) || (_parent.Collider.Sol.hitTest(HitRightX, TrueY + MoveY, true))) {
MoveY--;
}
if (MoveY < 1) {
MoveY = 1;
Etat = "LandFin";
}
}
};
ObjBox.prototype.CheckFall = function () {
with (this) {
if (HitGrd == true) {
MoveY = 0;
Etat = "Wait";
} else {
Etat = "Fall";
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
MoveX = 0;
MoveY = 0;
}
}
};
ObjBox.prototype.CheckWall = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (Pers.Dir == "G") {
HitX = HitX + (MoveX - LgHitG);
} else if (Pers.Dir == "D") {
HitX = HitX + (MoveX + LgHitD);
}
if (_parent.Collider.Wall.hitTest(HitX, HitY, true)) {
MoveX = 0;
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
}
}
};
ObjBox.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjBox.prototype.MoveBox = function () {
with (this) {
PosX = Number(PosX + MoveX);
PosY = Number(PosY + MoveY);
_parent.Bg[1][Nom]._x = PosX;
_parent.Bg[1][Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY - 15;
_parent.Collider.Wall[Nom]._x = PosX + 30;
_parent.Collider.Wall[Nom]._y = PosY + 4;
_parent.Collider.Ceil[Nom]._x = PosX;
_parent.Collider.Ceil[Nom]._y = PosY + 40;
}
};
ObjBox.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (FixedFlag) {
Etat = "Fixed";
} else {
Etat = "Wait";
}
}
}
};
ObjBox.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = (PosY + _parent._y) + LgHitDw;
HitRightX = TrueX + LgHitD;
HitLeftX = TrueX - LgHitG;
}
};
ObjBox.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if ((NewAction == "Turn") || (NewAction == "Fixed")) {
_parent.Bg[1][Nom].gotoAndStop(NewAction + Dir);
} else {
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
_parent.Bg[1][Nom].Etat.box.gotoAndStop(Type);
_parent.Bg[1][Nom].Etat.box.box.gotoAndStop(Type);
}
};
ObjBox.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
SetTruePos();
this[Etat]();
}
}
};
ObjPers.prototype.IdleJake = function () {
with (this) {
DistYFall = 0;
KeepDeadPos = true;
bCanAttack = true;
if (Life > 0) {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckPush();
CheckJump();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusJake = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.RunJake = function () {
with (this) {
bCanAttack = true;
DistYFall = 0;
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckJump();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartJake = function () {
with (this) {
Pers.bouncingDisabledCount = 0;
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
} else if (DistYFall >= DistYFallMax) {
autoSwitchDragon = true;
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingJake = function () {
with (this) {
CheckGetFire();
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (!_global.Game[onBouncingID].CheckPersOn()) {
bounceCount = 0;
Pers.onBouncingID = null;
}
if (_parent.Pers.Obj.Etat._currentframe >= 3) {
if (_global.energy <= 0) {
_global.energy = 0;
Etat = "Die";
}
}
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.ClimbingJake = function () {
with (this) {
SpdXNow = 0;
SpdYNow = 0;
CheckHitGrd();
if ((Pers.ClimbedDistance > 30) && (HitGrd)) {
Etat = "Idle";
Pers.ladderDisabledCount = 0;
} else if (KeyListener.Action) {
Etat = "Fall";
} else {
if (KeyListener.L) {
SpdXNow = -2;
} else if (KeyListener.R) {
SpdXNow = 2;
}
if (KeyListener.Up) {
SpdYNow = -3;
} else if (KeyListener.Dw) {
SpdYNow = 3;
}
SetMoveX();
SetMoveY();
CheckWall(FrontX, FrontY - 15);
CheckWall(BackX, FrontY - 15);
CheckWall(FrontX, FrontY);
CheckWall(BackX, FrontY);
CheckWall(FrontX, FrontY + 15);
CheckWall(BackX, FrontY + 15);
CheckWall(FrontX, FrontY + 30);
CheckWall(BackX, FrontY + 30);
CheckWall(FrontX, FrontY + 45);
CheckWall(BackX, FrontY + 45);
MovePers();
Pers.ClimbedDistance++;
}
if ((SpdXNow != 0) || (SpdYNow != 0)) {
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
_parent.Pers.Obj.Etat.gotoAndStop(1);
} else {
_parent.Pers.Obj.Etat.nextFrame();
}
} else {
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.ActivateJake = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.HurtJake = function () {
with (this) {
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetJake = function () {
with (this) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
}
};
ObjPers.prototype.AttackJake = function () {
with (this) {
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == Math.round(_parent.Pers.Obj.Etat._totalframes / 2)) {
bHitAttack = true;
} else {
bHitAttack = false;
}
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.GetHitJake = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireJake = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformJake = function () {
with (this) {
DistYFall = 0;
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 1;
Etat = "Idle";
nDragonPowerCount = 0;
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.PushJake = function () {
with (this) {
CheckHitGrd();
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (!KeyListener.Action) {
Etat = "Idle";
} else if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (PushedBox != 0) {
MoveX = PushedBox.MoveX;
} else {
MoveX = 0;
}
} else {
var AddBlock = (35 * NumDir);
var i = 0;
while (i != AddBlock) {
if (_parent.Collider.Wall.hitTest(PushPointX + i, PushPointY, true)) {
goToTarget = true;
if (((i > 5) && (NumDir == 1)) || ((i < -5) && (NumDir == -1))) {
MoveX = 5 * NumDir;
} else {
MoveX = i;
}
break;
}
i = i + NumDir;
}
}
MovePers();
}
};
ObjPers.prototype.TransformFallJake = ObjPers.prototype.TransformJake;
ObjPers.prototype.DieJake = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
if (FrDeadCount == 0) {
_global.lives--;
_global.Snd.stopSound("lift");
_global.Snd.stopSound("push");
if (_global.lives == 0) {
_global.Packaging.showLoseScreen();
} else {
_global.HUD.fade(resetLevel);
}
}
FrDeadCount++;
}
}
};
ObjPers.prototype.SleepJake = function () {
};
ObjPers.prototype.IdleDragon = function () {
with (this) {
bCanAttack = true;
KeepDeadPos = true;
if (Life > 0) {
SetSpdDragon();
SetMoveX();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdDragon();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusDragon = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.FlyDragon = function () {
with (this) {
bCanAttack = true;
SetSpdDragon();
SetMoveX();
SetMoveY();
CheckDragonObstacle();
CheckWall(FrontX, FrontY);
CheckCeilDragon();
CheckSolDragon();
CheckGroundDragon();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartDragon = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
this["CheckAttack" + Perso]();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingDragon = function () {
with (this) {
CheckGetFire();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe >= this.nFrTotalAnim) {
if (Life <= 0) {
Etat = "Die";
} else {
Etat = "Idle";
}
}
}
};
ObjPers.prototype.HurtDragon = function () {
with (this) {
MovePers();
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
Etat = "Idle";
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetDragon = ObjPers.prototype.HurtDragon;
ObjPers.prototype.AttackTailDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrAttackTailHit) {
bHitAttack = true;
} else {
bHitAttack = false;
}
}
};
ObjPers.prototype.AttackFireDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrShootFire) {
if (Dir == "D") {
CreerFireBall(PosX + 70, PosY - 70, Dir);
} else {
CreerFireBall(PosX - 70, PosY - 70, Dir);
}
}
}
};
ObjPers.prototype.GetHitDragon = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireDragon = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 0;
Etat = "Fall";
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.DieDragon = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
FrDeadCount++;
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.SleepDragon = function () {
};
CreerPers = function (PosX, PosY, Perso) {
this.Pers = new ObjPers(PosX, PosY, Perso);
};
ObjPers.prototype.CharacterSwitch = function () {
with (this) {
if (Etat == "Fall") {
Etat = "TransformFall";
} else {
Etat = "Transform";
}
}
};
ObjPers.prototype.HeroChange = function (NewHero) {
with (this) {
Perso = NewHero;
updatePerso();
}
};
ObjPers.prototype.GetHitGeneral = function () {
with (this) {
SetSpdXHit();
CheckWall(BackX, TrueY);
CheckHitGrd();
CheckSol();
MovePers();
CheckDie();
}
};
ObjPers.prototype.CheckGetFire = function () {
with (this) {
var NbMinionBall = G_TabMinionBall.length;
if ((NbMinionBall > 0) && (Perso != "TuesdayDisguised")) {
var i = 0;
while (i < NbMinionBall) {
var BallX = _parent.Control[G_TabMinionBall[i]].PosX;
var BallY = _parent.Control[G_TabMinionBall[i]].PosY;
if (((((BallX >= (PosX - GetFireG)) and (BallX <= (PosX + GetFireD))) and (BallY >= (PosY - GetFireUp))) and (BallY <= (PosY + GetFireDw))) && (!Invincible)) {
Etat = "GetFire";
if (_parent.Control[G_TabMinionBall[i]].Dir == "D") {
Dir = "G";
} else if (_parent.Control[G_TabMinionBall[i]].Dir == "G") {
Dir = "D";
}
_parent.Control[G_TabMinionBall[i]].Etat = "Hit";
}
i++;
}
}
}
};
ObjPers.prototype.InvincibleInit = function () {
with (this) {
Invincible = true;
}
};
ObjPers.prototype.InvincibleEnd = function () {
with (this) {
Invincible = false;
FrInvincibleCount = 0;
_parent.Pers._visible = true;
}
};
ObjPers.prototype.InvincibleCheck = function () {
with (this) {
if (Invincible) {
if (FrInvincibleCount >= FrInvincible) {
InvincibleEnd();
CanBeHit = true;
} else {
FrInvincibleCount++;
if ((FrInvincibleCount % 3) == 0) {
_parent.Pers._visible = !_parent.Pers._visible;
}
}
}
}
};
ObjPers.prototype.SetSpdXHit = function () {
with (this) {
MoveX = SpdXNow;
if (SpdXNow > 0) {
SpdXNow = SpdXNow * 0.7;
}
if (Dir eq "D") {
MoveX = MoveX * -1;
}
}
};
ObjPers.prototype.SetSpdXJake = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX - WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase * -1;
}
} else {
Etat = "Idle";
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdDragon = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (KeyListener.Dw == true) {
SpdYNow = SpdYFly;
} else if (KeyListener.Up == true) {
SpdYNow = SpdYFly * -1;
} else {
SpdYNow = 0;
}
if ((SpdXNow == 0) && (SpdYNow == 0)) {
Etat = "Idle";
} else {
Etat = "Fly";
}
}
};
ObjPers.prototype.SetSpdXJump = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(TrueX + WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(TrueX - WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdXJumpKick = function () {
with (this) {
if (Dir == "G") {
if (SpdXNow < -5) {
SpdXNow = SpdXNow + 2;
} else {
SpdXNow = -5;
}
} else if (Dir == "D") {
if (SpdXNow > 5) {
SpdXNow = SpdXNow - 2;
} else {
SpdXNow = 5;
}
}
}
};
ObjPers.prototype.SetMoveX = function () {
with (this) {
MoveX = SpdXNow;
}
};
ObjPers.prototype.SetMoveY = function () {
with (this) {
MoveY = SpdYNow;
}
};
ObjPers.prototype.CheckWall = function (CoordX, CoordY) {
with (this) {
if (MoveX != 0) {
if (MoveX > 0) {
var WallStop = WallHitBloc;
} else {
var WallStop = (-1 * WallHitBloc);
}
var WallHit1 = (MoveX / 3);
var WallHit2 = (WallHit1 * 2);
var WallHit3 = (WallHit1 * 4);
if (_parent.Collider.Wall.hitTest(CoordX + WallStop, CoordY, true)) {
MoveX = 0;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit1, CoordY, true)) {
MoveX = WallHitBloc;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit2, CoordY, true)) {
MoveX = WallHit1;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit3, CoordY, true)) {
MoveX = WallHit2;
} else if (_parent.Collider.Wall.hitTest(CoordX + MoveX, CoordY, true)) {
MoveX = WallHit2;
}
}
}
};
ObjPers.prototype.CheckDragonObstacle = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Dragon.hitTest(TopX, TopY + MoveY, true)) {
MoveY = DragonHitTop;
} else if (_parent.Collider.Dragon.hitTest(BottomFrontX, (TopY + MoveY) + DragonHeight, true) or _parent.Collider.Dragon.hitTest(BottomBackX, (TopY + MoveY) + DragonHeight, true)) {
MoveY = DragonHitBottom;
}
}
}
};
ObjPers.prototype.CheckCeil = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
Etat = "Fall";
DistYFall = 0;
}
}
}
};
ObjPers.prototype.CheckSolDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Sol.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckCeilDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
}
}
}
};
ObjPers.prototype.CheckGroundDragon = function () {
with (this) {
if (MoveY > 0) {
if (_parent.Collider.Sol.hitTest(BottomFrontX, TrueY - _parent.Pers.Obj.HitBottomFront._y, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckJump = function () {
with (this) {
if (Etat != "Push") {
if ((!KeyListener.Up) && (!bJumpRelease)) {
bJumpRelease = true;
}
if (((KeyListener.Up == true) && (HitGrd == true)) && (bJumpRelease)) {
bJumpRelease = false;
if (Etat == "Run") {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
} else {
Etat = "JumpStart";
}
}
}
}
};
ObjPers.prototype.CheckPush = function () {
with (this) {
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (KeyListener.Action && (((Dir == "G") && (KeyListener.L)) || ((Dir == "D") && (KeyListener.R)))) {
Etat = "Push";
}
}
}
};
ObjPers.prototype.CheckAttackJake = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "Attack";
}
}
};
ObjPers.prototype.CheckAttackDragon = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackTail";
}
if ((KeyListener.Action == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackFire";
}
}
};
ObjPers.prototype.CheckFall = function () {
with (this) {
if (SpdYNow >= SpdYFall) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.CheckDie = function () {
with (this) {
if (_global.energy <= 0) {
_global.dragonPower = 0;
Etat = "Fall";
}
}
};
ObjPers.prototype.MovePers = function () {
with (this) {
if ((Pers.TrueX + MoveX) < 30) {
MoveX = (TrueX * -1) + 30;
} else if ((Pers.TrueX + MoveX) > 520) {
MoveX = 520 - Pers.TrueX;
}
PosX = _parent.Pers._x + MoveX;
_parent.Pers._x = PosX;
MoveX = 0;
PosY = _parent.Pers._y + MoveY;
_parent.Pers._y = PosY;
MoveY = 0;
}
};
ObjPers.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
TopX = TrueX;
TopY = TrueY + _parent.Pers.Obj.HitTop._y;
FrontX = _parent.Pers.Obj.HitFront._x;
FrontY = TrueY + _parent.Pers.Obj.HitFront._y;
BottomFrontX = _parent.Pers.Obj.HitBottomFront._x;
BottomBackX = _parent.Pers.Obj.HitBottomBack._x;
BackX = _parent.Pers.Obj.HitBack._x;
if (Dir == "G") {
FrontX = TrueX - FrontX;
BottomFrontX = TrueX - BottomFrontX;
BottomBackX = TrueX - BottomBackX;
BackX = TrueX - BackX;
} else if (Dir == "D") {
FrontX = TrueX + FrontX;
BottomFrontX = TrueX + BottomFrontX;
BottomBackX = TrueX + BottomBackX;
BackX = TrueX + BackX;
}
}
};
ObjPers.prototype.CheckHitGrd = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = TrueX;
CheckY = TrueY;
aCheckPoints = [CheckX, BottomFrontX, BottomBackX];
} else {
aCheckPoints = [CheckX];
}
for (var i in aCheckPoints) {
if (_parent.Collider.Sol.hitTest(aCheckPoints[i], CheckY + MaxSol, true) and (SpdYNow >= 0)) {
HitGrd = true;
HitGrdPoint = aCheckPoints[i];
if ((onBouncingID != null) && (_global.Game[onBouncingID].CheckPersOn() != true)) {
Pers.SpdYUp = Pers.SpdYUpBase;
}
break;
}
HitGrd = false;
HitGrdPoint = TrueX;
}
}
};
ObjPers.prototype.CheckSol = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = HitGrdPoint;
CheckY = TrueY;
}
if (_parent.Collider.Sol.hitTest(CheckX, CheckY, true) and (SpdYNow >= 0)) {
SpdYNow = 0;
var InSol = true;
while (InSol == true) {
MoveY = MoveY - SolOut;
InSol = _parent.Collider.Sol.hitTest(CheckX, CheckY + MoveY, true);
}
} else if (SpdYNow >= 0) {
if (HitGrd == true) {
SpdYNow = 0;
MoveY = SpdYNow;
} else {
SpdYNow = SpdYNow + SpdYUp;
if (Etat == "JumpKick") {
SpdYNow = SpdYNow + 1;
}
if (SpdYNow > SpdYMax) {
SpdYNow = SpdYMax;
}
var SolHit1 = (SpdYNow / 3);
var SolHit2 = (SolHit1 * 2);
if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit1, true)) {
MoveY = SolHitMin;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit2, true)) {
MoveY = SolHit1;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SpdYNow, true)) {
MoveY = SolHit2;
} else {
MoveY = SpdYNow;
}
}
} else {
SpdYNow = SpdYNow + SpdYUp;
MoveY = SpdYNow;
}
if (MoveY > 0) {
DistYFall = DistYFall + MoveY;
}
}
};
ObjPers.prototype.setState = function (l_sNewState) {
with (this) {
EtatOld = Etat;
Etat = l_sNewState;
var nOldTransformFr = _parent.Pers.Obj.Transform._currentframe;
_parent.Pers.Obj.gotoAndStop(l_sNewState);
_parent.Pers.Obj.Etat.gotoAndPlay(1);
this.nFrTotalAnim = _parent.Pers.Obj.Etat._totalframes;
_parent.Pers.Obj.Transform.gotoAndStop(1);
if ((Etat == "Die") && (bSkipDie)) {
_parent.Pers.Obj.Etat.gotoAndPlay(9);
}
if ((nOldTransformFr < 15) && (nOldTransformFr > 5)) {
_parent.Pers.Obj.Transform.gotoAndPlay(nOldTransformFr);
}
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
}
};
ObjPers.prototype.updatePerso = function () {
var nCurrentFrame;
with (this) {
nCurrentFrame = _parent.Pers.Obj.Etat._currentframe;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
_parent.Pers.Obj.Etat.gotoAndPlay(nCurrentFrame);
nGetHitLeft = -1 * _parent.Pers.Obj.HitBack._x;
nGetHitRight = _parent.Pers.Obj.HitFront._x;
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
ComboKick = 0;
mcHitGetHurt = _parent.Pers.Obj.HitGetHurt;
}
};
ObjPers.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
}
};
ObjPers.prototype.Actions = function () {
with (this) {
if (WaitForActions) {
SetTruePos();
CheckHitGrd();
CheckSol();
CheckFall();
WaitForActions = false;
} else if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Pers.Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Pers.Obj.Etat.play();
}
SetTruePos();
InvincibleCheck();
this[Etat + aCharacter[ICharacter]]();
CheckCharSwitch();
CheckHit();
CheckEndLevel();
}
}
};
ObjPers.prototype.CheckCharSwitch = function () {
with (this) {
if (ICharacter == 1) {
if ((KeyListener.Dragon || (_global.dragonPower == 0)) && (Etat != "HurtNet")) {
CharacterSwitch();
} else if ((++nDragonPowerCount) == nDragonPowerRythm) {
_global.dragonPower--;
nDragonPowerCount = 0;
if (_global.dragonPower < 0) {
_global.dragonPower = 0;
}
}
} else {
if (((KeyListener.Dragon || (autoSwitchDragon)) && (bCanSwitch)) && (_global.dragonPower > 0)) {
autoSwitchDragon = false;
bCanSwitch = false;
FrSwitchCharacterCount = FrSwitchCharacter;
CharacterSwitch();
}
if (!bCanSwitch) {
FrSwitchCharacterCount--;
if (FrSwitchCharacterCount == 0) {
bCanSwitch = true;
}
}
}
}
};
ObjPers.prototype.CheckEndLevel = function () {
with (this) {
if (!_global.boss) {
if (((_global.level == 1) && (PosY <= -3930)) && (PosX >= 390)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if ((_global.level == 2) && (PosY <= -4670)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if (((_global.level == 3) && (PosY <= -5800)) && (PosX <= 105)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
}
}
};
ObjPers.prototype.CheckHit = function () {
with (this) {
if (KeyListener.X && (CanBeHit)) {
this.GetHit();
}
}
};
CreerNetBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("NetBall", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Net", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerFireBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("JackDragon_FireAnim", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Fire", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerSparkBall = function (PosX, PosY, Dir, Rotation, SpdX, SpdY) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("Medusa_Blast", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Spark", _local4, PosX, PosY, Dir, 8, 0, G_TabPersBall, "SlimeSplat", Rotation, SpdX, SpdY);
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
ObjPersBall.prototype.Move = function () {
with (this) {
_parent.Bg[1][Nom]._x = PosX + SpdX;
PosX = PosX + SpdX;
if (SpdY) {
_parent.Bg[1][Nom]._y = PosY + SpdY;
PosY = PosY + SpdY;
}
SetTruePos();
CheckHit();
CheckOut();
}
};
ObjPersBall.prototype.Hit = function () {
with (this) {
if ((Type == "Net") && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
Pers.Etat = "HurtNet";
_global.Snd.playSound("hurtNet", 100, 1, false);
CanBeKill = true;
}
}
};
ObjPersBall.prototype.End = function () {
with (this) {
if (((Type == "Fire") || (Type == "Spark")) && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.Burn = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckHit = function () {
with (this) {
if (Type == "Net") {
if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Burn";
_global.Game[Pers.CurrentFireID].Etat = "End";
} else if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.Hit))) {
Etat = "Hit";
}
}
if (((Type == "Spark") && (Pers.Etat != "Activate")) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.HitFront))) {
Pers.Etat = "Hurt";
Etat = "End";
}
if (((Type == "Spark") && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1].FinalHit))) && (G_Medusa.Etat != "Die")) {
_global.HUD.increaseScore(10000);
_parent.Control.Bg.CamOnMedusa = true;
G_Medusa.Etat = "Die";
}
}
};
ObjPersBall.prototype.CheckOut = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckKill = function () {
with (this) {
if (CanBeKill == true) {
KillBall();
}
}
};
ObjPersBall.prototype.KillBall = function () {
with (this) {
if (Tab == G_TabPersBall) {
G_TabPersBall.splice(PersBallI, 1);
PersBallI = PersBallI - 1;
} else if (Tab == G_TabMinionBall) {
G_TabMinionBall.splice(MinionBallI, 1);
MinionBallI = MinionBallI - 1;
}
delete _parent.Control[Nom];
_parent.Bg[1][Nom].removeMovieClip();
if (Type == "Fire") {
Pers.CurrentFireID = null;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = null;
}
}
};
ObjPersBall.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjPersBall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
};
ObjPersBall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Etat.play();
}
this[Etat]();
CheckKill();
}
}
};
CreerSwitch = function (Nom, PosX, PosY) {
if (this[Nom] == null) {
this[Nom] = new ObjSwitch(Nom, PosX, PosY);
G_TabSwitch.push(Nom);
}
};
ObjSwitch.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjSwitch.prototype.Idle = function () {
with (this) {
CheckPersOn();
CheckBoxOn();
CheckSleep();
}
};
ObjSwitch.prototype.Baisse = function () {
with (this) {
if (_parent[Nom].Etat._currentframe >= FrBaisse) {
_global.SoundCTRL.playSound("SwitchOn", 100, 0);
_parent[Nom].Activate();
Etat = "Active";
}
}
};
ObjSwitch.prototype.Active = function () {
with (this) {
CheckSleep();
if (!FlagBoxUse) {
CheckRelease();
}
}
};
ObjSwitch.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
FlagUse = true;
Etat = "Baisse";
}
}
};
ObjSwitch.prototype.CheckBoxOn = function () {
with (this) {
var Box = Pers.PushedBox;
if ((Pers.Etat == "Push") && (Box != 0)) {
if (Box.Dir == "G") {
if (((((Box.PosX - Box.LgHitG) >= (PosX - LgOnX)) and ((Box.PosX - Box.LgHitG) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Etat = "Baisse";
Activate();
}
} else if (Box.Dir == "D") {
if (((((Box.PosX + Box.LgHitD) >= (PosX - LgOnX)) and ((Box.PosX + Box.LgHitD) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
} else if ((Box.Etat == "LandFin") && (Box != 0)) {
if ((((Box.PosX >= (PosX - LgOnX)) and (Box.PosX <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
Box.Dir = "";
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
}
};
ObjSwitch.prototype.CheckRelease = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
} else {
Etat = "Idle";
FlagUse = false;
_parent[Nom].Desactivate();
_global.SoundCTRL.playSound("SwitchOff", 100, 0);
}
}
};
ObjSwitch.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjSwitch.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjSwitch.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjSwitch.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerElevator = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjElevator(l_mcElement, "Y", 0, -1 * l_mcElement.distance);
G_TabElevator.push(l_mcElement._name);
}
};
this.onSwitchLift = function (l_Nom) {
with (this) {
if (_global.Game[l_Nom + "Lift"].Active == true) {
_global.Game[l_Nom + "Lift"].Active = false;
_global.Game[l_Nom].Etat = "Idle";
_global.Snd.stopSound("lift");
} else {
_global.Game[l_Nom + "Lift"].Active = true;
_global.Game[l_Nom].Etat = "IdleActivate";
_global.Snd.playSound("lift", 100, 999, true);
}
}
};
ObjElevator.prototype.Sleep = function () {
with (this) {
CheckActif();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Idle = function () {
with (this) {
CheckSleep();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Wait = function () {
with (this) {
if (frWaitCount >= frWaitTime) {
Etat = "Idle";
frWaitCount = 0;
} else {
frWaitCount++;
}
}
};
ObjElevator.prototype.SetMove = function () {
with (this) {
CheckPersOn();
CheckLimit();
MoveElevator();
}
};
ObjElevator.prototype.MoveElevator = function () {
with (this) {
this["Pos" + Axis] = this["Pos" + Axis] + this["Move" + Axis];
_parent[Nom]._x = PosX;
_parent[Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY;
if (PersOn) {
Pers["Move" + Axis] = this["Move" + Axis];
Pers.MovePers();
}
UpdateLift();
}
};
ObjElevator.prototype.UpdateLift = function () {
with (this) {
var cableH = (this["Pos" + Axis] - Max);
mc.Obj.cable1._height = cableH;
mc.Obj.cable2._height = cableH;
mc._y = mc._y + this["Move" + Axis];
mc._parent[Nom.substr(0, -4)]._y = mc._parent[Nom.substr(0, -4)]._y + this["Move" + Axis];
_global.Game[Nom.substr(0, -4)].PosY = _global.Game[Nom.substr(0, -4)].PosY + this["Move" + Axis];
_global.Game._parent.overlay[Nom + "ramp"]._y = _global.Game._parent.overlay[Nom + "ramp"]._y + this["Move" + Axis];
_global.Game._parent.Bg[1][Nom + "ramp"]._y = _global.Game._parent.Bg[1][Nom + "ramp"]._y + this["Move" + Axis];
}
};
ObjElevator.prototype.CheckLimit = function () {
with (this) {
this["Move" + Axis] = Speed * Dir;
if ((Dir == -1) && ((this["Pos" + Axis] + this["Move" + Axis]) <= Max)) {
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = false;
CanReposition = true;
RepositionCount = 0;
Dir = 0;
}
if ((Dir == 1) && ((this["Pos" + Axis] + this["Move" + Axis]) >= Min)) {
CanReposition = false;
Dir = -1;
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = true;
_global.Game[Nom.substr(0, -4)].Etat = "Idle";
}
}
};
ObjElevator.prototype.CheckReposition = function () {
with (this) {
if (CanReposition) {
CheckPersOn();
if (!PersOn) {
if ((++RepositionCount) == RepositionDelay) {
RepositionCount = 0;
CanReposition = false;
Active = true;
Dir = 1;
_global.Snd.playSound("lift", 100, 999, true);
}
}
}
}
};
ObjElevator.prototype.Activate = function () {
with (this) {
Active = true;
}
};
ObjElevator.prototype.Desactivate = function () {
with (this) {
Active = false;
}
};
ObjElevator.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
PersOn = true;
} else {
PersOn = false;
}
}
};
ObjElevator.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
Etat = "Idle";
if (Active) {
CheckLimit();
MoveElevator();
}
}
}
};
ObjElevator.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjElevator.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjElevator.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLevier = function (Nom, PosX, PosY, listener) {
if (this[Nom] == null) {
this[Nom] = new ObjLevier(Nom, PosX, PosY, listener);
G_TabLevier.push(Nom);
}
};
ObjLevier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjLevier.prototype.Idle = function () {
with (this) {
if (Active) {
CheckPersOn();
CheckSleep();
}
}
};
ObjLevier.prototype.IdleActivate = ObjLevier.prototype.Idle;
ObjLevier.prototype.Activate = function () {
with (this) {
if (Pers.ICharacter == 0) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.Etat == "Activate")) && (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes)) {
listener(Nom);
}
}
}
};
ObjLevier.prototype.CheckPersOn = function () {
with (this) {
if ((Pers.ICharacter == 0) && (Pers.Etat != "Push")) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.HitGrd == true)) && (Pers.CanBeHit || (Pers.Invincible))) {
if (KeyListener.Action) {
Pers.canJumpCount = 0;
Etat = "Activate";
Pers.Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
}
}
} else if (((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
} else if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
};
ObjLevier.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjLevier.prototype.CheckSleep = function () {
};
ObjLevier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjLevier.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLadder = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjLadder(l_mcElement);
G_TabLadder.push(l_mcElement._name);
}
};
this.onSwitchLadder = function (l_Nom) {
with (this) {
_global.Game[l_Nom + "Ladder"].Etat = "Opening";
}
};
ObjLadder.prototype.Off = function () {
with (this) {
}
};
ObjLadder.prototype.Opening = function () {
with (this) {
if (mc.etat._currentframe == mc.etat._totalframes) {
Etat = "On";
}
}
};
ObjLadder.prototype.On = function () {
with (this) {
CheckPersOn();
}
};
ObjLadder.prototype.CheckPersOn = function () {
with (this) {
if (Pers.ladderDisabledCount >= Pers.ladderDisabledMax) {
if (((((Pers.PosX >= PosX) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= PosY)) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
if (((Pers.ICharacter == 0) && (Pers.Etat != "Climbing")) && (Pers.Etat != "Hurt")) {
if ((KeyListener.Up && (Pers.PosY >= (PosY + 70))) || (KeyListener.Dw && (Pers.PosY <= (PosY + 165)))) {
Pers.onLadderID = Nom;
Pers.Etat = "Climbing";
Pers.ClimbedDistance = 0;
}
}
} else if ((Pers.Etat == "Climbing") && (Pers.onLadderID == Nom)) {
if (Pers.PosX < PosX) {
Pers.ChangeDir("G");
}
if (Pers.PosX > (PosX + LgOnX)) {
Pers.ChangeDir("D");
}
Pers.Etat = "Fall";
Pers.onLadderID = null;
}
} else {
Pers.ladderDisabledCount++;
}
}
};
ObjLadder.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjLadder.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerBouncingChair = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBouncingChair(l_mcElement);
G_TabChair.push(l_mcElement._name);
}
};
ObjBouncingChair.prototype.Idle = function () {
with (this) {
if (CheckPersOn()) {
Etat = "Bounce";
if ((Pers.onBouncingID == Nom) && (Pers.HitGrd)) {
Pers.onBouncingID = null;
}
}
}
};
ObjBouncingChair.prototype.Bounce = function () {
with (this) {
if (mc.Etat._currentframe == 9) {
BouncePers();
}
if (mc.Etat._currentframe == mc.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjBouncingChair.prototype.CheckPersOn = function () {
with (this) {
if ((((((((Pers.ICharacter == 0) && (Pers.Etat != "Idle")) && (Pers.Etat != "Run")) and (Pers.PosX >= PosX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
return(true);
}
}
};
ObjBouncingChair.prototype.BouncePers = function () {
with (this) {
if (CheckPersOn()) {
Pers.SpdYUp = Pers.SpdYUpBase;
if (Pers.onBouncingID != Nom) {
Pers.onBouncingID = Nom;
Pers.bounceCount = 0;
} else {
Pers.bounceCount++;
if (Pers.bounceCount > 0) {
Pers.bounceCount = Pers.bounceCountMax;
}
Pers.SpdYUp = Pers.SpdYUp - (Pers.bounceCount * 0.34);
}
Pers.Etat = "JumpStart";
} else if (Pers.HitGrd) {
Pers.onBouncingID = null;
}
}
};
ObjBouncingChair.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjBouncingChair.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerHuntSoldier = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntSoldier";
this[l_mcElement._name] = new ObjHuntSoldier(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntSoldier.push(l_mcElement._name);
}
};
ObjHuntSoldier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntSoldier.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckShield();
CheckDir();
CheckHurt();
CheckSleep();
}
};
ObjHuntSoldier.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Stunned = ObjHuntSoldier.prototype.Hurt;
ObjHuntSoldier.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack1 = function () {
with (this) {
if (((Pers.Etat != "Hurt") && (_parent.Bg[1][Nom].Obj.Etat._currentframe >= 9)) && (_parent.Bg[1][Nom].Obj.Etat._currentframe <= 25)) {
if (_parent.Bg[1][Nom].Obj.Etat.wave.hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack2 = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 7) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
_global.Snd.playSound("hurtJake", 100, 1, false);
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjHuntSoldier.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if ((Etat != "Shield") && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
if ((++HurtCount) == 3) {
enemyHitScore();
Etat = "Stunned";
HurtCount = 0;
} else {
Etat = "Hurt";
}
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
}
};
ObjHuntSoldier.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjHuntSoldier.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Math.abs(Pers.PosY - PosY) < 180) && (Math.random() < AttackChance)) {
if (Math.abs(Pers.PosX - PosX) < 150) {
Etat = "Attack2";
} else {
Etat = "Attack1";
}
AttackDelayCount = 0;
}
}
};
ObjHuntSoldier.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntSoldier.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjHuntSoldier.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntSoldier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjHuntSoldier.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerHuntWindow = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntWindow";
this[l_mcElement._name] = new ObjHuntWindow(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntWindow.push(l_mcElement._name);
}
};
ObjHuntWindow.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntWindow.prototype.IdleClose = function () {
with (this) {
CheckCanOpen();
CheckSleep();
}
};
ObjHuntWindow.prototype.IdleOpen = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt._currentframe == 1) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.gotoAndStop(HuntID);
SetHuntEtat("Appear");
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
}
if ((HuntEtat == "Appear") && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
SetHuntEtat("idle");
}
if (HuntEtat == "idle") {
CheckFlip();
CheckAttack();
}
if (((HuntEtat == "disappear") || (HuntEtat == "flee")) && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat.stop();
Etat = "Close";
if (HuntEtat == "flee") {
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = -80;
}
}
if (HuntEtat == "Throw") {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes) {
SetHuntEtat("idle");
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == FrThrow) {
var l_dir = "G";
if (HuntID == "A") {
l_dir = "D";
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
if (l_dir == "D") {
l_dir = "G";
} else {
l_dir = "D";
}
}
var l_netY = 70;
if (PosY < Pers.TrueY) {
l_netY = l_netY + (Math.abs(Pers.PosY - TrueY) - 150);
} else {
l_netY = l_netY - Math.abs(Pers.PosY - TrueY);
}
if (l_netY > 120) {
l_netY = 120;
}
if (l_netY < 20) {
l_netY = 20;
}
CreerNetBall(PosX, PosY + l_netY, l_dir);
_global.Snd.playSound("net", 130, 1, false);
}
}
CheckCanClose();
CheckHurt();
CheckSleep();
}
};
ObjHuntWindow.prototype.Open = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleOpen";
AttackDelayCount = AttackDelay * 0.9;
}
}
};
ObjHuntWindow.prototype.Close = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleClose";
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
}
};
ObjHuntWindow.prototype.CheckCanOpen = function () {
with (this) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == null) {
if (_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] >= _global.Game.G_WindowOpenDelay) {
if ((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown))) {
if (((Pers.ICharacter == 0) && (Math.random() <= OpenChanceJake)) || ((Pers.ICharacter == 1) && (Math.random() <= OpenChanceDragon))) {
Etat = "Open";
_global.Game["G_HuntWindowCurrent" + HuntID] = Nom;
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = 0;
}
}
}
}
}
};
ObjHuntWindow.prototype.CheckCanClose = function () {
with (this) {
if (CloseDelayCount < CloseDelay) {
CloseDelayCount++;
} else if ((HuntEtat != "disappear") && ((!((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown)))) || ((Pers.ICharacter == 0) && (Math.random() <= CloseChance)))) {
if (Math.random() <= OpenChance) {
SetHuntEtat("disappear");
CloseDelayCount = 0;
}
}
}
};
ObjHuntWindow.prototype.CheckFlip = function () {
with (this) {
if (FlipDelayCount < FlipDelay) {
FlipDelayCount++;
} else {
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
FlipDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Pers.ICharacter == 1) && (Math.abs(Pers.PosY - PosY) < 300)) {
SetHuntEtat("Throw");
AttackDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckHurt = function () {
with (this) {
if ((((HuntEtat == "idle") || (HuntEtat == "Throw")) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].Obj.hitTest(_parent.Pers.Obj.HitFront))) {
SetHuntEtat("flee");
enemyHitScore();
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
};
ObjHuntWindow.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "IdleClose";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntWindow.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == Nom) {
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
Etat = "Sleep";
}
}
};
ObjHuntWindow.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntWindow.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.window.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.overlay.gotoAndStop(G_CurrentLevel);
}
};
ObjHuntWindow.prototype.SetHuntEtat = function (newEtat) {
with (this) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.gotoAndStop(newEtat);
HuntEtat = newEtat;
}
};
ObjHuntWindow.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusa = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "Medusa";
this[l_mcElement._name] = new ObjMedusa(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusa.push(l_mcElement._name);
}
};
ObjMedusa.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckDir();
CheckHurt();
}
};
ObjMedusa.prototype.Captured = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showNextScreen();
}
}
};
ObjMedusa.prototype.Die = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showWinScreen();
}
}
};
ObjMedusa.prototype.Laugh = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Attack = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe < FrPrepareAttack) {
CheckDir();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrPrepareAttack) {
if (Pers.ICharacter == 0) {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 1.5));
} else {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 3));
}
NextAttackRotation = Math.round(pointsGetAngle(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY));
var l_dst = pointsGetDistance(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY);
var l_step = (l_dst / 20);
NextAttackRotationSpdX = (Pers.TrueX - G_Medusa.TrueX) / l_step;
NextAttackRotationSpdY = (l_PersY - G_Medusa.TrueY) / l_step;
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrAttack) {
var l_PosX = PosX;
CreerSparkBall(PosX, PosY - 95, Dir, NextAttackRotation, NextAttackRotationSpdX, NextAttackRotationSpdY);
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
HasAttacked = true;
Etat = "Idle";
}
CheckHurt();
}
};
ObjMedusa.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjMedusa.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Laugh";
}
}
}
};
ObjMedusa.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjMedusa.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if (Math.random() < AttackChance) {
Etat = "Attack";
HasAttacked = false;
AttackDelayCount = 0;
}
}
};
ObjMedusa.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjMedusa.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjMedusa.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjMedusa.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusaSister = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "MedusaSister";
this[l_mcElement._name] = new ObjMedusaSister(l_mcElement, Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusaSister.push(l_mcElement._name);
}
};
ObjMedusaSister.prototype.UpdateSister = function (SisterID) {
with (this) {
if (CurrentSister == SisterID) {
mc[SisterID].gotoAndStop(CurrentAction);
} else {
mc[SisterID].gotoAndStop("Idle");
}
}
};
ObjMedusaSister.prototype.UpdatePosition = function () {
with (this) {
var l_maxOffset = 70;
var l_posX = Math.abs(_parent.Control.Bg.PosX);
mc._x = -((l_posX / 450) * l_maxOffset);
mc._y = mc._y + (_global.MoveY / 2.5);
if (mc._y < 145) {
mc._y = 145;
}
}
};
ObjMedusaSister.prototype.UpdateAttack = function () {
with (this) {
if ((CurrentAction == "Idle") && (!MedusaAttack)) {
if ((++AttackDelayCount) == AttackDelay) {
if (CurrentSister == "SisterLeft") {
CurrentSister = "SisterRight";
} else {
CurrentSister = "SisterLeft";
}
CurrentAction = "Charge";
AttackDelayCount = 0;
}
} else if (CurrentAction == "Charge") {
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
var PersY = Math.abs(_global.Game.Pers.PosY);
switch (true) {
case PersY < 100 :
CurrentAction = "Attack3";
break;
case PersY < 250 :
CurrentAction = "Attack2";
break;
case PersY >= 250 :
CurrentAction = "Attack1";
}
}
} else if (((CurrentAction == "Attack1") || (CurrentAction == "Attack2")) || (CurrentAction == "Attack3")) {
if (mc[CurrentSister].Etat._currentframe == 9) {
if ((Pers.Etat != "Activate") && (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Pers))) {
Pers.Etat = "Hurt";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna1)) {
_global.Game.Antenna1.Etat = "Charged";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna2)) {
_global.Game.Antenna2.Etat = "Charged";
}
}
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
CurrentAction = "Idle";
if (CurrentSister == "SisterRight") {
MedusaAttack = true;
G_Medusa.HasAttacked = false;
}
}
}
if (!MedusaAttack) {
G_Medusa.AttackDelayCount = 0;
} else if (G_Medusa.HasAttacked) {
MedusaAttack = false;
}
}
};
ObjMedusaSister.prototype.Actions = function () {
with (this) {
UpdatePosition();
UpdateAttack();
UpdateSister("SisterLeft");
UpdateSister("SisterRight");
}
};
CreerWall = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjWall(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabWall.push(l_mcElement._name);
}
};
ObjWall.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjWall.prototype.Idle = function () {
with (this) {
CheckHurt();
CheckSleep();
}
};
ObjWall.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrRemoveWallHit) {
_parent.Collider.Wall[Nom].removeMovieClip();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Out";
}
}
};
ObjWall.prototype.CheckHurt = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjWall.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjWall.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjWall.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjWall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.wall.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.wall.gotoAndStop(G_CurrentLevel);
}
};
ObjWall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerDragonObstacle = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjDragonObstacle(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabDragonObstacle.push(l_mcElement._name);
}
};
ObjDragonObstacle.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjDragonObstacle.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjDragonObstacle.prototype.Hit = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.HitBoss = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 4) {
_global.Game.Web.Etat = "Fall";
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.Fall = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == (_parent.Bg[1][Nom].Obj.Etat._totalframes - 1)) {
G_Medusa.Etat = "Captured";
}
}
};
ObjDragonObstacle.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_parent.Bg[1][Nom].Obj.Etat.stop();
}
}
};
ObjDragonObstacle.prototype.CheckHit = function () {
with (this) {
if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitTop) || (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitBottomFront)))) {
Pers.Etat = "Hurt";
Etat = "Hit";
Pers.InvincibleEnd();
Pers.MoveY = 40;
}
}
};
ObjDragonObstacle.prototype.CheckActif = function () {
with (this) {
if (_global.boss || (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep"))) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjDragonObstacle.prototype.CheckSleep = function () {
with (this) {
if (((((!_global.boss) && (PosX < (Bg.InvPosX - LgOutG))) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjDragonObstacle.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjDragonObstacle.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjDragonObstacle.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerAntenna = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjAntenna(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabAntenna.push(l_mcElement._name);
}
};
ObjAntenna.prototype.Idle = function () {
with (this) {
CheckHit();
}
};
ObjAntenna.prototype.Charged = function () {
with (this) {
CheckHit();
if ((++ChargedCount) == ChargedDelay) {
Etat = "Idle";
ChargedCount = 0;
}
}
};
ObjAntenna.prototype.CheckHit = function () {
with (this) {
if ((G_Medusa.CurrentSparkID != null) && (Pers.Etat != "Hurt")) {
if (_parent.Bg[1][Nom].Obj.Hit.hitTest(_parent.Bg[1][G_Medusa.CurrentSparkID])) {
Etat = "Charged";
ChargedCount = 0;
if ((_global.level == 1) && (_global.Game.Web.Etat != "Fall")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Web.Etat = "Fall";
_global.HUD.increaseScore(1000);
}
if ((((_global.level == 2) && (_global.Game.Antenna1.Etat == "Charged")) && (_global.Game.Antenna2.Etat == "Charged")) && (_global.Game.Wire.Etat != "HitBoss")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Wire.Etat = "HitBoss";
_global.HUD.increaseScore(2000);
}
}
}
}
};
ObjAntenna.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjAntenna.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if (Etat == "Charged") {
_global.Snd.playSound("antenna", 250, 1, false);
}
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjAntenna.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerBonus = function (type, l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBonus(type, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabBonus.push(l_mcElement._name);
}
};
ObjBonus.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjBonus.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBonus.prototype.CheckHit = function () {
with (this) {
if (((Pers.ICharacter == 0) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj))) || ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.Hit)))) {
switch (Type) {
case "Score" :
_global.Score = _global.Score + 500;
_global.Snd.playSound("energy", 200, 1, false);
_global.HUD.increaseScore(500);
break;
case "Life" :
if (_global.lives < 3) {
_global.lives++;
}
_global.Snd.playSound("life", 200, 1, false);
_global.HUD.increaseScore(200);
break;
case "Energy" :
_global.energy = _global.energy + 50;
if (_global.energy > 100) {
_global.energy = 100;
}
_global.Snd.playSound("bonus", 300, 1, false);
_global.HUD.increaseScore(200);
break;
case "Power" :
_global.dragonPower = 100;
_global.Snd.playSound("power", 300, 1, false);
_global.HUD.increaseScore(200);
}
KillBonus();
}
}
};
ObjBonus.prototype.KillBonus = function () {
with (this) {
G_TabBonus.splice(BonusI, 1);
BonusI = BonusI - 1;
delete _parent.Control[Nom];
_parent.Bg[1][Nom].swapDepths(90210);
_parent.Bg[1][Nom].removeMovieClip();
}
};
ObjBonus.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
Etat = "Idle";
}
}
};
ObjBonus.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjBonus.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjBonus.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
CheckKill();
}
}
};
this.cnt = 0;
this.G_CurrentLevel = _global.level;
switch (G_CurrentLevel) {
case 1 :
this.G_MaxEnemyHit = 28;
break;
case 2 :
this.G_MaxEnemyHit = 28;
break;
case 3 :
this.G_MaxEnemyHit = 38;
}
G_MaxEnemyHitCount = 0;
this.G_Pause = true;
this.G_PauseOut = false;
this.G_PRealese = true;
this.G_Resume = false;
this.G_TabBox = new Array();
this.G_TabSwitch = new Array();
this.G_TabDoor = new Array();
this.G_TabElevator = new Array();
this.G_TabPersBall = new Array();
this.G_TabLevier = new Array();
this.G_TabLadder = new Array();
this.G_TabChair = new Array();
this.G_TabHuntSoldier = new Array();
this.G_TabHuntWindow = new Array();
this.G_TabMedusa = new Array();
this.G_TabMedusaSister = new Array();
this.G_TabWall = new Array();
this.G_TabDragonObstacle = new Array();
this.G_TabAntenna = new Array();
this.G_TabBonus = new Array();
this.G_NextPersBall = 1;
this.G_NextPersBallDepth = 10000;
this.G_NextMinionBall = 1;
this.G_NextMinionBallDepth = 20000;
this.G_OverlayDepth = 0;
this.G_HuntWindowCurrentA = null;
this.G_HuntActiveSinceA = 0;
this.G_HuntWindowCurrentB = null;
this.G_HuntActiveSinceB = 0;
this.G_AlphaZones = new Array();
this.G_Medusa = null;
this.G_WindowOpenDelay = 20;
this.G_WindowAOpenDelayCount = 0;
this.G_WindowBOpenDelayCount = 0;
this.addAlphaZone = function (mc) {
if (_global.Packaging.bShadowDisabled) {
mc._visible = false;
}
};
this.resetLevel = function () {
_global.dragonPower = 100;
_global.energy = 100;
if (_global.boss) {
_global.resetDestination = "Game_BOSS" + _global.level;
} else {
_global.resetDestination = "Game_LEVEL" + _global.level;
}
_parent._parent.gotoAndStop("Reset");
};
this.bossStart = function () {
_global.boss = true;
_global.resetDestination = "Game_BOSS" + _global.level;
_parent._parent.gotoAndStop("Reset");
};
this.enemyHitScore = function () {
if ((++G_MaxEnemyHitCount) < G_MaxEnemyHit) {
_global.HUD.increaseScore(100);
}
};
this.Creer_PBalcony = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 235);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PRoofTop = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
var pt = new Object();
pt = {x:l_mcElement._x - 5, y:l_mcElement._y + 95};
var mcCeil = _parent.Collider.Ceil;
mcCeil.moveTo(pt.x, pt.y);
mcCeil.beginFill(16711935);
pt.x = pt.x + 115;
pt.y = pt.y - 70;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x + 115;
pt.y = pt.y + 70;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y - 80;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x - 230;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y + 80;
mcCeil.lineTo(pt.x, pt.y);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBalconyOpen = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + (l_mcElement._parent._y + 10);
CreerPlateforme(pt, 235);
if (l_mcElement.flipped) {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01OverlayFlip", {x:pt.x + 32, y:pt.y}, true);
CreerObstacle({x:pt.x + 19, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
} else {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01Overlay", {x:pt.x + 120, y:pt.y + 0.5}, true);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 195, y:pt.y}, 15, 15);
}
_parent.overlay[l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
_parent.Bg[1][l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBox = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 70);
CreerObstacle(pt, 70, 70);
}
};
this.CheckVisible = function () {
if ((this._y < (Bg.InvPosY - Stage.height)) or (this._y > (Bg.InvPosY + Stage.height))) {
this._visible = false;
} else {
this._visible = true;
}
};
this.CreerObstacle = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Wall;
var _local4 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local4.moveTo(pt.x, pt.y);
_local4.beginFill(16711935);
_local4.lineTo(pt.x, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y);
_local4.lineTo(pt.x, pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711680);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerObstacleDragon = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Dragon;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16776960);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerPlateforme = function (pt, l_nWidth) {
var _local3 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711935);
_local3.lineTo(pt.x, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerOverlay = function (id, linkage, pt, bReversed) {
var _local4;
var _local5;
_local5 = _parent.overlay.attachMovie(linkage, id, G_OverlayDepth++);
_local5._x = pt.x;
_local5._y = pt.y;
_local4 = _parent.Bg[1].attachMovie(linkage, id, G_OverlayDepth++);
_local4._x = pt.x;
_local4._y = pt.y;
_local4.overlay = _local5;
if (!bReversed) {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = false;
this.overlay._visible = true;
} else {
this._visible = true;
this.overlay._visible = false;
}
};
} else {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = true;
this.overlay._visible = false;
} else {
this._visible = false;
this.overlay._visible = true;
}
};
}
};
this.replaceTile = function (l_mcElement) {
var _local1 = l_mcElement._name;
var _local2 = 1499;
if (_local1.slice(0, 8) == "instance") {
} else {
l_mcElement._x = 0;
l_mcElement._y = -((Number(_local1) - 1) * _local2);
}
};
this.CreerFloor = function (l_nPosX, l_nPosY, l_nWidth, l_nHeight) {
var mcGround = _parent.Collider.Sol;
with (this) {
pt = new Object();
pt = {x:l_nPosX, y:l_nPosY};
pt.y = pt.y - l_nHeight;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor1 = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -60;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloorBoss = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -88;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 120;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 200;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 300;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 360;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 400;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 440;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor5 = function (l_mcElement) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
}
};
}
onClipEvent (enterFrame) {
BoxI = 0;
for (BoxI in G_TabBox) {
var BoxActif = G_TabBox[BoxI];
if (this[BoxActif].Etat != this[BoxActif].EtatOld) {
this[BoxActif].ChangeEtat(this[BoxActif].Etat);
}
this[BoxActif].Actions();
}
PersBallI = 0;
for (PersBallI in G_TabPersBall) {
var PersBallActif = G_TabPersBall[PersBallI];
if (this[PersBallActif].Etat != this[PersBallActif].EtatOld) {
this[PersBallActif].ChangeEtat(this[PersBallActif].Etat);
}
this[PersBallActif].Actions();
}
LevierI = 0;
for (LevierI in G_TabLevier) {
var LevierActif = G_TabLevier[LevierI];
if (this[LevierActif].Etat != this[LevierActif].EtatOld) {
this[LevierActif].ChangeEtat(this[LevierActif].Etat);
}
this[LevierActif].Actions();
}
LadderI = 0;
for (LadderI in G_TabLadder) {
var LadderActif = G_TabLadder[LadderI];
if (this[LadderActif].Etat != this[LadderActif].EtatOld) {
this[LadderActif].ChangeEtat(this[LadderActif].Etat);
}
this[LadderActif].Actions();
}
ChairI = 0;
for (ChairI in G_TabChair) {
var ChairActif = G_TabChair[ChairI];
if (this[ChairActif].Etat != this[ChairActif].EtatOld) {
this[ChairActif].ChangeEtat(this[ChairActif].Etat);
}
this[ChairActif].Actions();
}
ElevatorI = 0;
for (ElevatorI in G_TabElevator) {
var ElevatorActif = G_TabElevator[ElevatorI];
if (this[ElevatorActif].Etat != this[ElevatorActif].EtatOld) {
this[ElevatorActif].ChangeEtat(this[ElevatorActif].Etat);
}
this[ElevatorActif].Actions();
}
I = 0;
for (HuntSoldierI in G_TabHuntSoldier) {
var HuntSoldierActif = G_TabHuntSoldier[HuntSoldierI];
if (this[HuntSoldierActif].Dir != this[HuntSoldierActif].DirOld) {
this[HuntSoldierActif].ChangeDir(this[HuntSoldierActif].Dir);
}
if (this[HuntSoldierActif].Etat != this[HuntSoldierActif].EtatOld) {
this[HuntSoldierActif].ChangeEtat(this[HuntSoldierActif].Etat);
}
this[HuntSoldierActif].Actions();
}
I = 0;
for (HuntWindowI in G_TabHuntWindow) {
var HuntWindowActif = G_TabHuntWindow[HuntWindowI];
if (this[HuntWindowActif].Dir != this[HuntWindowActif].DirOld) {
this[HuntWindowActif].ChangeDir(this[HuntWindowActif].Dir);
}
if (this[HuntWindowActif].Etat != this[HuntWindowActif].EtatOld) {
this[HuntWindowActif].ChangeEtat(this[HuntWindowActif].Etat);
}
this[HuntWindowActif].Actions();
}
if (!G_Pause) {
if (_global.Game.G_HuntWindowCurrentA == null) {
_global.Game.G_WindowAOpenDelayCount++;
}
if (_global.Game.G_HuntWindowCurrentB == null) {
_global.Game.G_WindowBOpenDelayCount++;
}
}
I = 0;
for (MedusaI in G_TabMedusa) {
var MedusaActif = G_TabMedusa[MedusaI];
if (this[MedusaActif].Dir != this[MedusaActif].DirOld) {
this[MedusaActif].ChangeDir(this[MedusaActif].Dir);
}
if (this[MedusaActif].Etat != this[MedusaActif].EtatOld) {
this[MedusaActif].ChangeEtat(this[MedusaActif].Etat);
}
this[MedusaActif].Actions();
}
I = 0;
for (WallI in G_TabWall) {
var WallActif = G_TabWall[WallI];
if (this[WallActif].Dir != this[WallActif].DirOld) {
this[WallActif].ChangeDir(this[WallActif].Dir);
}
if (this[WallActif].Etat != this[WallActif].EtatOld) {
this[WallActif].ChangeEtat(this[WallActif].Etat);
}
this[WallActif].Actions();
}
I = 0;
for (DragonObstacleI in G_TabDragonObstacle) {
var DragonObstacleActif = G_TabDragonObstacle[DragonObstacleI];
if (this[DragonObstacleActif].Dir != this[DragonObstacleActif].DirOld) {
this[DragonObstacleActif].ChangeDir(this[DragonObstacleActif].Dir);
}
if (this[DragonObstacleActif].Etat != this[DragonObstacleActif].EtatOld) {
this[DragonObstacleActif].ChangeEtat(this[DragonObstacleActif].Etat);
}
this[DragonObstacleActif].Actions();
}
I = 0;
for (AntennaI in G_TabAntenna) {
var AntennaActif = G_TabAntenna[AntennaI];
if (this[AntennaActif].Dir != this[AntennaActif].DirOld) {
this[AntennaActif].ChangeDir(this[AntennaActif].Dir);
}
if (this[AntennaActif].Etat != this[AntennaActif].EtatOld) {
this[AntennaActif].ChangeEtat(this[AntennaActif].Etat);
}
this[AntennaActif].Actions();
}
I = 0;
for (MedusaSisterI in G_TabMedusaSister) {
var MedusaSisterActif = G_TabMedusaSister[MedusaSisterI];
if (this[MedusaSisterActif].Dir != this[MedusaSisterActif].DirOld) {
this[MedusaSisterActif].ChangeDir(this[MedusaSisterActif].Dir);
}
if (this[MedusaSisterActif].Etat != this[MedusaSisterActif].EtatOld) {
this[MedusaSisterActif].ChangeEtat(this[MedusaSisterActif].Etat);
}
this[MedusaSisterActif].Actions();
}
I = 0;
for (BonusI in G_TabBonus) {
var BonusActif = G_TabBonus[BonusI];
if (this[BonusActif].Dir != this[BonusActif].DirOld) {
this[BonusActif].ChangeDir(this[BonusActif].Dir);
}
if (this[BonusActif].Etat != this[BonusActif].EtatOld) {
this[BonusActif].ChangeEtat(this[BonusActif].Etat);
}
this[BonusActif].Actions();
}
if (Pers.Dir != Pers.DirOld) {
Pers.ChangeDir(Pers.Dir);
}
if (Pers.Etat != Pers.EtatOld) {
Pers.setState(Pers.Etat);
}
this.Pers.Actions();
this.Bg.Actions();
_global.HUD.update();
G_CheckPause();
}
Symbol 1209 MovieClip Frame 2
stop();
_global.C.beginLevel();
Instance of Symbol 1208 MovieClip "Bg" in Symbol 1209 MovieClip Frame 2
onClipEvent (load) {
this._x = 0;
this._y = 0;
_parent.Control.CreerBg(_parent._x, _parent._y);
BG = _parent.Control.Bg;
for (var i in _parent.Bg) {
if (Number(_parent.Bg[i]._name) <= 20) {
_parent.Bg[i].gotoAndStop(2);
} else {
_parent.Bg[i].gotoAndStop(3);
}
}
BG.MaxDw1 = 5100;
BG.MaxUp1 = -200;
BG.MaxG1 = 0;
BG.MaxD1 = 0;
BG.ParallaxRateSky = 1.18;
BG.ParallaxRateCity = 1.07;
BG.CheckScreen = function () {
with (this) {
MaxDw = MaxDw1;
MaxUp = MaxUp1;
MaxG = MaxG1;
MaxD = MaxD1;
}
};
}
Instance of Symbol 1150 MovieClip "Pers" in Symbol 1209 MovieClip Frame 2
onClipEvent (load) {
_parent.Control.CreerPers(this._x, this._y, "Jake");
this.gotoAndStop("D");
_global.Game.Pers.Etat = "Sleep";
_global.Game.Pers.setState("Idle");
}
Instance of Symbol 1154 MovieClip "Collider" in Symbol 1209 MovieClip Frame 2
onClipEvent (load) {
this._visible = 0;
}
Symbol 1228 MovieClip Frame 1
stop();
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 838 MovieClip "switchALift" in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
distance = 260;
}
Instance of Symbol 838 MovieClip "switchCLift" in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
distance = 260;
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 838 MovieClip "switchBLift" in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
distance = 260;
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 593 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 621 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Instance of Symbol 621 MovieClip in Symbol 1228 MovieClip Frame 1
onClipEvent (load) {
this.flipped = true;
}
Symbol 1228 MovieClip Frame 2
_parent._parent.Control.CreerFloor1(this, this._x, this._y);
stop();
Symbol 1229 MovieClip Frame 2
stop();
Instance of Symbol 560 MovieClip "Control" in Symbol 1230 MovieClip Frame 1
onClipEvent (load) {
function ObjBg(PosX, PosY) {
this.Nom = "Bg";
this.PosX = PosX;
this.PosY = PosY;
this.ParallaxPosX = 0;
this.ParallaxPosY = 0;
this.ParallaxSkyPosX = 0;
this.ParallaxSkyPosY = 0;
this.ParallaxCityPosX = 0;
this.ParallaxCityPosY = 0;
this.ParallaxRateSky = 1.2;
this.ParallaxRateCity = 1.1;
this.MoveX = 0;
this.MoveY = 0;
this.MaxDw = 0;
this.MaxUp = 0;
this.MaxG = 0;
this.MaxD = 0;
this.InvPosX = PosX * -1;
this.InvPosY = PosY * -1;
this.DeadX = PosX;
this.DeadY = PosY;
this.CurrentScreen = 1;
this.OldScreen = 0;
this.MaxYDie = 5000;
this.CenterX = 300;
this.CenterY = 370;
this.SpdXD = 15;
this.SpdXG = -15;
this.SpdYDw = 20;
this.SpdYUp = -20;
this.SpdYUpForce = 0;
this.InPause = false;
this.NoCamUpdate = false;
this.CamOnMedusa = false;
}
function ObjBox(Nom, PosX, PosY, Type, Dir) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.MoveX = 0;
this.MoveY = 0;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 75;
this.LgOutD = 525;
this.LgOutUp = 25;
this.LgOutDw = 475;
this.LgHitG = 34;
this.LgHitD = 35;
this.LgHitUp = 25;
this.LgHitDw = 26;
this.HitRightX;
this.HitLeftX;
this.PushDir = Dir;
this.Dir = Pers.Dir;
if (Dir == "D") {
_parent.Bg[1][Nom]._xscale = -100;
}
this.FlagUse = false;
this.LandSide = "Center";
this.MinionBlock = 0;
this.Etat = "Wait";
this.EtatOld = "Sleep";
this.FixedFlag = false;
_parent.Collider.Sol.attachMovie("TopBox", Nom, _parent.Collider.Sol.getNextHighestDepth());
_parent.Collider.Wall.attachMovie("BorderBox", Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Ceil.attachMovie("BottomBox", Nom, _parent.Collider.Ceil.getNextHighestDepth());
this.frTurn = 20;
this.SoundPush = false;
this.WebDestroyed = false;
this.MoveBox();
}
function ObjPers(PosX, PosY, Perso) {
this.nGetHitLeft = 0;
this.nGetHitRight = 0;
this.nGetHitTop = 0;
this.Nom = "Pers";
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.DirOld = "D";
this.Point = _global.C.Score;
this.Life = _global.C.Life;
this.SpdXMinion = 3;
this.SpdXNormal = 15;
this.SpdXBase = this.SpdXNormal;
this.SpdXNow = 0;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.FrontX = 0;
this.FrontY = 0;
this.BottomFrontX = 0;
this.BottomBackX = 0;
this.BackX = 0;
this.HitGrdPoint = 0;
this.WallHitBloc = 2;
this.SpdYNow = 0;
this.SpdYUpBase = 1.7;
this.SpdYUp = this.SpdYUpBase;
this.SpdYMax = 30;
this.SpdYFall = 2.2;
this.SpdYFly = 5;
this.SpdXHitBase = 0;
this.SpdYHitBase = -4;
this.SpdStartJump = -17;
this.SolOut = 2;
this.SolHitMin = 5;
this.MaxSol = 3;
this.HitGrd = false;
this.SolForJump = 6;
this.DistYFall = 0;
this.DistYFallMax = 900;
this.autoSwitchDragon = false;
this.DistYLand = 80;
this.CanHit = false;
this.CanBeHit = true;
this.FrWalkNow = 1;
this.InPause = false;
this.FrJump = 1;
this.FrFall = 1;
this.FrLand = 13;
this.FrGetHit = 7;
this.FrGetHitCount = 0;
this.FrBoomTir = 9;
this.FrFinBoom = 6;
this.FrDead = 20;
this.FrDeadCount = 0;
this.aCharacter = ["Jake", "Dragon"];
this.ICharacter = 0;
this.Perso = this.aCharacter[this.ICharacter];
this.updatePerso();
this.LgGetShootX = 20;
this.LgGetShootUp = 72;
this.LgGetShootUpBas = 44;
this.FrInvincibleCount = 0;
this.FrInvincible = 20;
this.Invincible = false;
this.FrSwitchCharacter = 15;
this.FrSwitchCharacterCount = 0;
this.bCanSwitch = true;
this.bJumpRelease = true;
this.SpdXBaseJumpKick = 20;
this.bComboCheck = false;
this.nFrDelayCombo = 15;
this.nFrDelayComboCount = 0;
this.bCanAttack = true;
this.bAttackRelease = true;
this.bSkipDie = false;
this.mcHitGetHurt = null;
this.HitPointX = 0;
this.HitPointY = 0;
this.nDragonPowerRythm = 25;
this.nDragonPowerCount = 0;
this.DragonHitTop = 0;
this.DragonHitBottom = 0;
this.DragonHeight = 130;
this.onLadderID = null;
this.ClimbedDistance = 0;
this.ladderDisabledMax = 15;
this.ladderDisabledCount = this.ladderDisabledMax;
this.onBouncingID = null;
this.bounceCount = 0;
this.bounceCountMax = 3;
this.bouncingDisabledMax = 15;
this.bouncingDisabledCount = this.bouncingDisabledMax;
this.bHitAttack = false;
this.FrShootFire = 15;
this.FrAttackTailHit = 9;
this.CurrentFireID = null;
if (_global.boss) {
this.WaitForActions = true;
} else {
this.WaitForActions = false;
}
}
function ObjPersBall(Type, Nom, PosX, PosY, Dir, HitBullet, Speed, Tab, HitSound, Rotation, SpdX, SpdY) {
this.Nom = Nom;
this.Type = Type;
this.HitSound = HitSound;
this.Tab = Tab;
this.Etat = "Move";
this.EtatOld = "Idle";
this.Dir = Dir;
this.OldDir = "D";
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 50;
this.LgOutD = 600;
this.LgOutUp = 0;
this.LgOutDw = 500;
this.CanBeKill = false;
if (Dir == "D") {
this.SpdX = Speed;
} else {
this.SpdX = -1 * Speed;
_parent.Bg[1][Nom]._xscale = -100;
}
this.InPause = false;
this.FrHit = HitBullet;
this.FrHide = 1;
if (Type == "Fire") {
Pers.CurrentFireID = Nom;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = Nom;
this.LgOutG = 1100;
this.LgOutD = 1100;
_parent.Bg[1][Nom]._xscale = -100;
_parent.Bg[1][Nom]._rotation = Rotation;
this.SpdX = SpdX;
this.SpdY = SpdY;
}
}
function ObjSwitch(Nom, PosX, PosY) {
this.Nom = Nom;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 20;
this.LgOnY = 20;
this.PosX = PosX;
this.PosY = PosY;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrBaisse = 13;
}
function ObjElevator(mc, Axis, Min, Max) {
this.Nom = mc._name;
this.mc = mc;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 750;
this.LgOutG = 200;
this.LgOutUp = 500;
this.LgOutDw = 900;
this.Speed = 2;
this.frWaitCount = 0;
this.frWaitTime = 30;
this.LgOnX = 200;
this.LgOnY = 25;
this.PersOn = false;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = mc._x + 40;
this.PosY = mc._y + 140;
this.Axis = Axis;
this.Min = this["Pos" + Axis] + Min;
this.Max = this["Pos" + Axis] + Max;
this.Active = false;
this.InPause = false;
this.Dir = -1;
this.CanReposition = false;
this.RepositionCount = 0;
this.RepositionDelay = 30;
_parent.Collider.Sol.attachMovie("GroundElevator", this.Nom, _parent.Collider.Sol.getNextHighestDepth());
_global.Game.CreerOverlay(mc._name + "ramp", "AM_RampeAscenseur01_overlay", {x:mc._x, y:mc._y + 140});
this.MoveElevator();
}
function ObjLevier(Nom, PosX, PosY, listener) {
this.Nom = Nom;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 30;
this.LgOnY = 100;
this.PosX = PosX;
this.PosY = PosY;
this.PersYCorrection = 60;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrFinLevelCount = 0;
this.FrFinLevel = 70;
this.Active = true;
this.listener = listener;
}
function pointsGetAngle(l_x1, l_y1, l_x2, l_y2) {
var _local4 = 0;
var _local3 = 0;
var _local1 = 0;
var _local2 = 0;
_local4 = (l_x1 - l_x2) * -1;
_local3 = (l_y1 - l_y2) * -1;
_local1 = Math.atan2(_local3, _local4);
_local1 = (_local1 * 180) / Math.PI;
if (_local1 < 0) {
_local1 = _local1 * -1;
_local2 = 180 - _local1;
_local1 = 180 + _local2;
}
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
function pointsGetDistance(l_x1, l_y1, l_x2, l_y2) {
var _local1 = Math.sqrt(Math.pow(Math.abs(l_x2 - l_x1), 2) + Math.pow(Math.abs(l_y2 - l_y1), 2));
return(_local1);
}
function ObjLadder(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.obj;
this.Etat = "Off";
this.EtatOld = "Off";
this.LgOnX = 70;
this.LgOnY = 265;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
}
function ObjBouncingChair(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.Obj;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOnX = 70;
this.LgOnY = 50;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
_global.Game.CreerPlateforme({x:this.PosX, y:this.PosY}, 73);
}
function ObjHuntSoldier(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 115;
this.AttackDelayCount = 0;
this.AttackChance = 0.03;
this.ShieldChance = 0.25;
this.HurtCount = 0;
}
function ObjHuntWindow(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "IdleClose";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 450;
this.LgOutDw = 450;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.AttackDelay = 100;
this.AttackDelayCount = 0;
if (PosX < 150) {
this.HuntID = "A";
this.FlipPosition = 20;
} else {
this.HuntID = "B";
this.FlipPosition = -20;
}
this.OpenRangeDown = 450;
this.OpenRangeUp = -20;
this.OpenChanceDragon = 0.85;
this.OpenChanceJake = 0.1;
this.HuntEtat = "idle";
this.AttackDelay = 100;
this.AttackDelayCount = 0;
this.AttackChance = 0.85;
this.FlipDelay = 10;
this.FlipDelayCount = 0;
this.CloseDelay = 100;
this.closeDelayCount = 0;
this.CloseChance = 0.5;
this.FrThrow = 11;
}
function ObjMedusa(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -60;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSparkID = null;
this.HasAttacked = false;
G_Medusa = this;
_global.Medusa = this;
}
function ObjMedusaSister(mc, Type, Nom, PosX, PosY) {
this.mc = mc;
this.Nom = Nom;
this.Perso = Type;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -110;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSister = "SisterRight";
this.CurrentAction = "Idle";
this.MedusaAttack = false;
}
function ObjWall(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
_parent.Collider.Wall.attachMovie("WallHit", this.Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Wall[Nom]._x = PosX;
_parent.Collider.Wall[Nom]._y = PosY;
this.FrRemoveWallHit = 4;
}
function ObjDragonObstacle(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
}
function ObjAntenna(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.ChargedDelay = 300;
this.ChargedCount = 0;
}
function ObjBonus(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.CanBeKill = false;
}
_global.Game = this;
this.KeyListener = new com.sarbakan.utils.KeyManager();
KeyListener.addKeyListener(39, "R");
KeyListener.addKeyListener(37, "L");
KeyListener.addKeyListener(40, "Dw");
KeyListener.addKeyListener(38, "Up");
KeyListener.addKeyListener(32, "Dragon");
KeyListener.addKeyListener(66, "Attack");
KeyListener.addKeyListener(78, "Action");
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
G_CheckPause = function () {
if ((Pers.Etat != "Die") and (Pers.Etat != "Dead")) {
if (G_PauseOut && (!G_Pause)) {
G_Pause = true;
_parent.ControlBall.stop();
_parent._parent.Popup.gotoAndStop("Pause");
if (_global.C.SoundActive) {
_global.SoundCTRL.muteAllSounds();
}
_global.C.DesactivateHud();
} else if ((G_Resume == true) and (G_Pause == true)) {
G_PauseOut = false;
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
KeyListener.Up = false;
KeyListener.UpRelease = true;
KeyListener.Dw = false;
KeyListener.L = false;
KeyListener.R = false;
KeyListener.X = false;
KeyListener.Z = false;
KeyListener.Sp = false;
Music.VolDest = 70;
Music.Etat = "FadeIn";
G_Pause = false;
G_Resume = false;
_parent._parent.Popup.gotoAndStop(1);
if (_global.C.SoundActive) {
_global.SoundCTRL.unmuteAllSounds();
}
_global.C.ActivateHud();
if (_parent.ControlBall._currentframe != 1) {
_parent.ControlBall.play();
}
}
}
};
CreerBg = function (PosX, PosY) {
this.Bg = new ObjBg(PosX, PosY);
};
ObjBg.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
CheckScreen();
if (!NoCamUpdate) {
ScrollBg();
}
}
}
};
ObjBg.prototype.ScrollBg = function () {
with (this) {
if (CamOnMedusa) {
Pers.TrueX = _global.Medusa.TrueX;
Pers.TrueY = _global.Medusa.TrueY;
}
if ((PosY <= MaxDw) and (PosY >= MaxUp)) {
if (Pers.TrueX > (CenterX + 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else {
if ((CenterX - Pers.TrueX) > SpdXG) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXG;
}
if ((PosX + MoveX) < MaxG) {
MoveX = MaxG - PosX;
}
}
} else if (Pers.TrueX < (CenterX - 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
} else {
if ((CenterX - Pers.TrueX) < SpdXD) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXD;
}
if ((PosX + MoveX) > MaxD) {
MoveX = MaxD - PosX;
}
}
} else {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
}
}
}
if ((PosX <= MaxD) and (PosX >= MaxG)) {
if (Pers.TrueY > (CenterY + 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxUp - PosY;
} else {
MoveY = SpdYDw;
}
} else {
if ((CenterY - Pers.TrueY) > SpdYUp) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYUp;
}
if ((PosY + MoveY) < MaxUp) {
MoveY = MaxUp - PosY;
}
}
} else if (Pers.TrueY < (CenterY - 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
} else {
if ((CenterY - Pers.TrueY) < SpdYDw) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYDw;
}
if ((PosY + MoveY) > MaxDw) {
MoveY = MaxDw - PosY;
}
}
} else {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYDw;
}
} else if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
}
}
}
_parent._x = Math.floor(_parent._x + MoveX);
PosX = _parent._x;
InvPosX = PosX * -1;
MoveX = 0;
_parent._y = Math.floor(_parent._y + MoveY);
PosY = _parent._y;
InvPosY = PosY * -1;
_global.MoveY = MoveY;
MoveY = 0;
_parent.ParallaxSky._y = (Math.floor(_parent._y / (-ParallaxRateSky)) + 350) + 30;
ParallaxSkyPosY = _parent.ParallaxSky._y;
_parent.ParallaxCity._y = (Math.floor(_parent._y / (-ParallaxRateCity)) + 140) + 30;
ParallaxCityPosY = _parent.ParallaxCity._y;
}
};
CreerBox = function (Nom, PosX, PosY, Type, Dir) {
if (this[Nom] == null) {
this[Nom] = new ObjBox(Nom, PosX, PosY, Type, Dir);
G_TabBox.push(Nom);
}
};
ObjBox.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBox.prototype.Wait = function () {
with (this) {
if (Type == "moveable") {
CheckPush();
}
CheckHitGrd();
CheckSleep();
CheckFall();
if (Type == "destroyable") {
CheckDestroy();
}
}
};
ObjBox.prototype.Fall = function () {
with (this) {
CheckHitGrd();
SetSpdFall();
MoveBox();
if (((Nom == "BoxDestroyWeb") && (!WebDestroyed)) && (TrueY > 350)) {
_global.Game.WebDestroyable.Etat = "Destroy";
WebDestroyed = true;
}
}
};
ObjBox.prototype.Land = function () {
with (this) {
CheckHitGrd();
SetSpdLand();
MoveBox();
if ((TrueX > 0) && (TrueX < 500)) {
_global.SoundCTRL.playSound("BoxLand", 100, 0);
}
}
};
ObjBox.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe >= _parent.Bg[1][Nom].Etat._totalframes) {
_parent.Bg[1][Nom].Etat.stop();
_parent.Collider.Sol[Nom].removeMovieClip();
_parent.Collider.Ceil[Nom].removeMovieClip();
_parent.Collider.Wall[Nom].removeMovieClip();
}
}
};
ObjBox.prototype.LandFin = function () {
with (this) {
Etat = "Wait";
Pers.PushedBox = 0;
}
};
ObjBox.prototype.Fixed = function () {
with (this) {
CheckSleep();
}
};
ObjBox.prototype.CheckPush = function () {
with (this) {
if (Pers.Etat == "Push") {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.PushPoint)) {
Dir = Pers.Dir;
if (Dir == "D") {
this.MoveX = 2;
} else if (Dir == "G") {
this.MoveX = -2;
}
CheckWall();
if (Pers.Dir != PushDir) {
MoveX = 0;
}
MoveBox();
Pers.PushedBox = this;
if (MoveX != 0) {
_global.Snd.playSound("push", 100, 999, true);
}
}
} else {
_global.Snd.stopSound("push");
}
}
};
ObjBox.prototype.CheckDestroy = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjBox.prototype.CheckHitGrd = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (_parent.Collider.Sol.hitTest(HitX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitRightX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitLeftX, HitY, true)) {
HitGrd = true;
} else {
HitGrd = false;
}
}
};
ObjBox.prototype.SetSpdFall = function () {
with (this) {
MaxMoveY = 15;
MoveY = MoveY + 5;
if (MoveY > MaxMoveY) {
MoveY = MaxMoveY;
}
aCheckPoint = [TrueX, HitLeftX, HitRightX];
for (CheckPointI in aCheckPoint) {
var activePointX = aCheckPoint[CheckPointI];
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 2), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 4), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
}
}
};
ObjBox.prototype.SetSpdLand = function () {
with (this) {
while ((_parent.Collider.Sol.hitTest(TrueX, TrueY + MoveY, true) || (_parent.Collider.Sol.hitTest(HitLeftX, TrueY + MoveY, true))) || (_parent.Collider.Sol.hitTest(HitRightX, TrueY + MoveY, true))) {
MoveY--;
}
if (MoveY < 1) {
MoveY = 1;
Etat = "LandFin";
}
}
};
ObjBox.prototype.CheckFall = function () {
with (this) {
if (HitGrd == true) {
MoveY = 0;
Etat = "Wait";
} else {
Etat = "Fall";
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
MoveX = 0;
MoveY = 0;
}
}
};
ObjBox.prototype.CheckWall = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (Pers.Dir == "G") {
HitX = HitX + (MoveX - LgHitG);
} else if (Pers.Dir == "D") {
HitX = HitX + (MoveX + LgHitD);
}
if (_parent.Collider.Wall.hitTest(HitX, HitY, true)) {
MoveX = 0;
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
}
}
};
ObjBox.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjBox.prototype.MoveBox = function () {
with (this) {
PosX = Number(PosX + MoveX);
PosY = Number(PosY + MoveY);
_parent.Bg[1][Nom]._x = PosX;
_parent.Bg[1][Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY - 15;
_parent.Collider.Wall[Nom]._x = PosX + 30;
_parent.Collider.Wall[Nom]._y = PosY + 4;
_parent.Collider.Ceil[Nom]._x = PosX;
_parent.Collider.Ceil[Nom]._y = PosY + 40;
}
};
ObjBox.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (FixedFlag) {
Etat = "Fixed";
} else {
Etat = "Wait";
}
}
}
};
ObjBox.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = (PosY + _parent._y) + LgHitDw;
HitRightX = TrueX + LgHitD;
HitLeftX = TrueX - LgHitG;
}
};
ObjBox.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if ((NewAction == "Turn") || (NewAction == "Fixed")) {
_parent.Bg[1][Nom].gotoAndStop(NewAction + Dir);
} else {
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
_parent.Bg[1][Nom].Etat.box.gotoAndStop(Type);
_parent.Bg[1][Nom].Etat.box.box.gotoAndStop(Type);
}
};
ObjBox.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
SetTruePos();
this[Etat]();
}
}
};
ObjPers.prototype.IdleJake = function () {
with (this) {
DistYFall = 0;
KeepDeadPos = true;
bCanAttack = true;
if (Life > 0) {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckPush();
CheckJump();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusJake = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.RunJake = function () {
with (this) {
bCanAttack = true;
DistYFall = 0;
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckJump();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartJake = function () {
with (this) {
Pers.bouncingDisabledCount = 0;
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
} else if (DistYFall >= DistYFallMax) {
autoSwitchDragon = true;
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingJake = function () {
with (this) {
CheckGetFire();
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (!_global.Game[onBouncingID].CheckPersOn()) {
bounceCount = 0;
Pers.onBouncingID = null;
}
if (_parent.Pers.Obj.Etat._currentframe >= 3) {
if (_global.energy <= 0) {
_global.energy = 0;
Etat = "Die";
}
}
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.ClimbingJake = function () {
with (this) {
SpdXNow = 0;
SpdYNow = 0;
CheckHitGrd();
if ((Pers.ClimbedDistance > 30) && (HitGrd)) {
Etat = "Idle";
Pers.ladderDisabledCount = 0;
} else if (KeyListener.Action) {
Etat = "Fall";
} else {
if (KeyListener.L) {
SpdXNow = -2;
} else if (KeyListener.R) {
SpdXNow = 2;
}
if (KeyListener.Up) {
SpdYNow = -3;
} else if (KeyListener.Dw) {
SpdYNow = 3;
}
SetMoveX();
SetMoveY();
CheckWall(FrontX, FrontY - 15);
CheckWall(BackX, FrontY - 15);
CheckWall(FrontX, FrontY);
CheckWall(BackX, FrontY);
CheckWall(FrontX, FrontY + 15);
CheckWall(BackX, FrontY + 15);
CheckWall(FrontX, FrontY + 30);
CheckWall(BackX, FrontY + 30);
CheckWall(FrontX, FrontY + 45);
CheckWall(BackX, FrontY + 45);
MovePers();
Pers.ClimbedDistance++;
}
if ((SpdXNow != 0) || (SpdYNow != 0)) {
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
_parent.Pers.Obj.Etat.gotoAndStop(1);
} else {
_parent.Pers.Obj.Etat.nextFrame();
}
} else {
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.ActivateJake = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.HurtJake = function () {
with (this) {
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetJake = function () {
with (this) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
}
};
ObjPers.prototype.AttackJake = function () {
with (this) {
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == Math.round(_parent.Pers.Obj.Etat._totalframes / 2)) {
bHitAttack = true;
} else {
bHitAttack = false;
}
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.GetHitJake = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireJake = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformJake = function () {
with (this) {
DistYFall = 0;
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 1;
Etat = "Idle";
nDragonPowerCount = 0;
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.PushJake = function () {
with (this) {
CheckHitGrd();
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (!KeyListener.Action) {
Etat = "Idle";
} else if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (PushedBox != 0) {
MoveX = PushedBox.MoveX;
} else {
MoveX = 0;
}
} else {
var AddBlock = (35 * NumDir);
var i = 0;
while (i != AddBlock) {
if (_parent.Collider.Wall.hitTest(PushPointX + i, PushPointY, true)) {
goToTarget = true;
if (((i > 5) && (NumDir == 1)) || ((i < -5) && (NumDir == -1))) {
MoveX = 5 * NumDir;
} else {
MoveX = i;
}
break;
}
i = i + NumDir;
}
}
MovePers();
}
};
ObjPers.prototype.TransformFallJake = ObjPers.prototype.TransformJake;
ObjPers.prototype.DieJake = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
if (FrDeadCount == 0) {
_global.lives--;
_global.Snd.stopSound("lift");
_global.Snd.stopSound("push");
if (_global.lives == 0) {
_global.Packaging.showLoseScreen();
} else {
_global.HUD.fade(resetLevel);
}
}
FrDeadCount++;
}
}
};
ObjPers.prototype.SleepJake = function () {
};
ObjPers.prototype.IdleDragon = function () {
with (this) {
bCanAttack = true;
KeepDeadPos = true;
if (Life > 0) {
SetSpdDragon();
SetMoveX();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdDragon();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusDragon = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.FlyDragon = function () {
with (this) {
bCanAttack = true;
SetSpdDragon();
SetMoveX();
SetMoveY();
CheckDragonObstacle();
CheckWall(FrontX, FrontY);
CheckCeilDragon();
CheckSolDragon();
CheckGroundDragon();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartDragon = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
this["CheckAttack" + Perso]();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingDragon = function () {
with (this) {
CheckGetFire();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe >= this.nFrTotalAnim) {
if (Life <= 0) {
Etat = "Die";
} else {
Etat = "Idle";
}
}
}
};
ObjPers.prototype.HurtDragon = function () {
with (this) {
MovePers();
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
Etat = "Idle";
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetDragon = ObjPers.prototype.HurtDragon;
ObjPers.prototype.AttackTailDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrAttackTailHit) {
bHitAttack = true;
} else {
bHitAttack = false;
}
}
};
ObjPers.prototype.AttackFireDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrShootFire) {
if (Dir == "D") {
CreerFireBall(PosX + 70, PosY - 70, Dir);
} else {
CreerFireBall(PosX - 70, PosY - 70, Dir);
}
}
}
};
ObjPers.prototype.GetHitDragon = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireDragon = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 0;
Etat = "Fall";
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.DieDragon = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
FrDeadCount++;
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.SleepDragon = function () {
};
CreerPers = function (PosX, PosY, Perso) {
this.Pers = new ObjPers(PosX, PosY, Perso);
};
ObjPers.prototype.CharacterSwitch = function () {
with (this) {
if (Etat == "Fall") {
Etat = "TransformFall";
} else {
Etat = "Transform";
}
}
};
ObjPers.prototype.HeroChange = function (NewHero) {
with (this) {
Perso = NewHero;
updatePerso();
}
};
ObjPers.prototype.GetHitGeneral = function () {
with (this) {
SetSpdXHit();
CheckWall(BackX, TrueY);
CheckHitGrd();
CheckSol();
MovePers();
CheckDie();
}
};
ObjPers.prototype.CheckGetFire = function () {
with (this) {
var NbMinionBall = G_TabMinionBall.length;
if ((NbMinionBall > 0) && (Perso != "TuesdayDisguised")) {
var i = 0;
while (i < NbMinionBall) {
var BallX = _parent.Control[G_TabMinionBall[i]].PosX;
var BallY = _parent.Control[G_TabMinionBall[i]].PosY;
if (((((BallX >= (PosX - GetFireG)) and (BallX <= (PosX + GetFireD))) and (BallY >= (PosY - GetFireUp))) and (BallY <= (PosY + GetFireDw))) && (!Invincible)) {
Etat = "GetFire";
if (_parent.Control[G_TabMinionBall[i]].Dir == "D") {
Dir = "G";
} else if (_parent.Control[G_TabMinionBall[i]].Dir == "G") {
Dir = "D";
}
_parent.Control[G_TabMinionBall[i]].Etat = "Hit";
}
i++;
}
}
}
};
ObjPers.prototype.InvincibleInit = function () {
with (this) {
Invincible = true;
}
};
ObjPers.prototype.InvincibleEnd = function () {
with (this) {
Invincible = false;
FrInvincibleCount = 0;
_parent.Pers._visible = true;
}
};
ObjPers.prototype.InvincibleCheck = function () {
with (this) {
if (Invincible) {
if (FrInvincibleCount >= FrInvincible) {
InvincibleEnd();
CanBeHit = true;
} else {
FrInvincibleCount++;
if ((FrInvincibleCount % 3) == 0) {
_parent.Pers._visible = !_parent.Pers._visible;
}
}
}
}
};
ObjPers.prototype.SetSpdXHit = function () {
with (this) {
MoveX = SpdXNow;
if (SpdXNow > 0) {
SpdXNow = SpdXNow * 0.7;
}
if (Dir eq "D") {
MoveX = MoveX * -1;
}
}
};
ObjPers.prototype.SetSpdXJake = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX - WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase * -1;
}
} else {
Etat = "Idle";
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdDragon = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (KeyListener.Dw == true) {
SpdYNow = SpdYFly;
} else if (KeyListener.Up == true) {
SpdYNow = SpdYFly * -1;
} else {
SpdYNow = 0;
}
if ((SpdXNow == 0) && (SpdYNow == 0)) {
Etat = "Idle";
} else {
Etat = "Fly";
}
}
};
ObjPers.prototype.SetSpdXJump = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(TrueX + WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(TrueX - WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdXJumpKick = function () {
with (this) {
if (Dir == "G") {
if (SpdXNow < -5) {
SpdXNow = SpdXNow + 2;
} else {
SpdXNow = -5;
}
} else if (Dir == "D") {
if (SpdXNow > 5) {
SpdXNow = SpdXNow - 2;
} else {
SpdXNow = 5;
}
}
}
};
ObjPers.prototype.SetMoveX = function () {
with (this) {
MoveX = SpdXNow;
}
};
ObjPers.prototype.SetMoveY = function () {
with (this) {
MoveY = SpdYNow;
}
};
ObjPers.prototype.CheckWall = function (CoordX, CoordY) {
with (this) {
if (MoveX != 0) {
if (MoveX > 0) {
var WallStop = WallHitBloc;
} else {
var WallStop = (-1 * WallHitBloc);
}
var WallHit1 = (MoveX / 3);
var WallHit2 = (WallHit1 * 2);
var WallHit3 = (WallHit1 * 4);
if (_parent.Collider.Wall.hitTest(CoordX + WallStop, CoordY, true)) {
MoveX = 0;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit1, CoordY, true)) {
MoveX = WallHitBloc;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit2, CoordY, true)) {
MoveX = WallHit1;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit3, CoordY, true)) {
MoveX = WallHit2;
} else if (_parent.Collider.Wall.hitTest(CoordX + MoveX, CoordY, true)) {
MoveX = WallHit2;
}
}
}
};
ObjPers.prototype.CheckDragonObstacle = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Dragon.hitTest(TopX, TopY + MoveY, true)) {
MoveY = DragonHitTop;
} else if (_parent.Collider.Dragon.hitTest(BottomFrontX, (TopY + MoveY) + DragonHeight, true) or _parent.Collider.Dragon.hitTest(BottomBackX, (TopY + MoveY) + DragonHeight, true)) {
MoveY = DragonHitBottom;
}
}
}
};
ObjPers.prototype.CheckCeil = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
Etat = "Fall";
DistYFall = 0;
}
}
}
};
ObjPers.prototype.CheckSolDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Sol.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckCeilDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
}
}
}
};
ObjPers.prototype.CheckGroundDragon = function () {
with (this) {
if (MoveY > 0) {
if (_parent.Collider.Sol.hitTest(BottomFrontX, TrueY - _parent.Pers.Obj.HitBottomFront._y, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckJump = function () {
with (this) {
if (Etat != "Push") {
if ((!KeyListener.Up) && (!bJumpRelease)) {
bJumpRelease = true;
}
if (((KeyListener.Up == true) && (HitGrd == true)) && (bJumpRelease)) {
bJumpRelease = false;
if (Etat == "Run") {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
} else {
Etat = "JumpStart";
}
}
}
}
};
ObjPers.prototype.CheckPush = function () {
with (this) {
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (KeyListener.Action && (((Dir == "G") && (KeyListener.L)) || ((Dir == "D") && (KeyListener.R)))) {
Etat = "Push";
}
}
}
};
ObjPers.prototype.CheckAttackJake = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "Attack";
}
}
};
ObjPers.prototype.CheckAttackDragon = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackTail";
}
if ((KeyListener.Action == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackFire";
}
}
};
ObjPers.prototype.CheckFall = function () {
with (this) {
if (SpdYNow >= SpdYFall) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.CheckDie = function () {
with (this) {
if (_global.energy <= 0) {
_global.dragonPower = 0;
Etat = "Fall";
}
}
};
ObjPers.prototype.MovePers = function () {
with (this) {
if ((Pers.TrueX + MoveX) < 30) {
MoveX = (TrueX * -1) + 30;
} else if ((Pers.TrueX + MoveX) > 520) {
MoveX = 520 - Pers.TrueX;
}
PosX = _parent.Pers._x + MoveX;
_parent.Pers._x = PosX;
MoveX = 0;
PosY = _parent.Pers._y + MoveY;
_parent.Pers._y = PosY;
MoveY = 0;
}
};
ObjPers.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
TopX = TrueX;
TopY = TrueY + _parent.Pers.Obj.HitTop._y;
FrontX = _parent.Pers.Obj.HitFront._x;
FrontY = TrueY + _parent.Pers.Obj.HitFront._y;
BottomFrontX = _parent.Pers.Obj.HitBottomFront._x;
BottomBackX = _parent.Pers.Obj.HitBottomBack._x;
BackX = _parent.Pers.Obj.HitBack._x;
if (Dir == "G") {
FrontX = TrueX - FrontX;
BottomFrontX = TrueX - BottomFrontX;
BottomBackX = TrueX - BottomBackX;
BackX = TrueX - BackX;
} else if (Dir == "D") {
FrontX = TrueX + FrontX;
BottomFrontX = TrueX + BottomFrontX;
BottomBackX = TrueX + BottomBackX;
BackX = TrueX + BackX;
}
}
};
ObjPers.prototype.CheckHitGrd = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = TrueX;
CheckY = TrueY;
aCheckPoints = [CheckX, BottomFrontX, BottomBackX];
} else {
aCheckPoints = [CheckX];
}
for (var i in aCheckPoints) {
if (_parent.Collider.Sol.hitTest(aCheckPoints[i], CheckY + MaxSol, true) and (SpdYNow >= 0)) {
HitGrd = true;
HitGrdPoint = aCheckPoints[i];
if ((onBouncingID != null) && (_global.Game[onBouncingID].CheckPersOn() != true)) {
Pers.SpdYUp = Pers.SpdYUpBase;
}
break;
}
HitGrd = false;
HitGrdPoint = TrueX;
}
}
};
ObjPers.prototype.CheckSol = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = HitGrdPoint;
CheckY = TrueY;
}
if (_parent.Collider.Sol.hitTest(CheckX, CheckY, true) and (SpdYNow >= 0)) {
SpdYNow = 0;
var InSol = true;
while (InSol == true) {
MoveY = MoveY - SolOut;
InSol = _parent.Collider.Sol.hitTest(CheckX, CheckY + MoveY, true);
}
} else if (SpdYNow >= 0) {
if (HitGrd == true) {
SpdYNow = 0;
MoveY = SpdYNow;
} else {
SpdYNow = SpdYNow + SpdYUp;
if (Etat == "JumpKick") {
SpdYNow = SpdYNow + 1;
}
if (SpdYNow > SpdYMax) {
SpdYNow = SpdYMax;
}
var SolHit1 = (SpdYNow / 3);
var SolHit2 = (SolHit1 * 2);
if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit1, true)) {
MoveY = SolHitMin;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit2, true)) {
MoveY = SolHit1;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SpdYNow, true)) {
MoveY = SolHit2;
} else {
MoveY = SpdYNow;
}
}
} else {
SpdYNow = SpdYNow + SpdYUp;
MoveY = SpdYNow;
}
if (MoveY > 0) {
DistYFall = DistYFall + MoveY;
}
}
};
ObjPers.prototype.setState = function (l_sNewState) {
with (this) {
EtatOld = Etat;
Etat = l_sNewState;
var nOldTransformFr = _parent.Pers.Obj.Transform._currentframe;
_parent.Pers.Obj.gotoAndStop(l_sNewState);
_parent.Pers.Obj.Etat.gotoAndPlay(1);
this.nFrTotalAnim = _parent.Pers.Obj.Etat._totalframes;
_parent.Pers.Obj.Transform.gotoAndStop(1);
if ((Etat == "Die") && (bSkipDie)) {
_parent.Pers.Obj.Etat.gotoAndPlay(9);
}
if ((nOldTransformFr < 15) && (nOldTransformFr > 5)) {
_parent.Pers.Obj.Transform.gotoAndPlay(nOldTransformFr);
}
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
}
};
ObjPers.prototype.updatePerso = function () {
var nCurrentFrame;
with (this) {
nCurrentFrame = _parent.Pers.Obj.Etat._currentframe;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
_parent.Pers.Obj.Etat.gotoAndPlay(nCurrentFrame);
nGetHitLeft = -1 * _parent.Pers.Obj.HitBack._x;
nGetHitRight = _parent.Pers.Obj.HitFront._x;
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
ComboKick = 0;
mcHitGetHurt = _parent.Pers.Obj.HitGetHurt;
}
};
ObjPers.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
}
};
ObjPers.prototype.Actions = function () {
with (this) {
if (WaitForActions) {
SetTruePos();
CheckHitGrd();
CheckSol();
CheckFall();
WaitForActions = false;
} else if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Pers.Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Pers.Obj.Etat.play();
}
SetTruePos();
InvincibleCheck();
this[Etat + aCharacter[ICharacter]]();
CheckCharSwitch();
CheckHit();
CheckEndLevel();
}
}
};
ObjPers.prototype.CheckCharSwitch = function () {
with (this) {
if (ICharacter == 1) {
if ((KeyListener.Dragon || (_global.dragonPower == 0)) && (Etat != "HurtNet")) {
CharacterSwitch();
} else if ((++nDragonPowerCount) == nDragonPowerRythm) {
_global.dragonPower--;
nDragonPowerCount = 0;
if (_global.dragonPower < 0) {
_global.dragonPower = 0;
}
}
} else {
if (((KeyListener.Dragon || (autoSwitchDragon)) && (bCanSwitch)) && (_global.dragonPower > 0)) {
autoSwitchDragon = false;
bCanSwitch = false;
FrSwitchCharacterCount = FrSwitchCharacter;
CharacterSwitch();
}
if (!bCanSwitch) {
FrSwitchCharacterCount--;
if (FrSwitchCharacterCount == 0) {
bCanSwitch = true;
}
}
}
}
};
ObjPers.prototype.CheckEndLevel = function () {
with (this) {
if (!_global.boss) {
if (((_global.level == 1) && (PosY <= -3930)) && (PosX >= 390)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if ((_global.level == 2) && (PosY <= -4670)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if (((_global.level == 3) && (PosY <= -5800)) && (PosX <= 105)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
}
}
};
ObjPers.prototype.CheckHit = function () {
with (this) {
if (KeyListener.X && (CanBeHit)) {
this.GetHit();
}
}
};
CreerNetBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("NetBall", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Net", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerFireBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("JackDragon_FireAnim", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Fire", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerSparkBall = function (PosX, PosY, Dir, Rotation, SpdX, SpdY) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("Medusa_Blast", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Spark", _local4, PosX, PosY, Dir, 8, 0, G_TabPersBall, "SlimeSplat", Rotation, SpdX, SpdY);
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
ObjPersBall.prototype.Move = function () {
with (this) {
_parent.Bg[1][Nom]._x = PosX + SpdX;
PosX = PosX + SpdX;
if (SpdY) {
_parent.Bg[1][Nom]._y = PosY + SpdY;
PosY = PosY + SpdY;
}
SetTruePos();
CheckHit();
CheckOut();
}
};
ObjPersBall.prototype.Hit = function () {
with (this) {
if ((Type == "Net") && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
Pers.Etat = "HurtNet";
_global.Snd.playSound("hurtNet", 100, 1, false);
CanBeKill = true;
}
}
};
ObjPersBall.prototype.End = function () {
with (this) {
if (((Type == "Fire") || (Type == "Spark")) && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.Burn = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckHit = function () {
with (this) {
if (Type == "Net") {
if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Burn";
_global.Game[Pers.CurrentFireID].Etat = "End";
} else if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.Hit))) {
Etat = "Hit";
}
}
if (((Type == "Spark") && (Pers.Etat != "Activate")) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.HitFront))) {
Pers.Etat = "Hurt";
Etat = "End";
}
if (((Type == "Spark") && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1].FinalHit))) && (G_Medusa.Etat != "Die")) {
_global.HUD.increaseScore(10000);
_parent.Control.Bg.CamOnMedusa = true;
G_Medusa.Etat = "Die";
}
}
};
ObjPersBall.prototype.CheckOut = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckKill = function () {
with (this) {
if (CanBeKill == true) {
KillBall();
}
}
};
ObjPersBall.prototype.KillBall = function () {
with (this) {
if (Tab == G_TabPersBall) {
G_TabPersBall.splice(PersBallI, 1);
PersBallI = PersBallI - 1;
} else if (Tab == G_TabMinionBall) {
G_TabMinionBall.splice(MinionBallI, 1);
MinionBallI = MinionBallI - 1;
}
delete _parent.Control[Nom];
_parent.Bg[1][Nom].removeMovieClip();
if (Type == "Fire") {
Pers.CurrentFireID = null;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = null;
}
}
};
ObjPersBall.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjPersBall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
};
ObjPersBall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Etat.play();
}
this[Etat]();
CheckKill();
}
}
};
CreerSwitch = function (Nom, PosX, PosY) {
if (this[Nom] == null) {
this[Nom] = new ObjSwitch(Nom, PosX, PosY);
G_TabSwitch.push(Nom);
}
};
ObjSwitch.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjSwitch.prototype.Idle = function () {
with (this) {
CheckPersOn();
CheckBoxOn();
CheckSleep();
}
};
ObjSwitch.prototype.Baisse = function () {
with (this) {
if (_parent[Nom].Etat._currentframe >= FrBaisse) {
_global.SoundCTRL.playSound("SwitchOn", 100, 0);
_parent[Nom].Activate();
Etat = "Active";
}
}
};
ObjSwitch.prototype.Active = function () {
with (this) {
CheckSleep();
if (!FlagBoxUse) {
CheckRelease();
}
}
};
ObjSwitch.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
FlagUse = true;
Etat = "Baisse";
}
}
};
ObjSwitch.prototype.CheckBoxOn = function () {
with (this) {
var Box = Pers.PushedBox;
if ((Pers.Etat == "Push") && (Box != 0)) {
if (Box.Dir == "G") {
if (((((Box.PosX - Box.LgHitG) >= (PosX - LgOnX)) and ((Box.PosX - Box.LgHitG) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Etat = "Baisse";
Activate();
}
} else if (Box.Dir == "D") {
if (((((Box.PosX + Box.LgHitD) >= (PosX - LgOnX)) and ((Box.PosX + Box.LgHitD) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
} else if ((Box.Etat == "LandFin") && (Box != 0)) {
if ((((Box.PosX >= (PosX - LgOnX)) and (Box.PosX <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
Box.Dir = "";
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
}
};
ObjSwitch.prototype.CheckRelease = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
} else {
Etat = "Idle";
FlagUse = false;
_parent[Nom].Desactivate();
_global.SoundCTRL.playSound("SwitchOff", 100, 0);
}
}
};
ObjSwitch.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjSwitch.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjSwitch.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjSwitch.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerElevator = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjElevator(l_mcElement, "Y", 0, -1 * l_mcElement.distance);
G_TabElevator.push(l_mcElement._name);
}
};
this.onSwitchLift = function (l_Nom) {
with (this) {
if (_global.Game[l_Nom + "Lift"].Active == true) {
_global.Game[l_Nom + "Lift"].Active = false;
_global.Game[l_Nom].Etat = "Idle";
_global.Snd.stopSound("lift");
} else {
_global.Game[l_Nom + "Lift"].Active = true;
_global.Game[l_Nom].Etat = "IdleActivate";
_global.Snd.playSound("lift", 100, 999, true);
}
}
};
ObjElevator.prototype.Sleep = function () {
with (this) {
CheckActif();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Idle = function () {
with (this) {
CheckSleep();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Wait = function () {
with (this) {
if (frWaitCount >= frWaitTime) {
Etat = "Idle";
frWaitCount = 0;
} else {
frWaitCount++;
}
}
};
ObjElevator.prototype.SetMove = function () {
with (this) {
CheckPersOn();
CheckLimit();
MoveElevator();
}
};
ObjElevator.prototype.MoveElevator = function () {
with (this) {
this["Pos" + Axis] = this["Pos" + Axis] + this["Move" + Axis];
_parent[Nom]._x = PosX;
_parent[Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY;
if (PersOn) {
Pers["Move" + Axis] = this["Move" + Axis];
Pers.MovePers();
}
UpdateLift();
}
};
ObjElevator.prototype.UpdateLift = function () {
with (this) {
var cableH = (this["Pos" + Axis] - Max);
mc.Obj.cable1._height = cableH;
mc.Obj.cable2._height = cableH;
mc._y = mc._y + this["Move" + Axis];
mc._parent[Nom.substr(0, -4)]._y = mc._parent[Nom.substr(0, -4)]._y + this["Move" + Axis];
_global.Game[Nom.substr(0, -4)].PosY = _global.Game[Nom.substr(0, -4)].PosY + this["Move" + Axis];
_global.Game._parent.overlay[Nom + "ramp"]._y = _global.Game._parent.overlay[Nom + "ramp"]._y + this["Move" + Axis];
_global.Game._parent.Bg[1][Nom + "ramp"]._y = _global.Game._parent.Bg[1][Nom + "ramp"]._y + this["Move" + Axis];
}
};
ObjElevator.prototype.CheckLimit = function () {
with (this) {
this["Move" + Axis] = Speed * Dir;
if ((Dir == -1) && ((this["Pos" + Axis] + this["Move" + Axis]) <= Max)) {
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = false;
CanReposition = true;
RepositionCount = 0;
Dir = 0;
}
if ((Dir == 1) && ((this["Pos" + Axis] + this["Move" + Axis]) >= Min)) {
CanReposition = false;
Dir = -1;
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = true;
_global.Game[Nom.substr(0, -4)].Etat = "Idle";
}
}
};
ObjElevator.prototype.CheckReposition = function () {
with (this) {
if (CanReposition) {
CheckPersOn();
if (!PersOn) {
if ((++RepositionCount) == RepositionDelay) {
RepositionCount = 0;
CanReposition = false;
Active = true;
Dir = 1;
_global.Snd.playSound("lift", 100, 999, true);
}
}
}
}
};
ObjElevator.prototype.Activate = function () {
with (this) {
Active = true;
}
};
ObjElevator.prototype.Desactivate = function () {
with (this) {
Active = false;
}
};
ObjElevator.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
PersOn = true;
} else {
PersOn = false;
}
}
};
ObjElevator.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
Etat = "Idle";
if (Active) {
CheckLimit();
MoveElevator();
}
}
}
};
ObjElevator.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjElevator.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjElevator.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLevier = function (Nom, PosX, PosY, listener) {
if (this[Nom] == null) {
this[Nom] = new ObjLevier(Nom, PosX, PosY, listener);
G_TabLevier.push(Nom);
}
};
ObjLevier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjLevier.prototype.Idle = function () {
with (this) {
if (Active) {
CheckPersOn();
CheckSleep();
}
}
};
ObjLevier.prototype.IdleActivate = ObjLevier.prototype.Idle;
ObjLevier.prototype.Activate = function () {
with (this) {
if (Pers.ICharacter == 0) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.Etat == "Activate")) && (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes)) {
listener(Nom);
}
}
}
};
ObjLevier.prototype.CheckPersOn = function () {
with (this) {
if ((Pers.ICharacter == 0) && (Pers.Etat != "Push")) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.HitGrd == true)) && (Pers.CanBeHit || (Pers.Invincible))) {
if (KeyListener.Action) {
Pers.canJumpCount = 0;
Etat = "Activate";
Pers.Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
}
}
} else if (((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
} else if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
};
ObjLevier.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjLevier.prototype.CheckSleep = function () {
};
ObjLevier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjLevier.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLadder = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjLadder(l_mcElement);
G_TabLadder.push(l_mcElement._name);
}
};
this.onSwitchLadder = function (l_Nom) {
with (this) {
_global.Game[l_Nom + "Ladder"].Etat = "Opening";
}
};
ObjLadder.prototype.Off = function () {
with (this) {
}
};
ObjLadder.prototype.Opening = function () {
with (this) {
if (mc.etat._currentframe == mc.etat._totalframes) {
Etat = "On";
}
}
};
ObjLadder.prototype.On = function () {
with (this) {
CheckPersOn();
}
};
ObjLadder.prototype.CheckPersOn = function () {
with (this) {
if (Pers.ladderDisabledCount >= Pers.ladderDisabledMax) {
if (((((Pers.PosX >= PosX) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= PosY)) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
if (((Pers.ICharacter == 0) && (Pers.Etat != "Climbing")) && (Pers.Etat != "Hurt")) {
if ((KeyListener.Up && (Pers.PosY >= (PosY + 70))) || (KeyListener.Dw && (Pers.PosY <= (PosY + 165)))) {
Pers.onLadderID = Nom;
Pers.Etat = "Climbing";
Pers.ClimbedDistance = 0;
}
}
} else if ((Pers.Etat == "Climbing") && (Pers.onLadderID == Nom)) {
if (Pers.PosX < PosX) {
Pers.ChangeDir("G");
}
if (Pers.PosX > (PosX + LgOnX)) {
Pers.ChangeDir("D");
}
Pers.Etat = "Fall";
Pers.onLadderID = null;
}
} else {
Pers.ladderDisabledCount++;
}
}
};
ObjLadder.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjLadder.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerBouncingChair = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBouncingChair(l_mcElement);
G_TabChair.push(l_mcElement._name);
}
};
ObjBouncingChair.prototype.Idle = function () {
with (this) {
if (CheckPersOn()) {
Etat = "Bounce";
if ((Pers.onBouncingID == Nom) && (Pers.HitGrd)) {
Pers.onBouncingID = null;
}
}
}
};
ObjBouncingChair.prototype.Bounce = function () {
with (this) {
if (mc.Etat._currentframe == 9) {
BouncePers();
}
if (mc.Etat._currentframe == mc.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjBouncingChair.prototype.CheckPersOn = function () {
with (this) {
if ((((((((Pers.ICharacter == 0) && (Pers.Etat != "Idle")) && (Pers.Etat != "Run")) and (Pers.PosX >= PosX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
return(true);
}
}
};
ObjBouncingChair.prototype.BouncePers = function () {
with (this) {
if (CheckPersOn()) {
Pers.SpdYUp = Pers.SpdYUpBase;
if (Pers.onBouncingID != Nom) {
Pers.onBouncingID = Nom;
Pers.bounceCount = 0;
} else {
Pers.bounceCount++;
if (Pers.bounceCount > 0) {
Pers.bounceCount = Pers.bounceCountMax;
}
Pers.SpdYUp = Pers.SpdYUp - (Pers.bounceCount * 0.34);
}
Pers.Etat = "JumpStart";
} else if (Pers.HitGrd) {
Pers.onBouncingID = null;
}
}
};
ObjBouncingChair.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjBouncingChair.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerHuntSoldier = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntSoldier";
this[l_mcElement._name] = new ObjHuntSoldier(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntSoldier.push(l_mcElement._name);
}
};
ObjHuntSoldier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntSoldier.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckShield();
CheckDir();
CheckHurt();
CheckSleep();
}
};
ObjHuntSoldier.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Stunned = ObjHuntSoldier.prototype.Hurt;
ObjHuntSoldier.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack1 = function () {
with (this) {
if (((Pers.Etat != "Hurt") && (_parent.Bg[1][Nom].Obj.Etat._currentframe >= 9)) && (_parent.Bg[1][Nom].Obj.Etat._currentframe <= 25)) {
if (_parent.Bg[1][Nom].Obj.Etat.wave.hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack2 = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 7) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
_global.Snd.playSound("hurtJake", 100, 1, false);
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjHuntSoldier.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if ((Etat != "Shield") && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
if ((++HurtCount) == 3) {
enemyHitScore();
Etat = "Stunned";
HurtCount = 0;
} else {
Etat = "Hurt";
}
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
}
};
ObjHuntSoldier.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjHuntSoldier.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Math.abs(Pers.PosY - PosY) < 180) && (Math.random() < AttackChance)) {
if (Math.abs(Pers.PosX - PosX) < 150) {
Etat = "Attack2";
} else {
Etat = "Attack1";
}
AttackDelayCount = 0;
}
}
};
ObjHuntSoldier.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntSoldier.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjHuntSoldier.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntSoldier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjHuntSoldier.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerHuntWindow = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntWindow";
this[l_mcElement._name] = new ObjHuntWindow(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntWindow.push(l_mcElement._name);
}
};
ObjHuntWindow.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntWindow.prototype.IdleClose = function () {
with (this) {
CheckCanOpen();
CheckSleep();
}
};
ObjHuntWindow.prototype.IdleOpen = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt._currentframe == 1) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.gotoAndStop(HuntID);
SetHuntEtat("Appear");
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
}
if ((HuntEtat == "Appear") && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
SetHuntEtat("idle");
}
if (HuntEtat == "idle") {
CheckFlip();
CheckAttack();
}
if (((HuntEtat == "disappear") || (HuntEtat == "flee")) && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat.stop();
Etat = "Close";
if (HuntEtat == "flee") {
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = -80;
}
}
if (HuntEtat == "Throw") {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes) {
SetHuntEtat("idle");
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == FrThrow) {
var l_dir = "G";
if (HuntID == "A") {
l_dir = "D";
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
if (l_dir == "D") {
l_dir = "G";
} else {
l_dir = "D";
}
}
var l_netY = 70;
if (PosY < Pers.TrueY) {
l_netY = l_netY + (Math.abs(Pers.PosY - TrueY) - 150);
} else {
l_netY = l_netY - Math.abs(Pers.PosY - TrueY);
}
if (l_netY > 120) {
l_netY = 120;
}
if (l_netY < 20) {
l_netY = 20;
}
CreerNetBall(PosX, PosY + l_netY, l_dir);
_global.Snd.playSound("net", 130, 1, false);
}
}
CheckCanClose();
CheckHurt();
CheckSleep();
}
};
ObjHuntWindow.prototype.Open = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleOpen";
AttackDelayCount = AttackDelay * 0.9;
}
}
};
ObjHuntWindow.prototype.Close = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleClose";
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
}
};
ObjHuntWindow.prototype.CheckCanOpen = function () {
with (this) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == null) {
if (_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] >= _global.Game.G_WindowOpenDelay) {
if ((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown))) {
if (((Pers.ICharacter == 0) && (Math.random() <= OpenChanceJake)) || ((Pers.ICharacter == 1) && (Math.random() <= OpenChanceDragon))) {
Etat = "Open";
_global.Game["G_HuntWindowCurrent" + HuntID] = Nom;
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = 0;
}
}
}
}
}
};
ObjHuntWindow.prototype.CheckCanClose = function () {
with (this) {
if (CloseDelayCount < CloseDelay) {
CloseDelayCount++;
} else if ((HuntEtat != "disappear") && ((!((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown)))) || ((Pers.ICharacter == 0) && (Math.random() <= CloseChance)))) {
if (Math.random() <= OpenChance) {
SetHuntEtat("disappear");
CloseDelayCount = 0;
}
}
}
};
ObjHuntWindow.prototype.CheckFlip = function () {
with (this) {
if (FlipDelayCount < FlipDelay) {
FlipDelayCount++;
} else {
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
FlipDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Pers.ICharacter == 1) && (Math.abs(Pers.PosY - PosY) < 300)) {
SetHuntEtat("Throw");
AttackDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckHurt = function () {
with (this) {
if ((((HuntEtat == "idle") || (HuntEtat == "Throw")) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].Obj.hitTest(_parent.Pers.Obj.HitFront))) {
SetHuntEtat("flee");
enemyHitScore();
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
};
ObjHuntWindow.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "IdleClose";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntWindow.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == Nom) {
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
Etat = "Sleep";
}
}
};
ObjHuntWindow.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntWindow.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.window.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.overlay.gotoAndStop(G_CurrentLevel);
}
};
ObjHuntWindow.prototype.SetHuntEtat = function (newEtat) {
with (this) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.gotoAndStop(newEtat);
HuntEtat = newEtat;
}
};
ObjHuntWindow.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusa = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "Medusa";
this[l_mcElement._name] = new ObjMedusa(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusa.push(l_mcElement._name);
}
};
ObjMedusa.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckDir();
CheckHurt();
}
};
ObjMedusa.prototype.Captured = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showNextScreen();
}
}
};
ObjMedusa.prototype.Die = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showWinScreen();
}
}
};
ObjMedusa.prototype.Laugh = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Attack = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe < FrPrepareAttack) {
CheckDir();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrPrepareAttack) {
if (Pers.ICharacter == 0) {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 1.5));
} else {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 3));
}
NextAttackRotation = Math.round(pointsGetAngle(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY));
var l_dst = pointsGetDistance(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY);
var l_step = (l_dst / 20);
NextAttackRotationSpdX = (Pers.TrueX - G_Medusa.TrueX) / l_step;
NextAttackRotationSpdY = (l_PersY - G_Medusa.TrueY) / l_step;
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrAttack) {
var l_PosX = PosX;
CreerSparkBall(PosX, PosY - 95, Dir, NextAttackRotation, NextAttackRotationSpdX, NextAttackRotationSpdY);
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
HasAttacked = true;
Etat = "Idle";
}
CheckHurt();
}
};
ObjMedusa.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjMedusa.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Laugh";
}
}
}
};
ObjMedusa.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjMedusa.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if (Math.random() < AttackChance) {
Etat = "Attack";
HasAttacked = false;
AttackDelayCount = 0;
}
}
};
ObjMedusa.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjMedusa.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjMedusa.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjMedusa.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusaSister = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "MedusaSister";
this[l_mcElement._name] = new ObjMedusaSister(l_mcElement, Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusaSister.push(l_mcElement._name);
}
};
ObjMedusaSister.prototype.UpdateSister = function (SisterID) {
with (this) {
if (CurrentSister == SisterID) {
mc[SisterID].gotoAndStop(CurrentAction);
} else {
mc[SisterID].gotoAndStop("Idle");
}
}
};
ObjMedusaSister.prototype.UpdatePosition = function () {
with (this) {
var l_maxOffset = 70;
var l_posX = Math.abs(_parent.Control.Bg.PosX);
mc._x = -((l_posX / 450) * l_maxOffset);
mc._y = mc._y + (_global.MoveY / 2.5);
if (mc._y < 145) {
mc._y = 145;
}
}
};
ObjMedusaSister.prototype.UpdateAttack = function () {
with (this) {
if ((CurrentAction == "Idle") && (!MedusaAttack)) {
if ((++AttackDelayCount) == AttackDelay) {
if (CurrentSister == "SisterLeft") {
CurrentSister = "SisterRight";
} else {
CurrentSister = "SisterLeft";
}
CurrentAction = "Charge";
AttackDelayCount = 0;
}
} else if (CurrentAction == "Charge") {
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
var PersY = Math.abs(_global.Game.Pers.PosY);
switch (true) {
case PersY < 100 :
CurrentAction = "Attack3";
break;
case PersY < 250 :
CurrentAction = "Attack2";
break;
case PersY >= 250 :
CurrentAction = "Attack1";
}
}
} else if (((CurrentAction == "Attack1") || (CurrentAction == "Attack2")) || (CurrentAction == "Attack3")) {
if (mc[CurrentSister].Etat._currentframe == 9) {
if ((Pers.Etat != "Activate") && (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Pers))) {
Pers.Etat = "Hurt";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna1)) {
_global.Game.Antenna1.Etat = "Charged";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna2)) {
_global.Game.Antenna2.Etat = "Charged";
}
}
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
CurrentAction = "Idle";
if (CurrentSister == "SisterRight") {
MedusaAttack = true;
G_Medusa.HasAttacked = false;
}
}
}
if (!MedusaAttack) {
G_Medusa.AttackDelayCount = 0;
} else if (G_Medusa.HasAttacked) {
MedusaAttack = false;
}
}
};
ObjMedusaSister.prototype.Actions = function () {
with (this) {
UpdatePosition();
UpdateAttack();
UpdateSister("SisterLeft");
UpdateSister("SisterRight");
}
};
CreerWall = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjWall(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabWall.push(l_mcElement._name);
}
};
ObjWall.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjWall.prototype.Idle = function () {
with (this) {
CheckHurt();
CheckSleep();
}
};
ObjWall.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrRemoveWallHit) {
_parent.Collider.Wall[Nom].removeMovieClip();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Out";
}
}
};
ObjWall.prototype.CheckHurt = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjWall.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjWall.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjWall.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjWall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.wall.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.wall.gotoAndStop(G_CurrentLevel);
}
};
ObjWall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerDragonObstacle = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjDragonObstacle(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabDragonObstacle.push(l_mcElement._name);
}
};
ObjDragonObstacle.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjDragonObstacle.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjDragonObstacle.prototype.Hit = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.HitBoss = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 4) {
_global.Game.Web.Etat = "Fall";
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.Fall = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == (_parent.Bg[1][Nom].Obj.Etat._totalframes - 1)) {
G_Medusa.Etat = "Captured";
}
}
};
ObjDragonObstacle.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_parent.Bg[1][Nom].Obj.Etat.stop();
}
}
};
ObjDragonObstacle.prototype.CheckHit = function () {
with (this) {
if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitTop) || (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitBottomFront)))) {
Pers.Etat = "Hurt";
Etat = "Hit";
Pers.InvincibleEnd();
Pers.MoveY = 40;
}
}
};
ObjDragonObstacle.prototype.CheckActif = function () {
with (this) {
if (_global.boss || (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep"))) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjDragonObstacle.prototype.CheckSleep = function () {
with (this) {
if (((((!_global.boss) && (PosX < (Bg.InvPosX - LgOutG))) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjDragonObstacle.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjDragonObstacle.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjDragonObstacle.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerAntenna = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjAntenna(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabAntenna.push(l_mcElement._name);
}
};
ObjAntenna.prototype.Idle = function () {
with (this) {
CheckHit();
}
};
ObjAntenna.prototype.Charged = function () {
with (this) {
CheckHit();
if ((++ChargedCount) == ChargedDelay) {
Etat = "Idle";
ChargedCount = 0;
}
}
};
ObjAntenna.prototype.CheckHit = function () {
with (this) {
if ((G_Medusa.CurrentSparkID != null) && (Pers.Etat != "Hurt")) {
if (_parent.Bg[1][Nom].Obj.Hit.hitTest(_parent.Bg[1][G_Medusa.CurrentSparkID])) {
Etat = "Charged";
ChargedCount = 0;
if ((_global.level == 1) && (_global.Game.Web.Etat != "Fall")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Web.Etat = "Fall";
_global.HUD.increaseScore(1000);
}
if ((((_global.level == 2) && (_global.Game.Antenna1.Etat == "Charged")) && (_global.Game.Antenna2.Etat == "Charged")) && (_global.Game.Wire.Etat != "HitBoss")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Wire.Etat = "HitBoss";
_global.HUD.increaseScore(2000);
}
}
}
}
};
ObjAntenna.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjAntenna.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if (Etat == "Charged") {
_global.Snd.playSound("antenna", 250, 1, false);
}
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjAntenna.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerBonus = function (type, l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBonus(type, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabBonus.push(l_mcElement._name);
}
};
ObjBonus.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjBonus.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBonus.prototype.CheckHit = function () {
with (this) {
if (((Pers.ICharacter == 0) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj))) || ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.Hit)))) {
switch (Type) {
case "Score" :
_global.Score = _global.Score + 500;
_global.Snd.playSound("energy", 200, 1, false);
_global.HUD.increaseScore(500);
break;
case "Life" :
if (_global.lives < 3) {
_global.lives++;
}
_global.Snd.playSound("life", 200, 1, false);
_global.HUD.increaseScore(200);
break;
case "Energy" :
_global.energy = _global.energy + 50;
if (_global.energy > 100) {
_global.energy = 100;
}
_global.Snd.playSound("bonus", 300, 1, false);
_global.HUD.increaseScore(200);
break;
case "Power" :
_global.dragonPower = 100;
_global.Snd.playSound("power", 300, 1, false);
_global.HUD.increaseScore(200);
}
KillBonus();
}
}
};
ObjBonus.prototype.KillBonus = function () {
with (this) {
G_TabBonus.splice(BonusI, 1);
BonusI = BonusI - 1;
delete _parent.Control[Nom];
_parent.Bg[1][Nom].swapDepths(90210);
_parent.Bg[1][Nom].removeMovieClip();
}
};
ObjBonus.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
Etat = "Idle";
}
}
};
ObjBonus.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjBonus.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjBonus.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
CheckKill();
}
}
};
this.cnt = 0;
this.G_CurrentLevel = _global.level;
switch (G_CurrentLevel) {
case 1 :
this.G_MaxEnemyHit = 28;
break;
case 2 :
this.G_MaxEnemyHit = 28;
break;
case 3 :
this.G_MaxEnemyHit = 38;
}
G_MaxEnemyHitCount = 0;
this.G_Pause = true;
this.G_PauseOut = false;
this.G_PRealese = true;
this.G_Resume = false;
this.G_TabBox = new Array();
this.G_TabSwitch = new Array();
this.G_TabDoor = new Array();
this.G_TabElevator = new Array();
this.G_TabPersBall = new Array();
this.G_TabLevier = new Array();
this.G_TabLadder = new Array();
this.G_TabChair = new Array();
this.G_TabHuntSoldier = new Array();
this.G_TabHuntWindow = new Array();
this.G_TabMedusa = new Array();
this.G_TabMedusaSister = new Array();
this.G_TabWall = new Array();
this.G_TabDragonObstacle = new Array();
this.G_TabAntenna = new Array();
this.G_TabBonus = new Array();
this.G_NextPersBall = 1;
this.G_NextPersBallDepth = 10000;
this.G_NextMinionBall = 1;
this.G_NextMinionBallDepth = 20000;
this.G_OverlayDepth = 0;
this.G_HuntWindowCurrentA = null;
this.G_HuntActiveSinceA = 0;
this.G_HuntWindowCurrentB = null;
this.G_HuntActiveSinceB = 0;
this.G_AlphaZones = new Array();
this.G_Medusa = null;
this.G_WindowOpenDelay = 20;
this.G_WindowAOpenDelayCount = 0;
this.G_WindowBOpenDelayCount = 0;
this.addAlphaZone = function (mc) {
if (_global.Packaging.bShadowDisabled) {
mc._visible = false;
}
};
this.resetLevel = function () {
_global.dragonPower = 100;
_global.energy = 100;
if (_global.boss) {
_global.resetDestination = "Game_BOSS" + _global.level;
} else {
_global.resetDestination = "Game_LEVEL" + _global.level;
}
_parent._parent.gotoAndStop("Reset");
};
this.bossStart = function () {
_global.boss = true;
_global.resetDestination = "Game_BOSS" + _global.level;
_parent._parent.gotoAndStop("Reset");
};
this.enemyHitScore = function () {
if ((++G_MaxEnemyHitCount) < G_MaxEnemyHit) {
_global.HUD.increaseScore(100);
}
};
this.Creer_PBalcony = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 235);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PRoofTop = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
var pt = new Object();
pt = {x:l_mcElement._x - 5, y:l_mcElement._y + 95};
var mcCeil = _parent.Collider.Ceil;
mcCeil.moveTo(pt.x, pt.y);
mcCeil.beginFill(16711935);
pt.x = pt.x + 115;
pt.y = pt.y - 70;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x + 115;
pt.y = pt.y + 70;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y - 80;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x - 230;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y + 80;
mcCeil.lineTo(pt.x, pt.y);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBalconyOpen = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + (l_mcElement._parent._y + 10);
CreerPlateforme(pt, 235);
if (l_mcElement.flipped) {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01OverlayFlip", {x:pt.x + 32, y:pt.y}, true);
CreerObstacle({x:pt.x + 19, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
} else {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01Overlay", {x:pt.x + 120, y:pt.y + 0.5}, true);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 195, y:pt.y}, 15, 15);
}
_parent.overlay[l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
_parent.Bg[1][l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBox = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 70);
CreerObstacle(pt, 70, 70);
}
};
this.CheckVisible = function () {
if ((this._y < (Bg.InvPosY - Stage.height)) or (this._y > (Bg.InvPosY + Stage.height))) {
this._visible = false;
} else {
this._visible = true;
}
};
this.CreerObstacle = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Wall;
var _local4 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local4.moveTo(pt.x, pt.y);
_local4.beginFill(16711935);
_local4.lineTo(pt.x, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y);
_local4.lineTo(pt.x, pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711680);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerObstacleDragon = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Dragon;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16776960);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerPlateforme = function (pt, l_nWidth) {
var _local3 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711935);
_local3.lineTo(pt.x, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerOverlay = function (id, linkage, pt, bReversed) {
var _local4;
var _local5;
_local5 = _parent.overlay.attachMovie(linkage, id, G_OverlayDepth++);
_local5._x = pt.x;
_local5._y = pt.y;
_local4 = _parent.Bg[1].attachMovie(linkage, id, G_OverlayDepth++);
_local4._x = pt.x;
_local4._y = pt.y;
_local4.overlay = _local5;
if (!bReversed) {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = false;
this.overlay._visible = true;
} else {
this._visible = true;
this.overlay._visible = false;
}
};
} else {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = true;
this.overlay._visible = false;
} else {
this._visible = false;
this.overlay._visible = true;
}
};
}
};
this.replaceTile = function (l_mcElement) {
var _local1 = l_mcElement._name;
var _local2 = 1499;
if (_local1.slice(0, 8) == "instance") {
} else {
l_mcElement._x = 0;
l_mcElement._y = -((Number(_local1) - 1) * _local2);
}
};
this.CreerFloor = function (l_nPosX, l_nPosY, l_nWidth, l_nHeight) {
var mcGround = _parent.Collider.Sol;
with (this) {
pt = new Object();
pt = {x:l_nPosX, y:l_nPosY};
pt.y = pt.y - l_nHeight;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor1 = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -60;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloorBoss = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -88;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 120;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 200;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 300;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 360;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 400;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 440;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor5 = function (l_mcElement) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
}
};
}
onClipEvent (enterFrame) {
BoxI = 0;
for (BoxI in G_TabBox) {
var BoxActif = G_TabBox[BoxI];
if (this[BoxActif].Etat != this[BoxActif].EtatOld) {
this[BoxActif].ChangeEtat(this[BoxActif].Etat);
}
this[BoxActif].Actions();
}
PersBallI = 0;
for (PersBallI in G_TabPersBall) {
var PersBallActif = G_TabPersBall[PersBallI];
if (this[PersBallActif].Etat != this[PersBallActif].EtatOld) {
this[PersBallActif].ChangeEtat(this[PersBallActif].Etat);
}
this[PersBallActif].Actions();
}
LevierI = 0;
for (LevierI in G_TabLevier) {
var LevierActif = G_TabLevier[LevierI];
if (this[LevierActif].Etat != this[LevierActif].EtatOld) {
this[LevierActif].ChangeEtat(this[LevierActif].Etat);
}
this[LevierActif].Actions();
}
LadderI = 0;
for (LadderI in G_TabLadder) {
var LadderActif = G_TabLadder[LadderI];
if (this[LadderActif].Etat != this[LadderActif].EtatOld) {
this[LadderActif].ChangeEtat(this[LadderActif].Etat);
}
this[LadderActif].Actions();
}
ChairI = 0;
for (ChairI in G_TabChair) {
var ChairActif = G_TabChair[ChairI];
if (this[ChairActif].Etat != this[ChairActif].EtatOld) {
this[ChairActif].ChangeEtat(this[ChairActif].Etat);
}
this[ChairActif].Actions();
}
ElevatorI = 0;
for (ElevatorI in G_TabElevator) {
var ElevatorActif = G_TabElevator[ElevatorI];
if (this[ElevatorActif].Etat != this[ElevatorActif].EtatOld) {
this[ElevatorActif].ChangeEtat(this[ElevatorActif].Etat);
}
this[ElevatorActif].Actions();
}
I = 0;
for (HuntSoldierI in G_TabHuntSoldier) {
var HuntSoldierActif = G_TabHuntSoldier[HuntSoldierI];
if (this[HuntSoldierActif].Dir != this[HuntSoldierActif].DirOld) {
this[HuntSoldierActif].ChangeDir(this[HuntSoldierActif].Dir);
}
if (this[HuntSoldierActif].Etat != this[HuntSoldierActif].EtatOld) {
this[HuntSoldierActif].ChangeEtat(this[HuntSoldierActif].Etat);
}
this[HuntSoldierActif].Actions();
}
I = 0;
for (HuntWindowI in G_TabHuntWindow) {
var HuntWindowActif = G_TabHuntWindow[HuntWindowI];
if (this[HuntWindowActif].Dir != this[HuntWindowActif].DirOld) {
this[HuntWindowActif].ChangeDir(this[HuntWindowActif].Dir);
}
if (this[HuntWindowActif].Etat != this[HuntWindowActif].EtatOld) {
this[HuntWindowActif].ChangeEtat(this[HuntWindowActif].Etat);
}
this[HuntWindowActif].Actions();
}
if (!G_Pause) {
if (_global.Game.G_HuntWindowCurrentA == null) {
_global.Game.G_WindowAOpenDelayCount++;
}
if (_global.Game.G_HuntWindowCurrentB == null) {
_global.Game.G_WindowBOpenDelayCount++;
}
}
I = 0;
for (MedusaI in G_TabMedusa) {
var MedusaActif = G_TabMedusa[MedusaI];
if (this[MedusaActif].Dir != this[MedusaActif].DirOld) {
this[MedusaActif].ChangeDir(this[MedusaActif].Dir);
}
if (this[MedusaActif].Etat != this[MedusaActif].EtatOld) {
this[MedusaActif].ChangeEtat(this[MedusaActif].Etat);
}
this[MedusaActif].Actions();
}
I = 0;
for (WallI in G_TabWall) {
var WallActif = G_TabWall[WallI];
if (this[WallActif].Dir != this[WallActif].DirOld) {
this[WallActif].ChangeDir(this[WallActif].Dir);
}
if (this[WallActif].Etat != this[WallActif].EtatOld) {
this[WallActif].ChangeEtat(this[WallActif].Etat);
}
this[WallActif].Actions();
}
I = 0;
for (DragonObstacleI in G_TabDragonObstacle) {
var DragonObstacleActif = G_TabDragonObstacle[DragonObstacleI];
if (this[DragonObstacleActif].Dir != this[DragonObstacleActif].DirOld) {
this[DragonObstacleActif].ChangeDir(this[DragonObstacleActif].Dir);
}
if (this[DragonObstacleActif].Etat != this[DragonObstacleActif].EtatOld) {
this[DragonObstacleActif].ChangeEtat(this[DragonObstacleActif].Etat);
}
this[DragonObstacleActif].Actions();
}
I = 0;
for (AntennaI in G_TabAntenna) {
var AntennaActif = G_TabAntenna[AntennaI];
if (this[AntennaActif].Dir != this[AntennaActif].DirOld) {
this[AntennaActif].ChangeDir(this[AntennaActif].Dir);
}
if (this[AntennaActif].Etat != this[AntennaActif].EtatOld) {
this[AntennaActif].ChangeEtat(this[AntennaActif].Etat);
}
this[AntennaActif].Actions();
}
I = 0;
for (MedusaSisterI in G_TabMedusaSister) {
var MedusaSisterActif = G_TabMedusaSister[MedusaSisterI];
if (this[MedusaSisterActif].Dir != this[MedusaSisterActif].DirOld) {
this[MedusaSisterActif].ChangeDir(this[MedusaSisterActif].Dir);
}
if (this[MedusaSisterActif].Etat != this[MedusaSisterActif].EtatOld) {
this[MedusaSisterActif].ChangeEtat(this[MedusaSisterActif].Etat);
}
this[MedusaSisterActif].Actions();
}
I = 0;
for (BonusI in G_TabBonus) {
var BonusActif = G_TabBonus[BonusI];
if (this[BonusActif].Dir != this[BonusActif].DirOld) {
this[BonusActif].ChangeDir(this[BonusActif].Dir);
}
if (this[BonusActif].Etat != this[BonusActif].EtatOld) {
this[BonusActif].ChangeEtat(this[BonusActif].Etat);
}
this[BonusActif].Actions();
}
if (Pers.Dir != Pers.DirOld) {
Pers.ChangeDir(Pers.Dir);
}
if (Pers.Etat != Pers.EtatOld) {
Pers.setState(Pers.Etat);
}
this.Pers.Actions();
this.Bg.Actions();
_global.HUD.update();
G_CheckPause();
}
Symbol 1230 MovieClip Frame 2
stop();
_global.C.beginLevel();
Instance of Symbol 1229 MovieClip "Bg" in Symbol 1230 MovieClip Frame 2
onClipEvent (load) {
this._x = 0;
this._y = 0;
_parent.Control.CreerBg(_parent._x, _parent._y);
BG = _parent.Control.Bg;
for (var i in _parent.Bg) {
if (Number(_parent.Bg[i]._name) <= 20) {
_parent.Bg[i].gotoAndStop(2);
} else {
_parent.Bg[i].gotoAndStop(3);
}
}
BG.MaxDw1 = 6175;
BG.MaxUp1 = -200;
BG.MaxG1 = 0;
BG.MaxD1 = 0;
BG.ParallaxRateSky = 1.1;
BG.ParallaxRateCity = 1.05;
BG.CheckScreen = function () {
with (this) {
MaxDw = MaxDw1;
MaxUp = MaxUp1;
MaxG = MaxG1;
MaxD = MaxD1;
}
};
}
Instance of Symbol 1150 MovieClip "Pers" in Symbol 1230 MovieClip Frame 2
onClipEvent (load) {
_parent.Control.CreerPers(this._x, this._y, "Jake");
this.gotoAndStop("D");
_global.Game.Pers.Etat = "Sleep";
_global.Game.Pers.setState("Idle");
}
Instance of Symbol 1154 MovieClip "Collider" in Symbol 1230 MovieClip Frame 2
onClipEvent (load) {
this._visible = 0;
}
Symbol 1257 MovieClip Frame 1
stop();
Symbol 1257 MovieClip Frame 10
stop();
Symbol 1258 MovieClip Frame 2
_parent._parent._parent.Control.CreerDragonObstacle(this);
stop();
Symbol 1303 MovieClip Frame 41
_global.Snd.playSound("laser", 100, 1, false);
Symbol 1337 MovieClip Frame 1
_global.Snd.playSound("finalZap", 250, 1, false);
Symbol 1337 MovieClip Frame 87
stop();
Symbol 1354 MovieClip Frame 1
_global.Snd.playSound("hurtNet", 250, 1, false);
Symbol 1354 MovieClip Frame 61
stop();
Symbol 1359 MovieClip Frame 1
stop();
Symbol 1359 MovieClip Frame 11
stop();
Symbol 1359 MovieClip Frame 21
stop();
Symbol 1359 MovieClip Frame 31
stop();
Symbol 1359 MovieClip Frame 40
stop();
Symbol 1359 MovieClip Frame 50
stop();
Symbol 1360 MovieClip Frame 2
_parent._parent._parent.Control.CreerMedusa(this);
Symbol 1360 MovieClip Frame 3
stop();
Symbol 1360 MovieClip Frame 15
stop();
Symbol 1370 MovieClip Frame 1
stop();
Symbol 1370 MovieClip Frame 11
stop();
Symbol 1371 MovieClip Frame 2
_parent._parent._parent.Control.CreerAntenna(this);
stop();
Symbol 1372 MovieClip Frame 1
stop();
Instance of Symbol 1202 MovieClip in Symbol 1372 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1372 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1372 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "moveable", "D");
}
Symbol 1372 MovieClip Frame 2
_parent._parent.Control.CreerFloorBoss(this, this._x, this._y);
stop();
Symbol 1373 MovieClip Frame 2
stop();
Instance of Symbol 560 MovieClip "Control" in Symbol 1374 MovieClip Frame 1
onClipEvent (load) {
function ObjBg(PosX, PosY) {
this.Nom = "Bg";
this.PosX = PosX;
this.PosY = PosY;
this.ParallaxPosX = 0;
this.ParallaxPosY = 0;
this.ParallaxSkyPosX = 0;
this.ParallaxSkyPosY = 0;
this.ParallaxCityPosX = 0;
this.ParallaxCityPosY = 0;
this.ParallaxRateSky = 1.2;
this.ParallaxRateCity = 1.1;
this.MoveX = 0;
this.MoveY = 0;
this.MaxDw = 0;
this.MaxUp = 0;
this.MaxG = 0;
this.MaxD = 0;
this.InvPosX = PosX * -1;
this.InvPosY = PosY * -1;
this.DeadX = PosX;
this.DeadY = PosY;
this.CurrentScreen = 1;
this.OldScreen = 0;
this.MaxYDie = 5000;
this.CenterX = 300;
this.CenterY = 370;
this.SpdXD = 15;
this.SpdXG = -15;
this.SpdYDw = 20;
this.SpdYUp = -20;
this.SpdYUpForce = 0;
this.InPause = false;
this.NoCamUpdate = false;
this.CamOnMedusa = false;
}
function ObjBox(Nom, PosX, PosY, Type, Dir) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.MoveX = 0;
this.MoveY = 0;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 75;
this.LgOutD = 525;
this.LgOutUp = 25;
this.LgOutDw = 475;
this.LgHitG = 34;
this.LgHitD = 35;
this.LgHitUp = 25;
this.LgHitDw = 26;
this.HitRightX;
this.HitLeftX;
this.PushDir = Dir;
this.Dir = Pers.Dir;
if (Dir == "D") {
_parent.Bg[1][Nom]._xscale = -100;
}
this.FlagUse = false;
this.LandSide = "Center";
this.MinionBlock = 0;
this.Etat = "Wait";
this.EtatOld = "Sleep";
this.FixedFlag = false;
_parent.Collider.Sol.attachMovie("TopBox", Nom, _parent.Collider.Sol.getNextHighestDepth());
_parent.Collider.Wall.attachMovie("BorderBox", Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Ceil.attachMovie("BottomBox", Nom, _parent.Collider.Ceil.getNextHighestDepth());
this.frTurn = 20;
this.SoundPush = false;
this.WebDestroyed = false;
this.MoveBox();
}
function ObjPers(PosX, PosY, Perso) {
this.nGetHitLeft = 0;
this.nGetHitRight = 0;
this.nGetHitTop = 0;
this.Nom = "Pers";
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.DirOld = "D";
this.Point = _global.C.Score;
this.Life = _global.C.Life;
this.SpdXMinion = 3;
this.SpdXNormal = 15;
this.SpdXBase = this.SpdXNormal;
this.SpdXNow = 0;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.FrontX = 0;
this.FrontY = 0;
this.BottomFrontX = 0;
this.BottomBackX = 0;
this.BackX = 0;
this.HitGrdPoint = 0;
this.WallHitBloc = 2;
this.SpdYNow = 0;
this.SpdYUpBase = 1.7;
this.SpdYUp = this.SpdYUpBase;
this.SpdYMax = 30;
this.SpdYFall = 2.2;
this.SpdYFly = 5;
this.SpdXHitBase = 0;
this.SpdYHitBase = -4;
this.SpdStartJump = -17;
this.SolOut = 2;
this.SolHitMin = 5;
this.MaxSol = 3;
this.HitGrd = false;
this.SolForJump = 6;
this.DistYFall = 0;
this.DistYFallMax = 900;
this.autoSwitchDragon = false;
this.DistYLand = 80;
this.CanHit = false;
this.CanBeHit = true;
this.FrWalkNow = 1;
this.InPause = false;
this.FrJump = 1;
this.FrFall = 1;
this.FrLand = 13;
this.FrGetHit = 7;
this.FrGetHitCount = 0;
this.FrBoomTir = 9;
this.FrFinBoom = 6;
this.FrDead = 20;
this.FrDeadCount = 0;
this.aCharacter = ["Jake", "Dragon"];
this.ICharacter = 0;
this.Perso = this.aCharacter[this.ICharacter];
this.updatePerso();
this.LgGetShootX = 20;
this.LgGetShootUp = 72;
this.LgGetShootUpBas = 44;
this.FrInvincibleCount = 0;
this.FrInvincible = 20;
this.Invincible = false;
this.FrSwitchCharacter = 15;
this.FrSwitchCharacterCount = 0;
this.bCanSwitch = true;
this.bJumpRelease = true;
this.SpdXBaseJumpKick = 20;
this.bComboCheck = false;
this.nFrDelayCombo = 15;
this.nFrDelayComboCount = 0;
this.bCanAttack = true;
this.bAttackRelease = true;
this.bSkipDie = false;
this.mcHitGetHurt = null;
this.HitPointX = 0;
this.HitPointY = 0;
this.nDragonPowerRythm = 25;
this.nDragonPowerCount = 0;
this.DragonHitTop = 0;
this.DragonHitBottom = 0;
this.DragonHeight = 130;
this.onLadderID = null;
this.ClimbedDistance = 0;
this.ladderDisabledMax = 15;
this.ladderDisabledCount = this.ladderDisabledMax;
this.onBouncingID = null;
this.bounceCount = 0;
this.bounceCountMax = 3;
this.bouncingDisabledMax = 15;
this.bouncingDisabledCount = this.bouncingDisabledMax;
this.bHitAttack = false;
this.FrShootFire = 15;
this.FrAttackTailHit = 9;
this.CurrentFireID = null;
if (_global.boss) {
this.WaitForActions = true;
} else {
this.WaitForActions = false;
}
}
function ObjPersBall(Type, Nom, PosX, PosY, Dir, HitBullet, Speed, Tab, HitSound, Rotation, SpdX, SpdY) {
this.Nom = Nom;
this.Type = Type;
this.HitSound = HitSound;
this.Tab = Tab;
this.Etat = "Move";
this.EtatOld = "Idle";
this.Dir = Dir;
this.OldDir = "D";
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 50;
this.LgOutD = 600;
this.LgOutUp = 0;
this.LgOutDw = 500;
this.CanBeKill = false;
if (Dir == "D") {
this.SpdX = Speed;
} else {
this.SpdX = -1 * Speed;
_parent.Bg[1][Nom]._xscale = -100;
}
this.InPause = false;
this.FrHit = HitBullet;
this.FrHide = 1;
if (Type == "Fire") {
Pers.CurrentFireID = Nom;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = Nom;
this.LgOutG = 1100;
this.LgOutD = 1100;
_parent.Bg[1][Nom]._xscale = -100;
_parent.Bg[1][Nom]._rotation = Rotation;
this.SpdX = SpdX;
this.SpdY = SpdY;
}
}
function ObjSwitch(Nom, PosX, PosY) {
this.Nom = Nom;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 20;
this.LgOnY = 20;
this.PosX = PosX;
this.PosY = PosY;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrBaisse = 13;
}
function ObjElevator(mc, Axis, Min, Max) {
this.Nom = mc._name;
this.mc = mc;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 750;
this.LgOutG = 200;
this.LgOutUp = 500;
this.LgOutDw = 900;
this.Speed = 2;
this.frWaitCount = 0;
this.frWaitTime = 30;
this.LgOnX = 200;
this.LgOnY = 25;
this.PersOn = false;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = mc._x + 40;
this.PosY = mc._y + 140;
this.Axis = Axis;
this.Min = this["Pos" + Axis] + Min;
this.Max = this["Pos" + Axis] + Max;
this.Active = false;
this.InPause = false;
this.Dir = -1;
this.CanReposition = false;
this.RepositionCount = 0;
this.RepositionDelay = 30;
_parent.Collider.Sol.attachMovie("GroundElevator", this.Nom, _parent.Collider.Sol.getNextHighestDepth());
_global.Game.CreerOverlay(mc._name + "ramp", "AM_RampeAscenseur01_overlay", {x:mc._x, y:mc._y + 140});
this.MoveElevator();
}
function ObjLevier(Nom, PosX, PosY, listener) {
this.Nom = Nom;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 30;
this.LgOnY = 100;
this.PosX = PosX;
this.PosY = PosY;
this.PersYCorrection = 60;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrFinLevelCount = 0;
this.FrFinLevel = 70;
this.Active = true;
this.listener = listener;
}
function pointsGetAngle(l_x1, l_y1, l_x2, l_y2) {
var _local4 = 0;
var _local3 = 0;
var _local1 = 0;
var _local2 = 0;
_local4 = (l_x1 - l_x2) * -1;
_local3 = (l_y1 - l_y2) * -1;
_local1 = Math.atan2(_local3, _local4);
_local1 = (_local1 * 180) / Math.PI;
if (_local1 < 0) {
_local1 = _local1 * -1;
_local2 = 180 - _local1;
_local1 = 180 + _local2;
}
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
function pointsGetDistance(l_x1, l_y1, l_x2, l_y2) {
var _local1 = Math.sqrt(Math.pow(Math.abs(l_x2 - l_x1), 2) + Math.pow(Math.abs(l_y2 - l_y1), 2));
return(_local1);
}
function ObjLadder(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.obj;
this.Etat = "Off";
this.EtatOld = "Off";
this.LgOnX = 70;
this.LgOnY = 265;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
}
function ObjBouncingChair(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.Obj;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOnX = 70;
this.LgOnY = 50;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
_global.Game.CreerPlateforme({x:this.PosX, y:this.PosY}, 73);
}
function ObjHuntSoldier(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 115;
this.AttackDelayCount = 0;
this.AttackChance = 0.03;
this.ShieldChance = 0.25;
this.HurtCount = 0;
}
function ObjHuntWindow(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "IdleClose";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 450;
this.LgOutDw = 450;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.AttackDelay = 100;
this.AttackDelayCount = 0;
if (PosX < 150) {
this.HuntID = "A";
this.FlipPosition = 20;
} else {
this.HuntID = "B";
this.FlipPosition = -20;
}
this.OpenRangeDown = 450;
this.OpenRangeUp = -20;
this.OpenChanceDragon = 0.85;
this.OpenChanceJake = 0.1;
this.HuntEtat = "idle";
this.AttackDelay = 100;
this.AttackDelayCount = 0;
this.AttackChance = 0.85;
this.FlipDelay = 10;
this.FlipDelayCount = 0;
this.CloseDelay = 100;
this.closeDelayCount = 0;
this.CloseChance = 0.5;
this.FrThrow = 11;
}
function ObjMedusa(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -60;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSparkID = null;
this.HasAttacked = false;
G_Medusa = this;
_global.Medusa = this;
}
function ObjMedusaSister(mc, Type, Nom, PosX, PosY) {
this.mc = mc;
this.Nom = Nom;
this.Perso = Type;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -110;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSister = "SisterRight";
this.CurrentAction = "Idle";
this.MedusaAttack = false;
}
function ObjWall(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
_parent.Collider.Wall.attachMovie("WallHit", this.Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Wall[Nom]._x = PosX;
_parent.Collider.Wall[Nom]._y = PosY;
this.FrRemoveWallHit = 4;
}
function ObjDragonObstacle(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
}
function ObjAntenna(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.ChargedDelay = 300;
this.ChargedCount = 0;
}
function ObjBonus(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.CanBeKill = false;
}
_global.Game = this;
this.KeyListener = new com.sarbakan.utils.KeyManager();
KeyListener.addKeyListener(39, "R");
KeyListener.addKeyListener(37, "L");
KeyListener.addKeyListener(40, "Dw");
KeyListener.addKeyListener(38, "Up");
KeyListener.addKeyListener(32, "Dragon");
KeyListener.addKeyListener(66, "Attack");
KeyListener.addKeyListener(78, "Action");
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
G_CheckPause = function () {
if ((Pers.Etat != "Die") and (Pers.Etat != "Dead")) {
if (G_PauseOut && (!G_Pause)) {
G_Pause = true;
_parent.ControlBall.stop();
_parent._parent.Popup.gotoAndStop("Pause");
if (_global.C.SoundActive) {
_global.SoundCTRL.muteAllSounds();
}
_global.C.DesactivateHud();
} else if ((G_Resume == true) and (G_Pause == true)) {
G_PauseOut = false;
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
KeyListener.Up = false;
KeyListener.UpRelease = true;
KeyListener.Dw = false;
KeyListener.L = false;
KeyListener.R = false;
KeyListener.X = false;
KeyListener.Z = false;
KeyListener.Sp = false;
Music.VolDest = 70;
Music.Etat = "FadeIn";
G_Pause = false;
G_Resume = false;
_parent._parent.Popup.gotoAndStop(1);
if (_global.C.SoundActive) {
_global.SoundCTRL.unmuteAllSounds();
}
_global.C.ActivateHud();
if (_parent.ControlBall._currentframe != 1) {
_parent.ControlBall.play();
}
}
}
};
CreerBg = function (PosX, PosY) {
this.Bg = new ObjBg(PosX, PosY);
};
ObjBg.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
CheckScreen();
if (!NoCamUpdate) {
ScrollBg();
}
}
}
};
ObjBg.prototype.ScrollBg = function () {
with (this) {
if (CamOnMedusa) {
Pers.TrueX = _global.Medusa.TrueX;
Pers.TrueY = _global.Medusa.TrueY;
}
if ((PosY <= MaxDw) and (PosY >= MaxUp)) {
if (Pers.TrueX > (CenterX + 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else {
if ((CenterX - Pers.TrueX) > SpdXG) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXG;
}
if ((PosX + MoveX) < MaxG) {
MoveX = MaxG - PosX;
}
}
} else if (Pers.TrueX < (CenterX - 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
} else {
if ((CenterX - Pers.TrueX) < SpdXD) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXD;
}
if ((PosX + MoveX) > MaxD) {
MoveX = MaxD - PosX;
}
}
} else {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
}
}
}
if ((PosX <= MaxD) and (PosX >= MaxG)) {
if (Pers.TrueY > (CenterY + 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxUp - PosY;
} else {
MoveY = SpdYDw;
}
} else {
if ((CenterY - Pers.TrueY) > SpdYUp) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYUp;
}
if ((PosY + MoveY) < MaxUp) {
MoveY = MaxUp - PosY;
}
}
} else if (Pers.TrueY < (CenterY - 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
} else {
if ((CenterY - Pers.TrueY) < SpdYDw) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYDw;
}
if ((PosY + MoveY) > MaxDw) {
MoveY = MaxDw - PosY;
}
}
} else {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYDw;
}
} else if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
}
}
}
_parent._x = Math.floor(_parent._x + MoveX);
PosX = _parent._x;
InvPosX = PosX * -1;
MoveX = 0;
_parent._y = Math.floor(_parent._y + MoveY);
PosY = _parent._y;
InvPosY = PosY * -1;
_global.MoveY = MoveY;
MoveY = 0;
_parent.ParallaxSky._y = (Math.floor(_parent._y / (-ParallaxRateSky)) + 350) + 30;
ParallaxSkyPosY = _parent.ParallaxSky._y;
_parent.ParallaxCity._y = (Math.floor(_parent._y / (-ParallaxRateCity)) + 140) + 30;
ParallaxCityPosY = _parent.ParallaxCity._y;
}
};
CreerBox = function (Nom, PosX, PosY, Type, Dir) {
if (this[Nom] == null) {
this[Nom] = new ObjBox(Nom, PosX, PosY, Type, Dir);
G_TabBox.push(Nom);
}
};
ObjBox.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBox.prototype.Wait = function () {
with (this) {
if (Type == "moveable") {
CheckPush();
}
CheckHitGrd();
CheckSleep();
CheckFall();
if (Type == "destroyable") {
CheckDestroy();
}
}
};
ObjBox.prototype.Fall = function () {
with (this) {
CheckHitGrd();
SetSpdFall();
MoveBox();
if (((Nom == "BoxDestroyWeb") && (!WebDestroyed)) && (TrueY > 350)) {
_global.Game.WebDestroyable.Etat = "Destroy";
WebDestroyed = true;
}
}
};
ObjBox.prototype.Land = function () {
with (this) {
CheckHitGrd();
SetSpdLand();
MoveBox();
if ((TrueX > 0) && (TrueX < 500)) {
_global.SoundCTRL.playSound("BoxLand", 100, 0);
}
}
};
ObjBox.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe >= _parent.Bg[1][Nom].Etat._totalframes) {
_parent.Bg[1][Nom].Etat.stop();
_parent.Collider.Sol[Nom].removeMovieClip();
_parent.Collider.Ceil[Nom].removeMovieClip();
_parent.Collider.Wall[Nom].removeMovieClip();
}
}
};
ObjBox.prototype.LandFin = function () {
with (this) {
Etat = "Wait";
Pers.PushedBox = 0;
}
};
ObjBox.prototype.Fixed = function () {
with (this) {
CheckSleep();
}
};
ObjBox.prototype.CheckPush = function () {
with (this) {
if (Pers.Etat == "Push") {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.PushPoint)) {
Dir = Pers.Dir;
if (Dir == "D") {
this.MoveX = 2;
} else if (Dir == "G") {
this.MoveX = -2;
}
CheckWall();
if (Pers.Dir != PushDir) {
MoveX = 0;
}
MoveBox();
Pers.PushedBox = this;
if (MoveX != 0) {
_global.Snd.playSound("push", 100, 999, true);
}
}
} else {
_global.Snd.stopSound("push");
}
}
};
ObjBox.prototype.CheckDestroy = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjBox.prototype.CheckHitGrd = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (_parent.Collider.Sol.hitTest(HitX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitRightX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitLeftX, HitY, true)) {
HitGrd = true;
} else {
HitGrd = false;
}
}
};
ObjBox.prototype.SetSpdFall = function () {
with (this) {
MaxMoveY = 15;
MoveY = MoveY + 5;
if (MoveY > MaxMoveY) {
MoveY = MaxMoveY;
}
aCheckPoint = [TrueX, HitLeftX, HitRightX];
for (CheckPointI in aCheckPoint) {
var activePointX = aCheckPoint[CheckPointI];
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 2), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 4), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
}
}
};
ObjBox.prototype.SetSpdLand = function () {
with (this) {
while ((_parent.Collider.Sol.hitTest(TrueX, TrueY + MoveY, true) || (_parent.Collider.Sol.hitTest(HitLeftX, TrueY + MoveY, true))) || (_parent.Collider.Sol.hitTest(HitRightX, TrueY + MoveY, true))) {
MoveY--;
}
if (MoveY < 1) {
MoveY = 1;
Etat = "LandFin";
}
}
};
ObjBox.prototype.CheckFall = function () {
with (this) {
if (HitGrd == true) {
MoveY = 0;
Etat = "Wait";
} else {
Etat = "Fall";
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
MoveX = 0;
MoveY = 0;
}
}
};
ObjBox.prototype.CheckWall = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (Pers.Dir == "G") {
HitX = HitX + (MoveX - LgHitG);
} else if (Pers.Dir == "D") {
HitX = HitX + (MoveX + LgHitD);
}
if (_parent.Collider.Wall.hitTest(HitX, HitY, true)) {
MoveX = 0;
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
}
}
};
ObjBox.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjBox.prototype.MoveBox = function () {
with (this) {
PosX = Number(PosX + MoveX);
PosY = Number(PosY + MoveY);
_parent.Bg[1][Nom]._x = PosX;
_parent.Bg[1][Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY - 15;
_parent.Collider.Wall[Nom]._x = PosX + 30;
_parent.Collider.Wall[Nom]._y = PosY + 4;
_parent.Collider.Ceil[Nom]._x = PosX;
_parent.Collider.Ceil[Nom]._y = PosY + 40;
}
};
ObjBox.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (FixedFlag) {
Etat = "Fixed";
} else {
Etat = "Wait";
}
}
}
};
ObjBox.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = (PosY + _parent._y) + LgHitDw;
HitRightX = TrueX + LgHitD;
HitLeftX = TrueX - LgHitG;
}
};
ObjBox.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if ((NewAction == "Turn") || (NewAction == "Fixed")) {
_parent.Bg[1][Nom].gotoAndStop(NewAction + Dir);
} else {
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
_parent.Bg[1][Nom].Etat.box.gotoAndStop(Type);
_parent.Bg[1][Nom].Etat.box.box.gotoAndStop(Type);
}
};
ObjBox.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
SetTruePos();
this[Etat]();
}
}
};
ObjPers.prototype.IdleJake = function () {
with (this) {
DistYFall = 0;
KeepDeadPos = true;
bCanAttack = true;
if (Life > 0) {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckPush();
CheckJump();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusJake = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.RunJake = function () {
with (this) {
bCanAttack = true;
DistYFall = 0;
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckJump();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartJake = function () {
with (this) {
Pers.bouncingDisabledCount = 0;
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
} else if (DistYFall >= DistYFallMax) {
autoSwitchDragon = true;
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingJake = function () {
with (this) {
CheckGetFire();
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (!_global.Game[onBouncingID].CheckPersOn()) {
bounceCount = 0;
Pers.onBouncingID = null;
}
if (_parent.Pers.Obj.Etat._currentframe >= 3) {
if (_global.energy <= 0) {
_global.energy = 0;
Etat = "Die";
}
}
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.ClimbingJake = function () {
with (this) {
SpdXNow = 0;
SpdYNow = 0;
CheckHitGrd();
if ((Pers.ClimbedDistance > 30) && (HitGrd)) {
Etat = "Idle";
Pers.ladderDisabledCount = 0;
} else if (KeyListener.Action) {
Etat = "Fall";
} else {
if (KeyListener.L) {
SpdXNow = -2;
} else if (KeyListener.R) {
SpdXNow = 2;
}
if (KeyListener.Up) {
SpdYNow = -3;
} else if (KeyListener.Dw) {
SpdYNow = 3;
}
SetMoveX();
SetMoveY();
CheckWall(FrontX, FrontY - 15);
CheckWall(BackX, FrontY - 15);
CheckWall(FrontX, FrontY);
CheckWall(BackX, FrontY);
CheckWall(FrontX, FrontY + 15);
CheckWall(BackX, FrontY + 15);
CheckWall(FrontX, FrontY + 30);
CheckWall(BackX, FrontY + 30);
CheckWall(FrontX, FrontY + 45);
CheckWall(BackX, FrontY + 45);
MovePers();
Pers.ClimbedDistance++;
}
if ((SpdXNow != 0) || (SpdYNow != 0)) {
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
_parent.Pers.Obj.Etat.gotoAndStop(1);
} else {
_parent.Pers.Obj.Etat.nextFrame();
}
} else {
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.ActivateJake = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.HurtJake = function () {
with (this) {
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetJake = function () {
with (this) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
}
};
ObjPers.prototype.AttackJake = function () {
with (this) {
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == Math.round(_parent.Pers.Obj.Etat._totalframes / 2)) {
bHitAttack = true;
} else {
bHitAttack = false;
}
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.GetHitJake = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireJake = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformJake = function () {
with (this) {
DistYFall = 0;
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 1;
Etat = "Idle";
nDragonPowerCount = 0;
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.PushJake = function () {
with (this) {
CheckHitGrd();
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (!KeyListener.Action) {
Etat = "Idle";
} else if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (PushedBox != 0) {
MoveX = PushedBox.MoveX;
} else {
MoveX = 0;
}
} else {
var AddBlock = (35 * NumDir);
var i = 0;
while (i != AddBlock) {
if (_parent.Collider.Wall.hitTest(PushPointX + i, PushPointY, true)) {
goToTarget = true;
if (((i > 5) && (NumDir == 1)) || ((i < -5) && (NumDir == -1))) {
MoveX = 5 * NumDir;
} else {
MoveX = i;
}
break;
}
i = i + NumDir;
}
}
MovePers();
}
};
ObjPers.prototype.TransformFallJake = ObjPers.prototype.TransformJake;
ObjPers.prototype.DieJake = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
if (FrDeadCount == 0) {
_global.lives--;
_global.Snd.stopSound("lift");
_global.Snd.stopSound("push");
if (_global.lives == 0) {
_global.Packaging.showLoseScreen();
} else {
_global.HUD.fade(resetLevel);
}
}
FrDeadCount++;
}
}
};
ObjPers.prototype.SleepJake = function () {
};
ObjPers.prototype.IdleDragon = function () {
with (this) {
bCanAttack = true;
KeepDeadPos = true;
if (Life > 0) {
SetSpdDragon();
SetMoveX();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdDragon();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusDragon = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.FlyDragon = function () {
with (this) {
bCanAttack = true;
SetSpdDragon();
SetMoveX();
SetMoveY();
CheckDragonObstacle();
CheckWall(FrontX, FrontY);
CheckCeilDragon();
CheckSolDragon();
CheckGroundDragon();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartDragon = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
this["CheckAttack" + Perso]();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingDragon = function () {
with (this) {
CheckGetFire();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe >= this.nFrTotalAnim) {
if (Life <= 0) {
Etat = "Die";
} else {
Etat = "Idle";
}
}
}
};
ObjPers.prototype.HurtDragon = function () {
with (this) {
MovePers();
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
Etat = "Idle";
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetDragon = ObjPers.prototype.HurtDragon;
ObjPers.prototype.AttackTailDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrAttackTailHit) {
bHitAttack = true;
} else {
bHitAttack = false;
}
}
};
ObjPers.prototype.AttackFireDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrShootFire) {
if (Dir == "D") {
CreerFireBall(PosX + 70, PosY - 70, Dir);
} else {
CreerFireBall(PosX - 70, PosY - 70, Dir);
}
}
}
};
ObjPers.prototype.GetHitDragon = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireDragon = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 0;
Etat = "Fall";
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.DieDragon = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
FrDeadCount++;
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.SleepDragon = function () {
};
CreerPers = function (PosX, PosY, Perso) {
this.Pers = new ObjPers(PosX, PosY, Perso);
};
ObjPers.prototype.CharacterSwitch = function () {
with (this) {
if (Etat == "Fall") {
Etat = "TransformFall";
} else {
Etat = "Transform";
}
}
};
ObjPers.prototype.HeroChange = function (NewHero) {
with (this) {
Perso = NewHero;
updatePerso();
}
};
ObjPers.prototype.GetHitGeneral = function () {
with (this) {
SetSpdXHit();
CheckWall(BackX, TrueY);
CheckHitGrd();
CheckSol();
MovePers();
CheckDie();
}
};
ObjPers.prototype.CheckGetFire = function () {
with (this) {
var NbMinionBall = G_TabMinionBall.length;
if ((NbMinionBall > 0) && (Perso != "TuesdayDisguised")) {
var i = 0;
while (i < NbMinionBall) {
var BallX = _parent.Control[G_TabMinionBall[i]].PosX;
var BallY = _parent.Control[G_TabMinionBall[i]].PosY;
if (((((BallX >= (PosX - GetFireG)) and (BallX <= (PosX + GetFireD))) and (BallY >= (PosY - GetFireUp))) and (BallY <= (PosY + GetFireDw))) && (!Invincible)) {
Etat = "GetFire";
if (_parent.Control[G_TabMinionBall[i]].Dir == "D") {
Dir = "G";
} else if (_parent.Control[G_TabMinionBall[i]].Dir == "G") {
Dir = "D";
}
_parent.Control[G_TabMinionBall[i]].Etat = "Hit";
}
i++;
}
}
}
};
ObjPers.prototype.InvincibleInit = function () {
with (this) {
Invincible = true;
}
};
ObjPers.prototype.InvincibleEnd = function () {
with (this) {
Invincible = false;
FrInvincibleCount = 0;
_parent.Pers._visible = true;
}
};
ObjPers.prototype.InvincibleCheck = function () {
with (this) {
if (Invincible) {
if (FrInvincibleCount >= FrInvincible) {
InvincibleEnd();
CanBeHit = true;
} else {
FrInvincibleCount++;
if ((FrInvincibleCount % 3) == 0) {
_parent.Pers._visible = !_parent.Pers._visible;
}
}
}
}
};
ObjPers.prototype.SetSpdXHit = function () {
with (this) {
MoveX = SpdXNow;
if (SpdXNow > 0) {
SpdXNow = SpdXNow * 0.7;
}
if (Dir eq "D") {
MoveX = MoveX * -1;
}
}
};
ObjPers.prototype.SetSpdXJake = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX - WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase * -1;
}
} else {
Etat = "Idle";
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdDragon = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (KeyListener.Dw == true) {
SpdYNow = SpdYFly;
} else if (KeyListener.Up == true) {
SpdYNow = SpdYFly * -1;
} else {
SpdYNow = 0;
}
if ((SpdXNow == 0) && (SpdYNow == 0)) {
Etat = "Idle";
} else {
Etat = "Fly";
}
}
};
ObjPers.prototype.SetSpdXJump = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(TrueX + WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(TrueX - WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdXJumpKick = function () {
with (this) {
if (Dir == "G") {
if (SpdXNow < -5) {
SpdXNow = SpdXNow + 2;
} else {
SpdXNow = -5;
}
} else if (Dir == "D") {
if (SpdXNow > 5) {
SpdXNow = SpdXNow - 2;
} else {
SpdXNow = 5;
}
}
}
};
ObjPers.prototype.SetMoveX = function () {
with (this) {
MoveX = SpdXNow;
}
};
ObjPers.prototype.SetMoveY = function () {
with (this) {
MoveY = SpdYNow;
}
};
ObjPers.prototype.CheckWall = function (CoordX, CoordY) {
with (this) {
if (MoveX != 0) {
if (MoveX > 0) {
var WallStop = WallHitBloc;
} else {
var WallStop = (-1 * WallHitBloc);
}
var WallHit1 = (MoveX / 3);
var WallHit2 = (WallHit1 * 2);
var WallHit3 = (WallHit1 * 4);
if (_parent.Collider.Wall.hitTest(CoordX + WallStop, CoordY, true)) {
MoveX = 0;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit1, CoordY, true)) {
MoveX = WallHitBloc;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit2, CoordY, true)) {
MoveX = WallHit1;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit3, CoordY, true)) {
MoveX = WallHit2;
} else if (_parent.Collider.Wall.hitTest(CoordX + MoveX, CoordY, true)) {
MoveX = WallHit2;
}
}
}
};
ObjPers.prototype.CheckDragonObstacle = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Dragon.hitTest(TopX, TopY + MoveY, true)) {
MoveY = DragonHitTop;
} else if (_parent.Collider.Dragon.hitTest(BottomFrontX, (TopY + MoveY) + DragonHeight, true) or _parent.Collider.Dragon.hitTest(BottomBackX, (TopY + MoveY) + DragonHeight, true)) {
MoveY = DragonHitBottom;
}
}
}
};
ObjPers.prototype.CheckCeil = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
Etat = "Fall";
DistYFall = 0;
}
}
}
};
ObjPers.prototype.CheckSolDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Sol.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckCeilDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
}
}
}
};
ObjPers.prototype.CheckGroundDragon = function () {
with (this) {
if (MoveY > 0) {
if (_parent.Collider.Sol.hitTest(BottomFrontX, TrueY - _parent.Pers.Obj.HitBottomFront._y, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckJump = function () {
with (this) {
if (Etat != "Push") {
if ((!KeyListener.Up) && (!bJumpRelease)) {
bJumpRelease = true;
}
if (((KeyListener.Up == true) && (HitGrd == true)) && (bJumpRelease)) {
bJumpRelease = false;
if (Etat == "Run") {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
} else {
Etat = "JumpStart";
}
}
}
}
};
ObjPers.prototype.CheckPush = function () {
with (this) {
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (KeyListener.Action && (((Dir == "G") && (KeyListener.L)) || ((Dir == "D") && (KeyListener.R)))) {
Etat = "Push";
}
}
}
};
ObjPers.prototype.CheckAttackJake = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "Attack";
}
}
};
ObjPers.prototype.CheckAttackDragon = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackTail";
}
if ((KeyListener.Action == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackFire";
}
}
};
ObjPers.prototype.CheckFall = function () {
with (this) {
if (SpdYNow >= SpdYFall) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.CheckDie = function () {
with (this) {
if (_global.energy <= 0) {
_global.dragonPower = 0;
Etat = "Fall";
}
}
};
ObjPers.prototype.MovePers = function () {
with (this) {
if ((Pers.TrueX + MoveX) < 30) {
MoveX = (TrueX * -1) + 30;
} else if ((Pers.TrueX + MoveX) > 520) {
MoveX = 520 - Pers.TrueX;
}
PosX = _parent.Pers._x + MoveX;
_parent.Pers._x = PosX;
MoveX = 0;
PosY = _parent.Pers._y + MoveY;
_parent.Pers._y = PosY;
MoveY = 0;
}
};
ObjPers.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
TopX = TrueX;
TopY = TrueY + _parent.Pers.Obj.HitTop._y;
FrontX = _parent.Pers.Obj.HitFront._x;
FrontY = TrueY + _parent.Pers.Obj.HitFront._y;
BottomFrontX = _parent.Pers.Obj.HitBottomFront._x;
BottomBackX = _parent.Pers.Obj.HitBottomBack._x;
BackX = _parent.Pers.Obj.HitBack._x;
if (Dir == "G") {
FrontX = TrueX - FrontX;
BottomFrontX = TrueX - BottomFrontX;
BottomBackX = TrueX - BottomBackX;
BackX = TrueX - BackX;
} else if (Dir == "D") {
FrontX = TrueX + FrontX;
BottomFrontX = TrueX + BottomFrontX;
BottomBackX = TrueX + BottomBackX;
BackX = TrueX + BackX;
}
}
};
ObjPers.prototype.CheckHitGrd = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = TrueX;
CheckY = TrueY;
aCheckPoints = [CheckX, BottomFrontX, BottomBackX];
} else {
aCheckPoints = [CheckX];
}
for (var i in aCheckPoints) {
if (_parent.Collider.Sol.hitTest(aCheckPoints[i], CheckY + MaxSol, true) and (SpdYNow >= 0)) {
HitGrd = true;
HitGrdPoint = aCheckPoints[i];
if ((onBouncingID != null) && (_global.Game[onBouncingID].CheckPersOn() != true)) {
Pers.SpdYUp = Pers.SpdYUpBase;
}
break;
}
HitGrd = false;
HitGrdPoint = TrueX;
}
}
};
ObjPers.prototype.CheckSol = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = HitGrdPoint;
CheckY = TrueY;
}
if (_parent.Collider.Sol.hitTest(CheckX, CheckY, true) and (SpdYNow >= 0)) {
SpdYNow = 0;
var InSol = true;
while (InSol == true) {
MoveY = MoveY - SolOut;
InSol = _parent.Collider.Sol.hitTest(CheckX, CheckY + MoveY, true);
}
} else if (SpdYNow >= 0) {
if (HitGrd == true) {
SpdYNow = 0;
MoveY = SpdYNow;
} else {
SpdYNow = SpdYNow + SpdYUp;
if (Etat == "JumpKick") {
SpdYNow = SpdYNow + 1;
}
if (SpdYNow > SpdYMax) {
SpdYNow = SpdYMax;
}
var SolHit1 = (SpdYNow / 3);
var SolHit2 = (SolHit1 * 2);
if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit1, true)) {
MoveY = SolHitMin;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit2, true)) {
MoveY = SolHit1;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SpdYNow, true)) {
MoveY = SolHit2;
} else {
MoveY = SpdYNow;
}
}
} else {
SpdYNow = SpdYNow + SpdYUp;
MoveY = SpdYNow;
}
if (MoveY > 0) {
DistYFall = DistYFall + MoveY;
}
}
};
ObjPers.prototype.setState = function (l_sNewState) {
with (this) {
EtatOld = Etat;
Etat = l_sNewState;
var nOldTransformFr = _parent.Pers.Obj.Transform._currentframe;
_parent.Pers.Obj.gotoAndStop(l_sNewState);
_parent.Pers.Obj.Etat.gotoAndPlay(1);
this.nFrTotalAnim = _parent.Pers.Obj.Etat._totalframes;
_parent.Pers.Obj.Transform.gotoAndStop(1);
if ((Etat == "Die") && (bSkipDie)) {
_parent.Pers.Obj.Etat.gotoAndPlay(9);
}
if ((nOldTransformFr < 15) && (nOldTransformFr > 5)) {
_parent.Pers.Obj.Transform.gotoAndPlay(nOldTransformFr);
}
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
}
};
ObjPers.prototype.updatePerso = function () {
var nCurrentFrame;
with (this) {
nCurrentFrame = _parent.Pers.Obj.Etat._currentframe;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
_parent.Pers.Obj.Etat.gotoAndPlay(nCurrentFrame);
nGetHitLeft = -1 * _parent.Pers.Obj.HitBack._x;
nGetHitRight = _parent.Pers.Obj.HitFront._x;
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
ComboKick = 0;
mcHitGetHurt = _parent.Pers.Obj.HitGetHurt;
}
};
ObjPers.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
}
};
ObjPers.prototype.Actions = function () {
with (this) {
if (WaitForActions) {
SetTruePos();
CheckHitGrd();
CheckSol();
CheckFall();
WaitForActions = false;
} else if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Pers.Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Pers.Obj.Etat.play();
}
SetTruePos();
InvincibleCheck();
this[Etat + aCharacter[ICharacter]]();
CheckCharSwitch();
CheckHit();
CheckEndLevel();
}
}
};
ObjPers.prototype.CheckCharSwitch = function () {
with (this) {
if (ICharacter == 1) {
if ((KeyListener.Dragon || (_global.dragonPower == 0)) && (Etat != "HurtNet")) {
CharacterSwitch();
} else if ((++nDragonPowerCount) == nDragonPowerRythm) {
_global.dragonPower--;
nDragonPowerCount = 0;
if (_global.dragonPower < 0) {
_global.dragonPower = 0;
}
}
} else {
if (((KeyListener.Dragon || (autoSwitchDragon)) && (bCanSwitch)) && (_global.dragonPower > 0)) {
autoSwitchDragon = false;
bCanSwitch = false;
FrSwitchCharacterCount = FrSwitchCharacter;
CharacterSwitch();
}
if (!bCanSwitch) {
FrSwitchCharacterCount--;
if (FrSwitchCharacterCount == 0) {
bCanSwitch = true;
}
}
}
}
};
ObjPers.prototype.CheckEndLevel = function () {
with (this) {
if (!_global.boss) {
if (((_global.level == 1) && (PosY <= -3930)) && (PosX >= 390)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if ((_global.level == 2) && (PosY <= -4670)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if (((_global.level == 3) && (PosY <= -5800)) && (PosX <= 105)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
}
}
};
ObjPers.prototype.CheckHit = function () {
with (this) {
if (KeyListener.X && (CanBeHit)) {
this.GetHit();
}
}
};
CreerNetBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("NetBall", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Net", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerFireBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("JackDragon_FireAnim", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Fire", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerSparkBall = function (PosX, PosY, Dir, Rotation, SpdX, SpdY) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("Medusa_Blast", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Spark", _local4, PosX, PosY, Dir, 8, 0, G_TabPersBall, "SlimeSplat", Rotation, SpdX, SpdY);
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
ObjPersBall.prototype.Move = function () {
with (this) {
_parent.Bg[1][Nom]._x = PosX + SpdX;
PosX = PosX + SpdX;
if (SpdY) {
_parent.Bg[1][Nom]._y = PosY + SpdY;
PosY = PosY + SpdY;
}
SetTruePos();
CheckHit();
CheckOut();
}
};
ObjPersBall.prototype.Hit = function () {
with (this) {
if ((Type == "Net") && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
Pers.Etat = "HurtNet";
_global.Snd.playSound("hurtNet", 100, 1, false);
CanBeKill = true;
}
}
};
ObjPersBall.prototype.End = function () {
with (this) {
if (((Type == "Fire") || (Type == "Spark")) && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.Burn = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckHit = function () {
with (this) {
if (Type == "Net") {
if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Burn";
_global.Game[Pers.CurrentFireID].Etat = "End";
} else if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.Hit))) {
Etat = "Hit";
}
}
if (((Type == "Spark") && (Pers.Etat != "Activate")) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.HitFront))) {
Pers.Etat = "Hurt";
Etat = "End";
}
if (((Type == "Spark") && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1].FinalHit))) && (G_Medusa.Etat != "Die")) {
_global.HUD.increaseScore(10000);
_parent.Control.Bg.CamOnMedusa = true;
G_Medusa.Etat = "Die";
}
}
};
ObjPersBall.prototype.CheckOut = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckKill = function () {
with (this) {
if (CanBeKill == true) {
KillBall();
}
}
};
ObjPersBall.prototype.KillBall = function () {
with (this) {
if (Tab == G_TabPersBall) {
G_TabPersBall.splice(PersBallI, 1);
PersBallI = PersBallI - 1;
} else if (Tab == G_TabMinionBall) {
G_TabMinionBall.splice(MinionBallI, 1);
MinionBallI = MinionBallI - 1;
}
delete _parent.Control[Nom];
_parent.Bg[1][Nom].removeMovieClip();
if (Type == "Fire") {
Pers.CurrentFireID = null;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = null;
}
}
};
ObjPersBall.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjPersBall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
};
ObjPersBall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Etat.play();
}
this[Etat]();
CheckKill();
}
}
};
CreerSwitch = function (Nom, PosX, PosY) {
if (this[Nom] == null) {
this[Nom] = new ObjSwitch(Nom, PosX, PosY);
G_TabSwitch.push(Nom);
}
};
ObjSwitch.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjSwitch.prototype.Idle = function () {
with (this) {
CheckPersOn();
CheckBoxOn();
CheckSleep();
}
};
ObjSwitch.prototype.Baisse = function () {
with (this) {
if (_parent[Nom].Etat._currentframe >= FrBaisse) {
_global.SoundCTRL.playSound("SwitchOn", 100, 0);
_parent[Nom].Activate();
Etat = "Active";
}
}
};
ObjSwitch.prototype.Active = function () {
with (this) {
CheckSleep();
if (!FlagBoxUse) {
CheckRelease();
}
}
};
ObjSwitch.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
FlagUse = true;
Etat = "Baisse";
}
}
};
ObjSwitch.prototype.CheckBoxOn = function () {
with (this) {
var Box = Pers.PushedBox;
if ((Pers.Etat == "Push") && (Box != 0)) {
if (Box.Dir == "G") {
if (((((Box.PosX - Box.LgHitG) >= (PosX - LgOnX)) and ((Box.PosX - Box.LgHitG) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Etat = "Baisse";
Activate();
}
} else if (Box.Dir == "D") {
if (((((Box.PosX + Box.LgHitD) >= (PosX - LgOnX)) and ((Box.PosX + Box.LgHitD) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
} else if ((Box.Etat == "LandFin") && (Box != 0)) {
if ((((Box.PosX >= (PosX - LgOnX)) and (Box.PosX <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
Box.Dir = "";
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
}
};
ObjSwitch.prototype.CheckRelease = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
} else {
Etat = "Idle";
FlagUse = false;
_parent[Nom].Desactivate();
_global.SoundCTRL.playSound("SwitchOff", 100, 0);
}
}
};
ObjSwitch.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjSwitch.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjSwitch.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjSwitch.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerElevator = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjElevator(l_mcElement, "Y", 0, -1 * l_mcElement.distance);
G_TabElevator.push(l_mcElement._name);
}
};
this.onSwitchLift = function (l_Nom) {
with (this) {
if (_global.Game[l_Nom + "Lift"].Active == true) {
_global.Game[l_Nom + "Lift"].Active = false;
_global.Game[l_Nom].Etat = "Idle";
_global.Snd.stopSound("lift");
} else {
_global.Game[l_Nom + "Lift"].Active = true;
_global.Game[l_Nom].Etat = "IdleActivate";
_global.Snd.playSound("lift", 100, 999, true);
}
}
};
ObjElevator.prototype.Sleep = function () {
with (this) {
CheckActif();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Idle = function () {
with (this) {
CheckSleep();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Wait = function () {
with (this) {
if (frWaitCount >= frWaitTime) {
Etat = "Idle";
frWaitCount = 0;
} else {
frWaitCount++;
}
}
};
ObjElevator.prototype.SetMove = function () {
with (this) {
CheckPersOn();
CheckLimit();
MoveElevator();
}
};
ObjElevator.prototype.MoveElevator = function () {
with (this) {
this["Pos" + Axis] = this["Pos" + Axis] + this["Move" + Axis];
_parent[Nom]._x = PosX;
_parent[Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY;
if (PersOn) {
Pers["Move" + Axis] = this["Move" + Axis];
Pers.MovePers();
}
UpdateLift();
}
};
ObjElevator.prototype.UpdateLift = function () {
with (this) {
var cableH = (this["Pos" + Axis] - Max);
mc.Obj.cable1._height = cableH;
mc.Obj.cable2._height = cableH;
mc._y = mc._y + this["Move" + Axis];
mc._parent[Nom.substr(0, -4)]._y = mc._parent[Nom.substr(0, -4)]._y + this["Move" + Axis];
_global.Game[Nom.substr(0, -4)].PosY = _global.Game[Nom.substr(0, -4)].PosY + this["Move" + Axis];
_global.Game._parent.overlay[Nom + "ramp"]._y = _global.Game._parent.overlay[Nom + "ramp"]._y + this["Move" + Axis];
_global.Game._parent.Bg[1][Nom + "ramp"]._y = _global.Game._parent.Bg[1][Nom + "ramp"]._y + this["Move" + Axis];
}
};
ObjElevator.prototype.CheckLimit = function () {
with (this) {
this["Move" + Axis] = Speed * Dir;
if ((Dir == -1) && ((this["Pos" + Axis] + this["Move" + Axis]) <= Max)) {
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = false;
CanReposition = true;
RepositionCount = 0;
Dir = 0;
}
if ((Dir == 1) && ((this["Pos" + Axis] + this["Move" + Axis]) >= Min)) {
CanReposition = false;
Dir = -1;
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = true;
_global.Game[Nom.substr(0, -4)].Etat = "Idle";
}
}
};
ObjElevator.prototype.CheckReposition = function () {
with (this) {
if (CanReposition) {
CheckPersOn();
if (!PersOn) {
if ((++RepositionCount) == RepositionDelay) {
RepositionCount = 0;
CanReposition = false;
Active = true;
Dir = 1;
_global.Snd.playSound("lift", 100, 999, true);
}
}
}
}
};
ObjElevator.prototype.Activate = function () {
with (this) {
Active = true;
}
};
ObjElevator.prototype.Desactivate = function () {
with (this) {
Active = false;
}
};
ObjElevator.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
PersOn = true;
} else {
PersOn = false;
}
}
};
ObjElevator.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
Etat = "Idle";
if (Active) {
CheckLimit();
MoveElevator();
}
}
}
};
ObjElevator.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjElevator.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjElevator.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLevier = function (Nom, PosX, PosY, listener) {
if (this[Nom] == null) {
this[Nom] = new ObjLevier(Nom, PosX, PosY, listener);
G_TabLevier.push(Nom);
}
};
ObjLevier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjLevier.prototype.Idle = function () {
with (this) {
if (Active) {
CheckPersOn();
CheckSleep();
}
}
};
ObjLevier.prototype.IdleActivate = ObjLevier.prototype.Idle;
ObjLevier.prototype.Activate = function () {
with (this) {
if (Pers.ICharacter == 0) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.Etat == "Activate")) && (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes)) {
listener(Nom);
}
}
}
};
ObjLevier.prototype.CheckPersOn = function () {
with (this) {
if ((Pers.ICharacter == 0) && (Pers.Etat != "Push")) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.HitGrd == true)) && (Pers.CanBeHit || (Pers.Invincible))) {
if (KeyListener.Action) {
Pers.canJumpCount = 0;
Etat = "Activate";
Pers.Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
}
}
} else if (((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
} else if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
};
ObjLevier.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjLevier.prototype.CheckSleep = function () {
};
ObjLevier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjLevier.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLadder = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjLadder(l_mcElement);
G_TabLadder.push(l_mcElement._name);
}
};
this.onSwitchLadder = function (l_Nom) {
with (this) {
_global.Game[l_Nom + "Ladder"].Etat = "Opening";
}
};
ObjLadder.prototype.Off = function () {
with (this) {
}
};
ObjLadder.prototype.Opening = function () {
with (this) {
if (mc.etat._currentframe == mc.etat._totalframes) {
Etat = "On";
}
}
};
ObjLadder.prototype.On = function () {
with (this) {
CheckPersOn();
}
};
ObjLadder.prototype.CheckPersOn = function () {
with (this) {
if (Pers.ladderDisabledCount >= Pers.ladderDisabledMax) {
if (((((Pers.PosX >= PosX) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= PosY)) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
if (((Pers.ICharacter == 0) && (Pers.Etat != "Climbing")) && (Pers.Etat != "Hurt")) {
if ((KeyListener.Up && (Pers.PosY >= (PosY + 70))) || (KeyListener.Dw && (Pers.PosY <= (PosY + 165)))) {
Pers.onLadderID = Nom;
Pers.Etat = "Climbing";
Pers.ClimbedDistance = 0;
}
}
} else if ((Pers.Etat == "Climbing") && (Pers.onLadderID == Nom)) {
if (Pers.PosX < PosX) {
Pers.ChangeDir("G");
}
if (Pers.PosX > (PosX + LgOnX)) {
Pers.ChangeDir("D");
}
Pers.Etat = "Fall";
Pers.onLadderID = null;
}
} else {
Pers.ladderDisabledCount++;
}
}
};
ObjLadder.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjLadder.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerBouncingChair = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBouncingChair(l_mcElement);
G_TabChair.push(l_mcElement._name);
}
};
ObjBouncingChair.prototype.Idle = function () {
with (this) {
if (CheckPersOn()) {
Etat = "Bounce";
if ((Pers.onBouncingID == Nom) && (Pers.HitGrd)) {
Pers.onBouncingID = null;
}
}
}
};
ObjBouncingChair.prototype.Bounce = function () {
with (this) {
if (mc.Etat._currentframe == 9) {
BouncePers();
}
if (mc.Etat._currentframe == mc.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjBouncingChair.prototype.CheckPersOn = function () {
with (this) {
if ((((((((Pers.ICharacter == 0) && (Pers.Etat != "Idle")) && (Pers.Etat != "Run")) and (Pers.PosX >= PosX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
return(true);
}
}
};
ObjBouncingChair.prototype.BouncePers = function () {
with (this) {
if (CheckPersOn()) {
Pers.SpdYUp = Pers.SpdYUpBase;
if (Pers.onBouncingID != Nom) {
Pers.onBouncingID = Nom;
Pers.bounceCount = 0;
} else {
Pers.bounceCount++;
if (Pers.bounceCount > 0) {
Pers.bounceCount = Pers.bounceCountMax;
}
Pers.SpdYUp = Pers.SpdYUp - (Pers.bounceCount * 0.34);
}
Pers.Etat = "JumpStart";
} else if (Pers.HitGrd) {
Pers.onBouncingID = null;
}
}
};
ObjBouncingChair.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjBouncingChair.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerHuntSoldier = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntSoldier";
this[l_mcElement._name] = new ObjHuntSoldier(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntSoldier.push(l_mcElement._name);
}
};
ObjHuntSoldier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntSoldier.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckShield();
CheckDir();
CheckHurt();
CheckSleep();
}
};
ObjHuntSoldier.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Stunned = ObjHuntSoldier.prototype.Hurt;
ObjHuntSoldier.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack1 = function () {
with (this) {
if (((Pers.Etat != "Hurt") && (_parent.Bg[1][Nom].Obj.Etat._currentframe >= 9)) && (_parent.Bg[1][Nom].Obj.Etat._currentframe <= 25)) {
if (_parent.Bg[1][Nom].Obj.Etat.wave.hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack2 = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 7) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
_global.Snd.playSound("hurtJake", 100, 1, false);
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjHuntSoldier.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if ((Etat != "Shield") && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
if ((++HurtCount) == 3) {
enemyHitScore();
Etat = "Stunned";
HurtCount = 0;
} else {
Etat = "Hurt";
}
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
}
};
ObjHuntSoldier.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjHuntSoldier.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Math.abs(Pers.PosY - PosY) < 180) && (Math.random() < AttackChance)) {
if (Math.abs(Pers.PosX - PosX) < 150) {
Etat = "Attack2";
} else {
Etat = "Attack1";
}
AttackDelayCount = 0;
}
}
};
ObjHuntSoldier.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntSoldier.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjHuntSoldier.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntSoldier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjHuntSoldier.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerHuntWindow = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntWindow";
this[l_mcElement._name] = new ObjHuntWindow(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntWindow.push(l_mcElement._name);
}
};
ObjHuntWindow.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntWindow.prototype.IdleClose = function () {
with (this) {
CheckCanOpen();
CheckSleep();
}
};
ObjHuntWindow.prototype.IdleOpen = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt._currentframe == 1) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.gotoAndStop(HuntID);
SetHuntEtat("Appear");
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
}
if ((HuntEtat == "Appear") && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
SetHuntEtat("idle");
}
if (HuntEtat == "idle") {
CheckFlip();
CheckAttack();
}
if (((HuntEtat == "disappear") || (HuntEtat == "flee")) && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat.stop();
Etat = "Close";
if (HuntEtat == "flee") {
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = -80;
}
}
if (HuntEtat == "Throw") {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes) {
SetHuntEtat("idle");
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == FrThrow) {
var l_dir = "G";
if (HuntID == "A") {
l_dir = "D";
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
if (l_dir == "D") {
l_dir = "G";
} else {
l_dir = "D";
}
}
var l_netY = 70;
if (PosY < Pers.TrueY) {
l_netY = l_netY + (Math.abs(Pers.PosY - TrueY) - 150);
} else {
l_netY = l_netY - Math.abs(Pers.PosY - TrueY);
}
if (l_netY > 120) {
l_netY = 120;
}
if (l_netY < 20) {
l_netY = 20;
}
CreerNetBall(PosX, PosY + l_netY, l_dir);
_global.Snd.playSound("net", 130, 1, false);
}
}
CheckCanClose();
CheckHurt();
CheckSleep();
}
};
ObjHuntWindow.prototype.Open = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleOpen";
AttackDelayCount = AttackDelay * 0.9;
}
}
};
ObjHuntWindow.prototype.Close = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleClose";
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
}
};
ObjHuntWindow.prototype.CheckCanOpen = function () {
with (this) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == null) {
if (_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] >= _global.Game.G_WindowOpenDelay) {
if ((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown))) {
if (((Pers.ICharacter == 0) && (Math.random() <= OpenChanceJake)) || ((Pers.ICharacter == 1) && (Math.random() <= OpenChanceDragon))) {
Etat = "Open";
_global.Game["G_HuntWindowCurrent" + HuntID] = Nom;
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = 0;
}
}
}
}
}
};
ObjHuntWindow.prototype.CheckCanClose = function () {
with (this) {
if (CloseDelayCount < CloseDelay) {
CloseDelayCount++;
} else if ((HuntEtat != "disappear") && ((!((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown)))) || ((Pers.ICharacter == 0) && (Math.random() <= CloseChance)))) {
if (Math.random() <= OpenChance) {
SetHuntEtat("disappear");
CloseDelayCount = 0;
}
}
}
};
ObjHuntWindow.prototype.CheckFlip = function () {
with (this) {
if (FlipDelayCount < FlipDelay) {
FlipDelayCount++;
} else {
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
FlipDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Pers.ICharacter == 1) && (Math.abs(Pers.PosY - PosY) < 300)) {
SetHuntEtat("Throw");
AttackDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckHurt = function () {
with (this) {
if ((((HuntEtat == "idle") || (HuntEtat == "Throw")) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].Obj.hitTest(_parent.Pers.Obj.HitFront))) {
SetHuntEtat("flee");
enemyHitScore();
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
};
ObjHuntWindow.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "IdleClose";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntWindow.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == Nom) {
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
Etat = "Sleep";
}
}
};
ObjHuntWindow.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntWindow.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.window.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.overlay.gotoAndStop(G_CurrentLevel);
}
};
ObjHuntWindow.prototype.SetHuntEtat = function (newEtat) {
with (this) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.gotoAndStop(newEtat);
HuntEtat = newEtat;
}
};
ObjHuntWindow.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusa = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "Medusa";
this[l_mcElement._name] = new ObjMedusa(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusa.push(l_mcElement._name);
}
};
ObjMedusa.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckDir();
CheckHurt();
}
};
ObjMedusa.prototype.Captured = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showNextScreen();
}
}
};
ObjMedusa.prototype.Die = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showWinScreen();
}
}
};
ObjMedusa.prototype.Laugh = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Attack = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe < FrPrepareAttack) {
CheckDir();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrPrepareAttack) {
if (Pers.ICharacter == 0) {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 1.5));
} else {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 3));
}
NextAttackRotation = Math.round(pointsGetAngle(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY));
var l_dst = pointsGetDistance(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY);
var l_step = (l_dst / 20);
NextAttackRotationSpdX = (Pers.TrueX - G_Medusa.TrueX) / l_step;
NextAttackRotationSpdY = (l_PersY - G_Medusa.TrueY) / l_step;
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrAttack) {
var l_PosX = PosX;
CreerSparkBall(PosX, PosY - 95, Dir, NextAttackRotation, NextAttackRotationSpdX, NextAttackRotationSpdY);
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
HasAttacked = true;
Etat = "Idle";
}
CheckHurt();
}
};
ObjMedusa.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjMedusa.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Laugh";
}
}
}
};
ObjMedusa.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjMedusa.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if (Math.random() < AttackChance) {
Etat = "Attack";
HasAttacked = false;
AttackDelayCount = 0;
}
}
};
ObjMedusa.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjMedusa.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjMedusa.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjMedusa.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusaSister = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "MedusaSister";
this[l_mcElement._name] = new ObjMedusaSister(l_mcElement, Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusaSister.push(l_mcElement._name);
}
};
ObjMedusaSister.prototype.UpdateSister = function (SisterID) {
with (this) {
if (CurrentSister == SisterID) {
mc[SisterID].gotoAndStop(CurrentAction);
} else {
mc[SisterID].gotoAndStop("Idle");
}
}
};
ObjMedusaSister.prototype.UpdatePosition = function () {
with (this) {
var l_maxOffset = 70;
var l_posX = Math.abs(_parent.Control.Bg.PosX);
mc._x = -((l_posX / 450) * l_maxOffset);
mc._y = mc._y + (_global.MoveY / 2.5);
if (mc._y < 145) {
mc._y = 145;
}
}
};
ObjMedusaSister.prototype.UpdateAttack = function () {
with (this) {
if ((CurrentAction == "Idle") && (!MedusaAttack)) {
if ((++AttackDelayCount) == AttackDelay) {
if (CurrentSister == "SisterLeft") {
CurrentSister = "SisterRight";
} else {
CurrentSister = "SisterLeft";
}
CurrentAction = "Charge";
AttackDelayCount = 0;
}
} else if (CurrentAction == "Charge") {
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
var PersY = Math.abs(_global.Game.Pers.PosY);
switch (true) {
case PersY < 100 :
CurrentAction = "Attack3";
break;
case PersY < 250 :
CurrentAction = "Attack2";
break;
case PersY >= 250 :
CurrentAction = "Attack1";
}
}
} else if (((CurrentAction == "Attack1") || (CurrentAction == "Attack2")) || (CurrentAction == "Attack3")) {
if (mc[CurrentSister].Etat._currentframe == 9) {
if ((Pers.Etat != "Activate") && (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Pers))) {
Pers.Etat = "Hurt";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna1)) {
_global.Game.Antenna1.Etat = "Charged";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna2)) {
_global.Game.Antenna2.Etat = "Charged";
}
}
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
CurrentAction = "Idle";
if (CurrentSister == "SisterRight") {
MedusaAttack = true;
G_Medusa.HasAttacked = false;
}
}
}
if (!MedusaAttack) {
G_Medusa.AttackDelayCount = 0;
} else if (G_Medusa.HasAttacked) {
MedusaAttack = false;
}
}
};
ObjMedusaSister.prototype.Actions = function () {
with (this) {
UpdatePosition();
UpdateAttack();
UpdateSister("SisterLeft");
UpdateSister("SisterRight");
}
};
CreerWall = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjWall(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabWall.push(l_mcElement._name);
}
};
ObjWall.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjWall.prototype.Idle = function () {
with (this) {
CheckHurt();
CheckSleep();
}
};
ObjWall.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrRemoveWallHit) {
_parent.Collider.Wall[Nom].removeMovieClip();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Out";
}
}
};
ObjWall.prototype.CheckHurt = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjWall.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjWall.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjWall.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjWall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.wall.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.wall.gotoAndStop(G_CurrentLevel);
}
};
ObjWall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerDragonObstacle = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjDragonObstacle(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabDragonObstacle.push(l_mcElement._name);
}
};
ObjDragonObstacle.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjDragonObstacle.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjDragonObstacle.prototype.Hit = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.HitBoss = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 4) {
_global.Game.Web.Etat = "Fall";
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.Fall = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == (_parent.Bg[1][Nom].Obj.Etat._totalframes - 1)) {
G_Medusa.Etat = "Captured";
}
}
};
ObjDragonObstacle.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_parent.Bg[1][Nom].Obj.Etat.stop();
}
}
};
ObjDragonObstacle.prototype.CheckHit = function () {
with (this) {
if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitTop) || (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitBottomFront)))) {
Pers.Etat = "Hurt";
Etat = "Hit";
Pers.InvincibleEnd();
Pers.MoveY = 40;
}
}
};
ObjDragonObstacle.prototype.CheckActif = function () {
with (this) {
if (_global.boss || (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep"))) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjDragonObstacle.prototype.CheckSleep = function () {
with (this) {
if (((((!_global.boss) && (PosX < (Bg.InvPosX - LgOutG))) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjDragonObstacle.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjDragonObstacle.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjDragonObstacle.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerAntenna = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjAntenna(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabAntenna.push(l_mcElement._name);
}
};
ObjAntenna.prototype.Idle = function () {
with (this) {
CheckHit();
}
};
ObjAntenna.prototype.Charged = function () {
with (this) {
CheckHit();
if ((++ChargedCount) == ChargedDelay) {
Etat = "Idle";
ChargedCount = 0;
}
}
};
ObjAntenna.prototype.CheckHit = function () {
with (this) {
if ((G_Medusa.CurrentSparkID != null) && (Pers.Etat != "Hurt")) {
if (_parent.Bg[1][Nom].Obj.Hit.hitTest(_parent.Bg[1][G_Medusa.CurrentSparkID])) {
Etat = "Charged";
ChargedCount = 0;
if ((_global.level == 1) && (_global.Game.Web.Etat != "Fall")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Web.Etat = "Fall";
_global.HUD.increaseScore(1000);
}
if ((((_global.level == 2) && (_global.Game.Antenna1.Etat == "Charged")) && (_global.Game.Antenna2.Etat == "Charged")) && (_global.Game.Wire.Etat != "HitBoss")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Wire.Etat = "HitBoss";
_global.HUD.increaseScore(2000);
}
}
}
}
};
ObjAntenna.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjAntenna.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if (Etat == "Charged") {
_global.Snd.playSound("antenna", 250, 1, false);
}
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjAntenna.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerBonus = function (type, l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBonus(type, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabBonus.push(l_mcElement._name);
}
};
ObjBonus.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjBonus.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBonus.prototype.CheckHit = function () {
with (this) {
if (((Pers.ICharacter == 0) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj))) || ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.Hit)))) {
switch (Type) {
case "Score" :
_global.Score = _global.Score + 500;
_global.Snd.playSound("energy", 200, 1, false);
_global.HUD.increaseScore(500);
break;
case "Life" :
if (_global.lives < 3) {
_global.lives++;
}
_global.Snd.playSound("life", 200, 1, false);
_global.HUD.increaseScore(200);
break;
case "Energy" :
_global.energy = _global.energy + 50;
if (_global.energy > 100) {
_global.energy = 100;
}
_global.Snd.playSound("bonus", 300, 1, false);
_global.HUD.increaseScore(200);
break;
case "Power" :
_global.dragonPower = 100;
_global.Snd.playSound("power", 300, 1, false);
_global.HUD.increaseScore(200);
}
KillBonus();
}
}
};
ObjBonus.prototype.KillBonus = function () {
with (this) {
G_TabBonus.splice(BonusI, 1);
BonusI = BonusI - 1;
delete _parent.Control[Nom];
_parent.Bg[1][Nom].swapDepths(90210);
_parent.Bg[1][Nom].removeMovieClip();
}
};
ObjBonus.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
Etat = "Idle";
}
}
};
ObjBonus.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjBonus.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjBonus.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
CheckKill();
}
}
};
this.cnt = 0;
this.G_CurrentLevel = _global.level;
switch (G_CurrentLevel) {
case 1 :
this.G_MaxEnemyHit = 28;
break;
case 2 :
this.G_MaxEnemyHit = 28;
break;
case 3 :
this.G_MaxEnemyHit = 38;
}
G_MaxEnemyHitCount = 0;
this.G_Pause = true;
this.G_PauseOut = false;
this.G_PRealese = true;
this.G_Resume = false;
this.G_TabBox = new Array();
this.G_TabSwitch = new Array();
this.G_TabDoor = new Array();
this.G_TabElevator = new Array();
this.G_TabPersBall = new Array();
this.G_TabLevier = new Array();
this.G_TabLadder = new Array();
this.G_TabChair = new Array();
this.G_TabHuntSoldier = new Array();
this.G_TabHuntWindow = new Array();
this.G_TabMedusa = new Array();
this.G_TabMedusaSister = new Array();
this.G_TabWall = new Array();
this.G_TabDragonObstacle = new Array();
this.G_TabAntenna = new Array();
this.G_TabBonus = new Array();
this.G_NextPersBall = 1;
this.G_NextPersBallDepth = 10000;
this.G_NextMinionBall = 1;
this.G_NextMinionBallDepth = 20000;
this.G_OverlayDepth = 0;
this.G_HuntWindowCurrentA = null;
this.G_HuntActiveSinceA = 0;
this.G_HuntWindowCurrentB = null;
this.G_HuntActiveSinceB = 0;
this.G_AlphaZones = new Array();
this.G_Medusa = null;
this.G_WindowOpenDelay = 20;
this.G_WindowAOpenDelayCount = 0;
this.G_WindowBOpenDelayCount = 0;
this.addAlphaZone = function (mc) {
if (_global.Packaging.bShadowDisabled) {
mc._visible = false;
}
};
this.resetLevel = function () {
_global.dragonPower = 100;
_global.energy = 100;
if (_global.boss) {
_global.resetDestination = "Game_BOSS" + _global.level;
} else {
_global.resetDestination = "Game_LEVEL" + _global.level;
}
_parent._parent.gotoAndStop("Reset");
};
this.bossStart = function () {
_global.boss = true;
_global.resetDestination = "Game_BOSS" + _global.level;
_parent._parent.gotoAndStop("Reset");
};
this.enemyHitScore = function () {
if ((++G_MaxEnemyHitCount) < G_MaxEnemyHit) {
_global.HUD.increaseScore(100);
}
};
this.Creer_PBalcony = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 235);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PRoofTop = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
var pt = new Object();
pt = {x:l_mcElement._x - 5, y:l_mcElement._y + 95};
var mcCeil = _parent.Collider.Ceil;
mcCeil.moveTo(pt.x, pt.y);
mcCeil.beginFill(16711935);
pt.x = pt.x + 115;
pt.y = pt.y - 70;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x + 115;
pt.y = pt.y + 70;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y - 80;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x - 230;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y + 80;
mcCeil.lineTo(pt.x, pt.y);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBalconyOpen = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + (l_mcElement._parent._y + 10);
CreerPlateforme(pt, 235);
if (l_mcElement.flipped) {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01OverlayFlip", {x:pt.x + 32, y:pt.y}, true);
CreerObstacle({x:pt.x + 19, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
} else {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01Overlay", {x:pt.x + 120, y:pt.y + 0.5}, true);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 195, y:pt.y}, 15, 15);
}
_parent.overlay[l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
_parent.Bg[1][l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBox = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 70);
CreerObstacle(pt, 70, 70);
}
};
this.CheckVisible = function () {
if ((this._y < (Bg.InvPosY - Stage.height)) or (this._y > (Bg.InvPosY + Stage.height))) {
this._visible = false;
} else {
this._visible = true;
}
};
this.CreerObstacle = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Wall;
var _local4 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local4.moveTo(pt.x, pt.y);
_local4.beginFill(16711935);
_local4.lineTo(pt.x, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y);
_local4.lineTo(pt.x, pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711680);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerObstacleDragon = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Dragon;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16776960);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerPlateforme = function (pt, l_nWidth) {
var _local3 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711935);
_local3.lineTo(pt.x, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerOverlay = function (id, linkage, pt, bReversed) {
var _local4;
var _local5;
_local5 = _parent.overlay.attachMovie(linkage, id, G_OverlayDepth++);
_local5._x = pt.x;
_local5._y = pt.y;
_local4 = _parent.Bg[1].attachMovie(linkage, id, G_OverlayDepth++);
_local4._x = pt.x;
_local4._y = pt.y;
_local4.overlay = _local5;
if (!bReversed) {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = false;
this.overlay._visible = true;
} else {
this._visible = true;
this.overlay._visible = false;
}
};
} else {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = true;
this.overlay._visible = false;
} else {
this._visible = false;
this.overlay._visible = true;
}
};
}
};
this.replaceTile = function (l_mcElement) {
var _local1 = l_mcElement._name;
var _local2 = 1499;
if (_local1.slice(0, 8) == "instance") {
} else {
l_mcElement._x = 0;
l_mcElement._y = -((Number(_local1) - 1) * _local2);
}
};
this.CreerFloor = function (l_nPosX, l_nPosY, l_nWidth, l_nHeight) {
var mcGround = _parent.Collider.Sol;
with (this) {
pt = new Object();
pt = {x:l_nPosX, y:l_nPosY};
pt.y = pt.y - l_nHeight;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor1 = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -60;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloorBoss = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -88;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 120;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 200;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 300;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 360;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 400;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 440;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor5 = function (l_mcElement) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
}
};
}
onClipEvent (enterFrame) {
BoxI = 0;
for (BoxI in G_TabBox) {
var BoxActif = G_TabBox[BoxI];
if (this[BoxActif].Etat != this[BoxActif].EtatOld) {
this[BoxActif].ChangeEtat(this[BoxActif].Etat);
}
this[BoxActif].Actions();
}
PersBallI = 0;
for (PersBallI in G_TabPersBall) {
var PersBallActif = G_TabPersBall[PersBallI];
if (this[PersBallActif].Etat != this[PersBallActif].EtatOld) {
this[PersBallActif].ChangeEtat(this[PersBallActif].Etat);
}
this[PersBallActif].Actions();
}
LevierI = 0;
for (LevierI in G_TabLevier) {
var LevierActif = G_TabLevier[LevierI];
if (this[LevierActif].Etat != this[LevierActif].EtatOld) {
this[LevierActif].ChangeEtat(this[LevierActif].Etat);
}
this[LevierActif].Actions();
}
LadderI = 0;
for (LadderI in G_TabLadder) {
var LadderActif = G_TabLadder[LadderI];
if (this[LadderActif].Etat != this[LadderActif].EtatOld) {
this[LadderActif].ChangeEtat(this[LadderActif].Etat);
}
this[LadderActif].Actions();
}
ChairI = 0;
for (ChairI in G_TabChair) {
var ChairActif = G_TabChair[ChairI];
if (this[ChairActif].Etat != this[ChairActif].EtatOld) {
this[ChairActif].ChangeEtat(this[ChairActif].Etat);
}
this[ChairActif].Actions();
}
ElevatorI = 0;
for (ElevatorI in G_TabElevator) {
var ElevatorActif = G_TabElevator[ElevatorI];
if (this[ElevatorActif].Etat != this[ElevatorActif].EtatOld) {
this[ElevatorActif].ChangeEtat(this[ElevatorActif].Etat);
}
this[ElevatorActif].Actions();
}
I = 0;
for (HuntSoldierI in G_TabHuntSoldier) {
var HuntSoldierActif = G_TabHuntSoldier[HuntSoldierI];
if (this[HuntSoldierActif].Dir != this[HuntSoldierActif].DirOld) {
this[HuntSoldierActif].ChangeDir(this[HuntSoldierActif].Dir);
}
if (this[HuntSoldierActif].Etat != this[HuntSoldierActif].EtatOld) {
this[HuntSoldierActif].ChangeEtat(this[HuntSoldierActif].Etat);
}
this[HuntSoldierActif].Actions();
}
I = 0;
for (HuntWindowI in G_TabHuntWindow) {
var HuntWindowActif = G_TabHuntWindow[HuntWindowI];
if (this[HuntWindowActif].Dir != this[HuntWindowActif].DirOld) {
this[HuntWindowActif].ChangeDir(this[HuntWindowActif].Dir);
}
if (this[HuntWindowActif].Etat != this[HuntWindowActif].EtatOld) {
this[HuntWindowActif].ChangeEtat(this[HuntWindowActif].Etat);
}
this[HuntWindowActif].Actions();
}
if (!G_Pause) {
if (_global.Game.G_HuntWindowCurrentA == null) {
_global.Game.G_WindowAOpenDelayCount++;
}
if (_global.Game.G_HuntWindowCurrentB == null) {
_global.Game.G_WindowBOpenDelayCount++;
}
}
I = 0;
for (MedusaI in G_TabMedusa) {
var MedusaActif = G_TabMedusa[MedusaI];
if (this[MedusaActif].Dir != this[MedusaActif].DirOld) {
this[MedusaActif].ChangeDir(this[MedusaActif].Dir);
}
if (this[MedusaActif].Etat != this[MedusaActif].EtatOld) {
this[MedusaActif].ChangeEtat(this[MedusaActif].Etat);
}
this[MedusaActif].Actions();
}
I = 0;
for (WallI in G_TabWall) {
var WallActif = G_TabWall[WallI];
if (this[WallActif].Dir != this[WallActif].DirOld) {
this[WallActif].ChangeDir(this[WallActif].Dir);
}
if (this[WallActif].Etat != this[WallActif].EtatOld) {
this[WallActif].ChangeEtat(this[WallActif].Etat);
}
this[WallActif].Actions();
}
I = 0;
for (DragonObstacleI in G_TabDragonObstacle) {
var DragonObstacleActif = G_TabDragonObstacle[DragonObstacleI];
if (this[DragonObstacleActif].Dir != this[DragonObstacleActif].DirOld) {
this[DragonObstacleActif].ChangeDir(this[DragonObstacleActif].Dir);
}
if (this[DragonObstacleActif].Etat != this[DragonObstacleActif].EtatOld) {
this[DragonObstacleActif].ChangeEtat(this[DragonObstacleActif].Etat);
}
this[DragonObstacleActif].Actions();
}
I = 0;
for (AntennaI in G_TabAntenna) {
var AntennaActif = G_TabAntenna[AntennaI];
if (this[AntennaActif].Dir != this[AntennaActif].DirOld) {
this[AntennaActif].ChangeDir(this[AntennaActif].Dir);
}
if (this[AntennaActif].Etat != this[AntennaActif].EtatOld) {
this[AntennaActif].ChangeEtat(this[AntennaActif].Etat);
}
this[AntennaActif].Actions();
}
I = 0;
for (MedusaSisterI in G_TabMedusaSister) {
var MedusaSisterActif = G_TabMedusaSister[MedusaSisterI];
if (this[MedusaSisterActif].Dir != this[MedusaSisterActif].DirOld) {
this[MedusaSisterActif].ChangeDir(this[MedusaSisterActif].Dir);
}
if (this[MedusaSisterActif].Etat != this[MedusaSisterActif].EtatOld) {
this[MedusaSisterActif].ChangeEtat(this[MedusaSisterActif].Etat);
}
this[MedusaSisterActif].Actions();
}
I = 0;
for (BonusI in G_TabBonus) {
var BonusActif = G_TabBonus[BonusI];
if (this[BonusActif].Dir != this[BonusActif].DirOld) {
this[BonusActif].ChangeDir(this[BonusActif].Dir);
}
if (this[BonusActif].Etat != this[BonusActif].EtatOld) {
this[BonusActif].ChangeEtat(this[BonusActif].Etat);
}
this[BonusActif].Actions();
}
if (Pers.Dir != Pers.DirOld) {
Pers.ChangeDir(Pers.Dir);
}
if (Pers.Etat != Pers.EtatOld) {
Pers.setState(Pers.Etat);
}
this.Pers.Actions();
this.Bg.Actions();
_global.HUD.update();
G_CheckPause();
}
Symbol 1374 MovieClip Frame 2
stop();
_global.C.beginLevel();
Instance of Symbol 1373 MovieClip "Bg" in Symbol 1374 MovieClip Frame 2
onClipEvent (load) {
this._x = 0;
this._y = 0;
this.noUpdateCamCount = 0;
this.noUpdateCamDelay = 50;
_parent.Control.CreerBg(_parent._x, _parent._y);
BG = _parent.Control.Bg;
Pers = _global.Game.Pers;
for (var i in _parent.Bg) {
if (Number(_parent.Bg[i]._name) <= 20) {
_parent.Bg[i].gotoAndStop(2);
} else {
_parent.Bg[i].gotoAndStop(3);
}
}
BG.NoCamUpdate = true;
if (_global.level == 1) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -300;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(380, -280, 250, 20);
}
if (_global.level == 2) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -450;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(95, -280, 250, 20);
_parent.Control.CreerFloor(725, -280, 250, 20);
}
if (_global.level == 3) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -450;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(95, -280, 250, 20);
_parent.Control.CreerFloor(725, -280, 250, 20);
}
_parent.Control.CreerFloor(0, -480, 1100, 20);
BG.ParallaxRateSky = 1.1;
BG.ParallaxRateCity = 1.05;
BG.CheckScreen = function () {
with (this) {
MaxDw = MaxDw1;
MaxUp = MaxUp1;
MaxG = MaxG1;
MaxD = MaxD1;
if (BG.NoCamUpdate && ((++noUpdateCamCount) == noUpdateCamDelay)) {
BG.NoCamUpdate = false;
}
}
};
}
Instance of Symbol 1150 MovieClip "Pers" in Symbol 1374 MovieClip Frame 2
onClipEvent (load) {
_parent.Control.CreerPers(this._x, this._y, "Jake");
this.gotoAndStop("D");
_global.Game.Pers.Etat = "Sleep";
_global.Game.Pers.setState("Idle");
}
Instance of Symbol 1154 MovieClip "Collider" in Symbol 1374 MovieClip Frame 2
onClipEvent (load) {
this._visible = 0;
}
Symbol 1391 MovieClip Frame 1
stop();
Instance of Symbol 1202 MovieClip in Symbol 1391 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1391 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "regular", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1391 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "regular", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1391 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "moveable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1391 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1391 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip "AntennaA" in Symbol 1391 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Symbol 1391 MovieClip Frame 2
_parent._parent.Control.CreerFloorBoss(this, this._x, this._y);
stop();
Symbol 1392 MovieClip Frame 2
stop();
Instance of Symbol 560 MovieClip "Control" in Symbol 1393 MovieClip Frame 1
onClipEvent (load) {
function ObjBg(PosX, PosY) {
this.Nom = "Bg";
this.PosX = PosX;
this.PosY = PosY;
this.ParallaxPosX = 0;
this.ParallaxPosY = 0;
this.ParallaxSkyPosX = 0;
this.ParallaxSkyPosY = 0;
this.ParallaxCityPosX = 0;
this.ParallaxCityPosY = 0;
this.ParallaxRateSky = 1.2;
this.ParallaxRateCity = 1.1;
this.MoveX = 0;
this.MoveY = 0;
this.MaxDw = 0;
this.MaxUp = 0;
this.MaxG = 0;
this.MaxD = 0;
this.InvPosX = PosX * -1;
this.InvPosY = PosY * -1;
this.DeadX = PosX;
this.DeadY = PosY;
this.CurrentScreen = 1;
this.OldScreen = 0;
this.MaxYDie = 5000;
this.CenterX = 300;
this.CenterY = 370;
this.SpdXD = 15;
this.SpdXG = -15;
this.SpdYDw = 20;
this.SpdYUp = -20;
this.SpdYUpForce = 0;
this.InPause = false;
this.NoCamUpdate = false;
this.CamOnMedusa = false;
}
function ObjBox(Nom, PosX, PosY, Type, Dir) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.MoveX = 0;
this.MoveY = 0;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 75;
this.LgOutD = 525;
this.LgOutUp = 25;
this.LgOutDw = 475;
this.LgHitG = 34;
this.LgHitD = 35;
this.LgHitUp = 25;
this.LgHitDw = 26;
this.HitRightX;
this.HitLeftX;
this.PushDir = Dir;
this.Dir = Pers.Dir;
if (Dir == "D") {
_parent.Bg[1][Nom]._xscale = -100;
}
this.FlagUse = false;
this.LandSide = "Center";
this.MinionBlock = 0;
this.Etat = "Wait";
this.EtatOld = "Sleep";
this.FixedFlag = false;
_parent.Collider.Sol.attachMovie("TopBox", Nom, _parent.Collider.Sol.getNextHighestDepth());
_parent.Collider.Wall.attachMovie("BorderBox", Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Ceil.attachMovie("BottomBox", Nom, _parent.Collider.Ceil.getNextHighestDepth());
this.frTurn = 20;
this.SoundPush = false;
this.WebDestroyed = false;
this.MoveBox();
}
function ObjPers(PosX, PosY, Perso) {
this.nGetHitLeft = 0;
this.nGetHitRight = 0;
this.nGetHitTop = 0;
this.Nom = "Pers";
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.DirOld = "D";
this.Point = _global.C.Score;
this.Life = _global.C.Life;
this.SpdXMinion = 3;
this.SpdXNormal = 15;
this.SpdXBase = this.SpdXNormal;
this.SpdXNow = 0;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.FrontX = 0;
this.FrontY = 0;
this.BottomFrontX = 0;
this.BottomBackX = 0;
this.BackX = 0;
this.HitGrdPoint = 0;
this.WallHitBloc = 2;
this.SpdYNow = 0;
this.SpdYUpBase = 1.7;
this.SpdYUp = this.SpdYUpBase;
this.SpdYMax = 30;
this.SpdYFall = 2.2;
this.SpdYFly = 5;
this.SpdXHitBase = 0;
this.SpdYHitBase = -4;
this.SpdStartJump = -17;
this.SolOut = 2;
this.SolHitMin = 5;
this.MaxSol = 3;
this.HitGrd = false;
this.SolForJump = 6;
this.DistYFall = 0;
this.DistYFallMax = 900;
this.autoSwitchDragon = false;
this.DistYLand = 80;
this.CanHit = false;
this.CanBeHit = true;
this.FrWalkNow = 1;
this.InPause = false;
this.FrJump = 1;
this.FrFall = 1;
this.FrLand = 13;
this.FrGetHit = 7;
this.FrGetHitCount = 0;
this.FrBoomTir = 9;
this.FrFinBoom = 6;
this.FrDead = 20;
this.FrDeadCount = 0;
this.aCharacter = ["Jake", "Dragon"];
this.ICharacter = 0;
this.Perso = this.aCharacter[this.ICharacter];
this.updatePerso();
this.LgGetShootX = 20;
this.LgGetShootUp = 72;
this.LgGetShootUpBas = 44;
this.FrInvincibleCount = 0;
this.FrInvincible = 20;
this.Invincible = false;
this.FrSwitchCharacter = 15;
this.FrSwitchCharacterCount = 0;
this.bCanSwitch = true;
this.bJumpRelease = true;
this.SpdXBaseJumpKick = 20;
this.bComboCheck = false;
this.nFrDelayCombo = 15;
this.nFrDelayComboCount = 0;
this.bCanAttack = true;
this.bAttackRelease = true;
this.bSkipDie = false;
this.mcHitGetHurt = null;
this.HitPointX = 0;
this.HitPointY = 0;
this.nDragonPowerRythm = 25;
this.nDragonPowerCount = 0;
this.DragonHitTop = 0;
this.DragonHitBottom = 0;
this.DragonHeight = 130;
this.onLadderID = null;
this.ClimbedDistance = 0;
this.ladderDisabledMax = 15;
this.ladderDisabledCount = this.ladderDisabledMax;
this.onBouncingID = null;
this.bounceCount = 0;
this.bounceCountMax = 3;
this.bouncingDisabledMax = 15;
this.bouncingDisabledCount = this.bouncingDisabledMax;
this.bHitAttack = false;
this.FrShootFire = 15;
this.FrAttackTailHit = 9;
this.CurrentFireID = null;
if (_global.boss) {
this.WaitForActions = true;
} else {
this.WaitForActions = false;
}
}
function ObjPersBall(Type, Nom, PosX, PosY, Dir, HitBullet, Speed, Tab, HitSound, Rotation, SpdX, SpdY) {
this.Nom = Nom;
this.Type = Type;
this.HitSound = HitSound;
this.Tab = Tab;
this.Etat = "Move";
this.EtatOld = "Idle";
this.Dir = Dir;
this.OldDir = "D";
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 50;
this.LgOutD = 600;
this.LgOutUp = 0;
this.LgOutDw = 500;
this.CanBeKill = false;
if (Dir == "D") {
this.SpdX = Speed;
} else {
this.SpdX = -1 * Speed;
_parent.Bg[1][Nom]._xscale = -100;
}
this.InPause = false;
this.FrHit = HitBullet;
this.FrHide = 1;
if (Type == "Fire") {
Pers.CurrentFireID = Nom;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = Nom;
this.LgOutG = 1100;
this.LgOutD = 1100;
_parent.Bg[1][Nom]._xscale = -100;
_parent.Bg[1][Nom]._rotation = Rotation;
this.SpdX = SpdX;
this.SpdY = SpdY;
}
}
function ObjSwitch(Nom, PosX, PosY) {
this.Nom = Nom;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 20;
this.LgOnY = 20;
this.PosX = PosX;
this.PosY = PosY;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrBaisse = 13;
}
function ObjElevator(mc, Axis, Min, Max) {
this.Nom = mc._name;
this.mc = mc;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 750;
this.LgOutG = 200;
this.LgOutUp = 500;
this.LgOutDw = 900;
this.Speed = 2;
this.frWaitCount = 0;
this.frWaitTime = 30;
this.LgOnX = 200;
this.LgOnY = 25;
this.PersOn = false;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = mc._x + 40;
this.PosY = mc._y + 140;
this.Axis = Axis;
this.Min = this["Pos" + Axis] + Min;
this.Max = this["Pos" + Axis] + Max;
this.Active = false;
this.InPause = false;
this.Dir = -1;
this.CanReposition = false;
this.RepositionCount = 0;
this.RepositionDelay = 30;
_parent.Collider.Sol.attachMovie("GroundElevator", this.Nom, _parent.Collider.Sol.getNextHighestDepth());
_global.Game.CreerOverlay(mc._name + "ramp", "AM_RampeAscenseur01_overlay", {x:mc._x, y:mc._y + 140});
this.MoveElevator();
}
function ObjLevier(Nom, PosX, PosY, listener) {
this.Nom = Nom;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 30;
this.LgOnY = 100;
this.PosX = PosX;
this.PosY = PosY;
this.PersYCorrection = 60;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrFinLevelCount = 0;
this.FrFinLevel = 70;
this.Active = true;
this.listener = listener;
}
function pointsGetAngle(l_x1, l_y1, l_x2, l_y2) {
var _local4 = 0;
var _local3 = 0;
var _local1 = 0;
var _local2 = 0;
_local4 = (l_x1 - l_x2) * -1;
_local3 = (l_y1 - l_y2) * -1;
_local1 = Math.atan2(_local3, _local4);
_local1 = (_local1 * 180) / Math.PI;
if (_local1 < 0) {
_local1 = _local1 * -1;
_local2 = 180 - _local1;
_local1 = 180 + _local2;
}
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
function pointsGetDistance(l_x1, l_y1, l_x2, l_y2) {
var _local1 = Math.sqrt(Math.pow(Math.abs(l_x2 - l_x1), 2) + Math.pow(Math.abs(l_y2 - l_y1), 2));
return(_local1);
}
function ObjLadder(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.obj;
this.Etat = "Off";
this.EtatOld = "Off";
this.LgOnX = 70;
this.LgOnY = 265;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
}
function ObjBouncingChair(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.Obj;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOnX = 70;
this.LgOnY = 50;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
_global.Game.CreerPlateforme({x:this.PosX, y:this.PosY}, 73);
}
function ObjHuntSoldier(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 115;
this.AttackDelayCount = 0;
this.AttackChance = 0.03;
this.ShieldChance = 0.25;
this.HurtCount = 0;
}
function ObjHuntWindow(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "IdleClose";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 450;
this.LgOutDw = 450;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.AttackDelay = 100;
this.AttackDelayCount = 0;
if (PosX < 150) {
this.HuntID = "A";
this.FlipPosition = 20;
} else {
this.HuntID = "B";
this.FlipPosition = -20;
}
this.OpenRangeDown = 450;
this.OpenRangeUp = -20;
this.OpenChanceDragon = 0.85;
this.OpenChanceJake = 0.1;
this.HuntEtat = "idle";
this.AttackDelay = 100;
this.AttackDelayCount = 0;
this.AttackChance = 0.85;
this.FlipDelay = 10;
this.FlipDelayCount = 0;
this.CloseDelay = 100;
this.closeDelayCount = 0;
this.CloseChance = 0.5;
this.FrThrow = 11;
}
function ObjMedusa(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -60;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSparkID = null;
this.HasAttacked = false;
G_Medusa = this;
_global.Medusa = this;
}
function ObjMedusaSister(mc, Type, Nom, PosX, PosY) {
this.mc = mc;
this.Nom = Nom;
this.Perso = Type;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -110;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSister = "SisterRight";
this.CurrentAction = "Idle";
this.MedusaAttack = false;
}
function ObjWall(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
_parent.Collider.Wall.attachMovie("WallHit", this.Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Wall[Nom]._x = PosX;
_parent.Collider.Wall[Nom]._y = PosY;
this.FrRemoveWallHit = 4;
}
function ObjDragonObstacle(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
}
function ObjAntenna(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.ChargedDelay = 300;
this.ChargedCount = 0;
}
function ObjBonus(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.CanBeKill = false;
}
_global.Game = this;
this.KeyListener = new com.sarbakan.utils.KeyManager();
KeyListener.addKeyListener(39, "R");
KeyListener.addKeyListener(37, "L");
KeyListener.addKeyListener(40, "Dw");
KeyListener.addKeyListener(38, "Up");
KeyListener.addKeyListener(32, "Dragon");
KeyListener.addKeyListener(66, "Attack");
KeyListener.addKeyListener(78, "Action");
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
G_CheckPause = function () {
if ((Pers.Etat != "Die") and (Pers.Etat != "Dead")) {
if (G_PauseOut && (!G_Pause)) {
G_Pause = true;
_parent.ControlBall.stop();
_parent._parent.Popup.gotoAndStop("Pause");
if (_global.C.SoundActive) {
_global.SoundCTRL.muteAllSounds();
}
_global.C.DesactivateHud();
} else if ((G_Resume == true) and (G_Pause == true)) {
G_PauseOut = false;
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
KeyListener.Up = false;
KeyListener.UpRelease = true;
KeyListener.Dw = false;
KeyListener.L = false;
KeyListener.R = false;
KeyListener.X = false;
KeyListener.Z = false;
KeyListener.Sp = false;
Music.VolDest = 70;
Music.Etat = "FadeIn";
G_Pause = false;
G_Resume = false;
_parent._parent.Popup.gotoAndStop(1);
if (_global.C.SoundActive) {
_global.SoundCTRL.unmuteAllSounds();
}
_global.C.ActivateHud();
if (_parent.ControlBall._currentframe != 1) {
_parent.ControlBall.play();
}
}
}
};
CreerBg = function (PosX, PosY) {
this.Bg = new ObjBg(PosX, PosY);
};
ObjBg.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
CheckScreen();
if (!NoCamUpdate) {
ScrollBg();
}
}
}
};
ObjBg.prototype.ScrollBg = function () {
with (this) {
if (CamOnMedusa) {
Pers.TrueX = _global.Medusa.TrueX;
Pers.TrueY = _global.Medusa.TrueY;
}
if ((PosY <= MaxDw) and (PosY >= MaxUp)) {
if (Pers.TrueX > (CenterX + 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else {
if ((CenterX - Pers.TrueX) > SpdXG) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXG;
}
if ((PosX + MoveX) < MaxG) {
MoveX = MaxG - PosX;
}
}
} else if (Pers.TrueX < (CenterX - 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
} else {
if ((CenterX - Pers.TrueX) < SpdXD) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXD;
}
if ((PosX + MoveX) > MaxD) {
MoveX = MaxD - PosX;
}
}
} else {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
}
}
}
if ((PosX <= MaxD) and (PosX >= MaxG)) {
if (Pers.TrueY > (CenterY + 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxUp - PosY;
} else {
MoveY = SpdYDw;
}
} else {
if ((CenterY - Pers.TrueY) > SpdYUp) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYUp;
}
if ((PosY + MoveY) < MaxUp) {
MoveY = MaxUp - PosY;
}
}
} else if (Pers.TrueY < (CenterY - 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
} else {
if ((CenterY - Pers.TrueY) < SpdYDw) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYDw;
}
if ((PosY + MoveY) > MaxDw) {
MoveY = MaxDw - PosY;
}
}
} else {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYDw;
}
} else if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
}
}
}
_parent._x = Math.floor(_parent._x + MoveX);
PosX = _parent._x;
InvPosX = PosX * -1;
MoveX = 0;
_parent._y = Math.floor(_parent._y + MoveY);
PosY = _parent._y;
InvPosY = PosY * -1;
_global.MoveY = MoveY;
MoveY = 0;
_parent.ParallaxSky._y = (Math.floor(_parent._y / (-ParallaxRateSky)) + 350) + 30;
ParallaxSkyPosY = _parent.ParallaxSky._y;
_parent.ParallaxCity._y = (Math.floor(_parent._y / (-ParallaxRateCity)) + 140) + 30;
ParallaxCityPosY = _parent.ParallaxCity._y;
}
};
CreerBox = function (Nom, PosX, PosY, Type, Dir) {
if (this[Nom] == null) {
this[Nom] = new ObjBox(Nom, PosX, PosY, Type, Dir);
G_TabBox.push(Nom);
}
};
ObjBox.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBox.prototype.Wait = function () {
with (this) {
if (Type == "moveable") {
CheckPush();
}
CheckHitGrd();
CheckSleep();
CheckFall();
if (Type == "destroyable") {
CheckDestroy();
}
}
};
ObjBox.prototype.Fall = function () {
with (this) {
CheckHitGrd();
SetSpdFall();
MoveBox();
if (((Nom == "BoxDestroyWeb") && (!WebDestroyed)) && (TrueY > 350)) {
_global.Game.WebDestroyable.Etat = "Destroy";
WebDestroyed = true;
}
}
};
ObjBox.prototype.Land = function () {
with (this) {
CheckHitGrd();
SetSpdLand();
MoveBox();
if ((TrueX > 0) && (TrueX < 500)) {
_global.SoundCTRL.playSound("BoxLand", 100, 0);
}
}
};
ObjBox.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe >= _parent.Bg[1][Nom].Etat._totalframes) {
_parent.Bg[1][Nom].Etat.stop();
_parent.Collider.Sol[Nom].removeMovieClip();
_parent.Collider.Ceil[Nom].removeMovieClip();
_parent.Collider.Wall[Nom].removeMovieClip();
}
}
};
ObjBox.prototype.LandFin = function () {
with (this) {
Etat = "Wait";
Pers.PushedBox = 0;
}
};
ObjBox.prototype.Fixed = function () {
with (this) {
CheckSleep();
}
};
ObjBox.prototype.CheckPush = function () {
with (this) {
if (Pers.Etat == "Push") {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.PushPoint)) {
Dir = Pers.Dir;
if (Dir == "D") {
this.MoveX = 2;
} else if (Dir == "G") {
this.MoveX = -2;
}
CheckWall();
if (Pers.Dir != PushDir) {
MoveX = 0;
}
MoveBox();
Pers.PushedBox = this;
if (MoveX != 0) {
_global.Snd.playSound("push", 100, 999, true);
}
}
} else {
_global.Snd.stopSound("push");
}
}
};
ObjBox.prototype.CheckDestroy = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjBox.prototype.CheckHitGrd = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (_parent.Collider.Sol.hitTest(HitX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitRightX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitLeftX, HitY, true)) {
HitGrd = true;
} else {
HitGrd = false;
}
}
};
ObjBox.prototype.SetSpdFall = function () {
with (this) {
MaxMoveY = 15;
MoveY = MoveY + 5;
if (MoveY > MaxMoveY) {
MoveY = MaxMoveY;
}
aCheckPoint = [TrueX, HitLeftX, HitRightX];
for (CheckPointI in aCheckPoint) {
var activePointX = aCheckPoint[CheckPointI];
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 2), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 4), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
}
}
};
ObjBox.prototype.SetSpdLand = function () {
with (this) {
while ((_parent.Collider.Sol.hitTest(TrueX, TrueY + MoveY, true) || (_parent.Collider.Sol.hitTest(HitLeftX, TrueY + MoveY, true))) || (_parent.Collider.Sol.hitTest(HitRightX, TrueY + MoveY, true))) {
MoveY--;
}
if (MoveY < 1) {
MoveY = 1;
Etat = "LandFin";
}
}
};
ObjBox.prototype.CheckFall = function () {
with (this) {
if (HitGrd == true) {
MoveY = 0;
Etat = "Wait";
} else {
Etat = "Fall";
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
MoveX = 0;
MoveY = 0;
}
}
};
ObjBox.prototype.CheckWall = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (Pers.Dir == "G") {
HitX = HitX + (MoveX - LgHitG);
} else if (Pers.Dir == "D") {
HitX = HitX + (MoveX + LgHitD);
}
if (_parent.Collider.Wall.hitTest(HitX, HitY, true)) {
MoveX = 0;
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
}
}
};
ObjBox.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjBox.prototype.MoveBox = function () {
with (this) {
PosX = Number(PosX + MoveX);
PosY = Number(PosY + MoveY);
_parent.Bg[1][Nom]._x = PosX;
_parent.Bg[1][Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY - 15;
_parent.Collider.Wall[Nom]._x = PosX + 30;
_parent.Collider.Wall[Nom]._y = PosY + 4;
_parent.Collider.Ceil[Nom]._x = PosX;
_parent.Collider.Ceil[Nom]._y = PosY + 40;
}
};
ObjBox.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (FixedFlag) {
Etat = "Fixed";
} else {
Etat = "Wait";
}
}
}
};
ObjBox.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = (PosY + _parent._y) + LgHitDw;
HitRightX = TrueX + LgHitD;
HitLeftX = TrueX - LgHitG;
}
};
ObjBox.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if ((NewAction == "Turn") || (NewAction == "Fixed")) {
_parent.Bg[1][Nom].gotoAndStop(NewAction + Dir);
} else {
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
_parent.Bg[1][Nom].Etat.box.gotoAndStop(Type);
_parent.Bg[1][Nom].Etat.box.box.gotoAndStop(Type);
}
};
ObjBox.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
SetTruePos();
this[Etat]();
}
}
};
ObjPers.prototype.IdleJake = function () {
with (this) {
DistYFall = 0;
KeepDeadPos = true;
bCanAttack = true;
if (Life > 0) {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckPush();
CheckJump();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusJake = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.RunJake = function () {
with (this) {
bCanAttack = true;
DistYFall = 0;
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckJump();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartJake = function () {
with (this) {
Pers.bouncingDisabledCount = 0;
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
} else if (DistYFall >= DistYFallMax) {
autoSwitchDragon = true;
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingJake = function () {
with (this) {
CheckGetFire();
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (!_global.Game[onBouncingID].CheckPersOn()) {
bounceCount = 0;
Pers.onBouncingID = null;
}
if (_parent.Pers.Obj.Etat._currentframe >= 3) {
if (_global.energy <= 0) {
_global.energy = 0;
Etat = "Die";
}
}
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.ClimbingJake = function () {
with (this) {
SpdXNow = 0;
SpdYNow = 0;
CheckHitGrd();
if ((Pers.ClimbedDistance > 30) && (HitGrd)) {
Etat = "Idle";
Pers.ladderDisabledCount = 0;
} else if (KeyListener.Action) {
Etat = "Fall";
} else {
if (KeyListener.L) {
SpdXNow = -2;
} else if (KeyListener.R) {
SpdXNow = 2;
}
if (KeyListener.Up) {
SpdYNow = -3;
} else if (KeyListener.Dw) {
SpdYNow = 3;
}
SetMoveX();
SetMoveY();
CheckWall(FrontX, FrontY - 15);
CheckWall(BackX, FrontY - 15);
CheckWall(FrontX, FrontY);
CheckWall(BackX, FrontY);
CheckWall(FrontX, FrontY + 15);
CheckWall(BackX, FrontY + 15);
CheckWall(FrontX, FrontY + 30);
CheckWall(BackX, FrontY + 30);
CheckWall(FrontX, FrontY + 45);
CheckWall(BackX, FrontY + 45);
MovePers();
Pers.ClimbedDistance++;
}
if ((SpdXNow != 0) || (SpdYNow != 0)) {
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
_parent.Pers.Obj.Etat.gotoAndStop(1);
} else {
_parent.Pers.Obj.Etat.nextFrame();
}
} else {
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.ActivateJake = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.HurtJake = function () {
with (this) {
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetJake = function () {
with (this) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
}
};
ObjPers.prototype.AttackJake = function () {
with (this) {
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == Math.round(_parent.Pers.Obj.Etat._totalframes / 2)) {
bHitAttack = true;
} else {
bHitAttack = false;
}
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.GetHitJake = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireJake = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformJake = function () {
with (this) {
DistYFall = 0;
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 1;
Etat = "Idle";
nDragonPowerCount = 0;
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.PushJake = function () {
with (this) {
CheckHitGrd();
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (!KeyListener.Action) {
Etat = "Idle";
} else if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (PushedBox != 0) {
MoveX = PushedBox.MoveX;
} else {
MoveX = 0;
}
} else {
var AddBlock = (35 * NumDir);
var i = 0;
while (i != AddBlock) {
if (_parent.Collider.Wall.hitTest(PushPointX + i, PushPointY, true)) {
goToTarget = true;
if (((i > 5) && (NumDir == 1)) || ((i < -5) && (NumDir == -1))) {
MoveX = 5 * NumDir;
} else {
MoveX = i;
}
break;
}
i = i + NumDir;
}
}
MovePers();
}
};
ObjPers.prototype.TransformFallJake = ObjPers.prototype.TransformJake;
ObjPers.prototype.DieJake = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
if (FrDeadCount == 0) {
_global.lives--;
_global.Snd.stopSound("lift");
_global.Snd.stopSound("push");
if (_global.lives == 0) {
_global.Packaging.showLoseScreen();
} else {
_global.HUD.fade(resetLevel);
}
}
FrDeadCount++;
}
}
};
ObjPers.prototype.SleepJake = function () {
};
ObjPers.prototype.IdleDragon = function () {
with (this) {
bCanAttack = true;
KeepDeadPos = true;
if (Life > 0) {
SetSpdDragon();
SetMoveX();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdDragon();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusDragon = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.FlyDragon = function () {
with (this) {
bCanAttack = true;
SetSpdDragon();
SetMoveX();
SetMoveY();
CheckDragonObstacle();
CheckWall(FrontX, FrontY);
CheckCeilDragon();
CheckSolDragon();
CheckGroundDragon();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartDragon = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
this["CheckAttack" + Perso]();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingDragon = function () {
with (this) {
CheckGetFire();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe >= this.nFrTotalAnim) {
if (Life <= 0) {
Etat = "Die";
} else {
Etat = "Idle";
}
}
}
};
ObjPers.prototype.HurtDragon = function () {
with (this) {
MovePers();
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
Etat = "Idle";
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetDragon = ObjPers.prototype.HurtDragon;
ObjPers.prototype.AttackTailDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrAttackTailHit) {
bHitAttack = true;
} else {
bHitAttack = false;
}
}
};
ObjPers.prototype.AttackFireDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrShootFire) {
if (Dir == "D") {
CreerFireBall(PosX + 70, PosY - 70, Dir);
} else {
CreerFireBall(PosX - 70, PosY - 70, Dir);
}
}
}
};
ObjPers.prototype.GetHitDragon = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireDragon = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 0;
Etat = "Fall";
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.DieDragon = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
FrDeadCount++;
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.SleepDragon = function () {
};
CreerPers = function (PosX, PosY, Perso) {
this.Pers = new ObjPers(PosX, PosY, Perso);
};
ObjPers.prototype.CharacterSwitch = function () {
with (this) {
if (Etat == "Fall") {
Etat = "TransformFall";
} else {
Etat = "Transform";
}
}
};
ObjPers.prototype.HeroChange = function (NewHero) {
with (this) {
Perso = NewHero;
updatePerso();
}
};
ObjPers.prototype.GetHitGeneral = function () {
with (this) {
SetSpdXHit();
CheckWall(BackX, TrueY);
CheckHitGrd();
CheckSol();
MovePers();
CheckDie();
}
};
ObjPers.prototype.CheckGetFire = function () {
with (this) {
var NbMinionBall = G_TabMinionBall.length;
if ((NbMinionBall > 0) && (Perso != "TuesdayDisguised")) {
var i = 0;
while (i < NbMinionBall) {
var BallX = _parent.Control[G_TabMinionBall[i]].PosX;
var BallY = _parent.Control[G_TabMinionBall[i]].PosY;
if (((((BallX >= (PosX - GetFireG)) and (BallX <= (PosX + GetFireD))) and (BallY >= (PosY - GetFireUp))) and (BallY <= (PosY + GetFireDw))) && (!Invincible)) {
Etat = "GetFire";
if (_parent.Control[G_TabMinionBall[i]].Dir == "D") {
Dir = "G";
} else if (_parent.Control[G_TabMinionBall[i]].Dir == "G") {
Dir = "D";
}
_parent.Control[G_TabMinionBall[i]].Etat = "Hit";
}
i++;
}
}
}
};
ObjPers.prototype.InvincibleInit = function () {
with (this) {
Invincible = true;
}
};
ObjPers.prototype.InvincibleEnd = function () {
with (this) {
Invincible = false;
FrInvincibleCount = 0;
_parent.Pers._visible = true;
}
};
ObjPers.prototype.InvincibleCheck = function () {
with (this) {
if (Invincible) {
if (FrInvincibleCount >= FrInvincible) {
InvincibleEnd();
CanBeHit = true;
} else {
FrInvincibleCount++;
if ((FrInvincibleCount % 3) == 0) {
_parent.Pers._visible = !_parent.Pers._visible;
}
}
}
}
};
ObjPers.prototype.SetSpdXHit = function () {
with (this) {
MoveX = SpdXNow;
if (SpdXNow > 0) {
SpdXNow = SpdXNow * 0.7;
}
if (Dir eq "D") {
MoveX = MoveX * -1;
}
}
};
ObjPers.prototype.SetSpdXJake = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX - WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase * -1;
}
} else {
Etat = "Idle";
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdDragon = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (KeyListener.Dw == true) {
SpdYNow = SpdYFly;
} else if (KeyListener.Up == true) {
SpdYNow = SpdYFly * -1;
} else {
SpdYNow = 0;
}
if ((SpdXNow == 0) && (SpdYNow == 0)) {
Etat = "Idle";
} else {
Etat = "Fly";
}
}
};
ObjPers.prototype.SetSpdXJump = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(TrueX + WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(TrueX - WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdXJumpKick = function () {
with (this) {
if (Dir == "G") {
if (SpdXNow < -5) {
SpdXNow = SpdXNow + 2;
} else {
SpdXNow = -5;
}
} else if (Dir == "D") {
if (SpdXNow > 5) {
SpdXNow = SpdXNow - 2;
} else {
SpdXNow = 5;
}
}
}
};
ObjPers.prototype.SetMoveX = function () {
with (this) {
MoveX = SpdXNow;
}
};
ObjPers.prototype.SetMoveY = function () {
with (this) {
MoveY = SpdYNow;
}
};
ObjPers.prototype.CheckWall = function (CoordX, CoordY) {
with (this) {
if (MoveX != 0) {
if (MoveX > 0) {
var WallStop = WallHitBloc;
} else {
var WallStop = (-1 * WallHitBloc);
}
var WallHit1 = (MoveX / 3);
var WallHit2 = (WallHit1 * 2);
var WallHit3 = (WallHit1 * 4);
if (_parent.Collider.Wall.hitTest(CoordX + WallStop, CoordY, true)) {
MoveX = 0;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit1, CoordY, true)) {
MoveX = WallHitBloc;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit2, CoordY, true)) {
MoveX = WallHit1;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit3, CoordY, true)) {
MoveX = WallHit2;
} else if (_parent.Collider.Wall.hitTest(CoordX + MoveX, CoordY, true)) {
MoveX = WallHit2;
}
}
}
};
ObjPers.prototype.CheckDragonObstacle = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Dragon.hitTest(TopX, TopY + MoveY, true)) {
MoveY = DragonHitTop;
} else if (_parent.Collider.Dragon.hitTest(BottomFrontX, (TopY + MoveY) + DragonHeight, true) or _parent.Collider.Dragon.hitTest(BottomBackX, (TopY + MoveY) + DragonHeight, true)) {
MoveY = DragonHitBottom;
}
}
}
};
ObjPers.prototype.CheckCeil = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
Etat = "Fall";
DistYFall = 0;
}
}
}
};
ObjPers.prototype.CheckSolDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Sol.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckCeilDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
}
}
}
};
ObjPers.prototype.CheckGroundDragon = function () {
with (this) {
if (MoveY > 0) {
if (_parent.Collider.Sol.hitTest(BottomFrontX, TrueY - _parent.Pers.Obj.HitBottomFront._y, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckJump = function () {
with (this) {
if (Etat != "Push") {
if ((!KeyListener.Up) && (!bJumpRelease)) {
bJumpRelease = true;
}
if (((KeyListener.Up == true) && (HitGrd == true)) && (bJumpRelease)) {
bJumpRelease = false;
if (Etat == "Run") {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
} else {
Etat = "JumpStart";
}
}
}
}
};
ObjPers.prototype.CheckPush = function () {
with (this) {
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (KeyListener.Action && (((Dir == "G") && (KeyListener.L)) || ((Dir == "D") && (KeyListener.R)))) {
Etat = "Push";
}
}
}
};
ObjPers.prototype.CheckAttackJake = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "Attack";
}
}
};
ObjPers.prototype.CheckAttackDragon = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackTail";
}
if ((KeyListener.Action == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackFire";
}
}
};
ObjPers.prototype.CheckFall = function () {
with (this) {
if (SpdYNow >= SpdYFall) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.CheckDie = function () {
with (this) {
if (_global.energy <= 0) {
_global.dragonPower = 0;
Etat = "Fall";
}
}
};
ObjPers.prototype.MovePers = function () {
with (this) {
if ((Pers.TrueX + MoveX) < 30) {
MoveX = (TrueX * -1) + 30;
} else if ((Pers.TrueX + MoveX) > 520) {
MoveX = 520 - Pers.TrueX;
}
PosX = _parent.Pers._x + MoveX;
_parent.Pers._x = PosX;
MoveX = 0;
PosY = _parent.Pers._y + MoveY;
_parent.Pers._y = PosY;
MoveY = 0;
}
};
ObjPers.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
TopX = TrueX;
TopY = TrueY + _parent.Pers.Obj.HitTop._y;
FrontX = _parent.Pers.Obj.HitFront._x;
FrontY = TrueY + _parent.Pers.Obj.HitFront._y;
BottomFrontX = _parent.Pers.Obj.HitBottomFront._x;
BottomBackX = _parent.Pers.Obj.HitBottomBack._x;
BackX = _parent.Pers.Obj.HitBack._x;
if (Dir == "G") {
FrontX = TrueX - FrontX;
BottomFrontX = TrueX - BottomFrontX;
BottomBackX = TrueX - BottomBackX;
BackX = TrueX - BackX;
} else if (Dir == "D") {
FrontX = TrueX + FrontX;
BottomFrontX = TrueX + BottomFrontX;
BottomBackX = TrueX + BottomBackX;
BackX = TrueX + BackX;
}
}
};
ObjPers.prototype.CheckHitGrd = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = TrueX;
CheckY = TrueY;
aCheckPoints = [CheckX, BottomFrontX, BottomBackX];
} else {
aCheckPoints = [CheckX];
}
for (var i in aCheckPoints) {
if (_parent.Collider.Sol.hitTest(aCheckPoints[i], CheckY + MaxSol, true) and (SpdYNow >= 0)) {
HitGrd = true;
HitGrdPoint = aCheckPoints[i];
if ((onBouncingID != null) && (_global.Game[onBouncingID].CheckPersOn() != true)) {
Pers.SpdYUp = Pers.SpdYUpBase;
}
break;
}
HitGrd = false;
HitGrdPoint = TrueX;
}
}
};
ObjPers.prototype.CheckSol = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = HitGrdPoint;
CheckY = TrueY;
}
if (_parent.Collider.Sol.hitTest(CheckX, CheckY, true) and (SpdYNow >= 0)) {
SpdYNow = 0;
var InSol = true;
while (InSol == true) {
MoveY = MoveY - SolOut;
InSol = _parent.Collider.Sol.hitTest(CheckX, CheckY + MoveY, true);
}
} else if (SpdYNow >= 0) {
if (HitGrd == true) {
SpdYNow = 0;
MoveY = SpdYNow;
} else {
SpdYNow = SpdYNow + SpdYUp;
if (Etat == "JumpKick") {
SpdYNow = SpdYNow + 1;
}
if (SpdYNow > SpdYMax) {
SpdYNow = SpdYMax;
}
var SolHit1 = (SpdYNow / 3);
var SolHit2 = (SolHit1 * 2);
if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit1, true)) {
MoveY = SolHitMin;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit2, true)) {
MoveY = SolHit1;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SpdYNow, true)) {
MoveY = SolHit2;
} else {
MoveY = SpdYNow;
}
}
} else {
SpdYNow = SpdYNow + SpdYUp;
MoveY = SpdYNow;
}
if (MoveY > 0) {
DistYFall = DistYFall + MoveY;
}
}
};
ObjPers.prototype.setState = function (l_sNewState) {
with (this) {
EtatOld = Etat;
Etat = l_sNewState;
var nOldTransformFr = _parent.Pers.Obj.Transform._currentframe;
_parent.Pers.Obj.gotoAndStop(l_sNewState);
_parent.Pers.Obj.Etat.gotoAndPlay(1);
this.nFrTotalAnim = _parent.Pers.Obj.Etat._totalframes;
_parent.Pers.Obj.Transform.gotoAndStop(1);
if ((Etat == "Die") && (bSkipDie)) {
_parent.Pers.Obj.Etat.gotoAndPlay(9);
}
if ((nOldTransformFr < 15) && (nOldTransformFr > 5)) {
_parent.Pers.Obj.Transform.gotoAndPlay(nOldTransformFr);
}
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
}
};
ObjPers.prototype.updatePerso = function () {
var nCurrentFrame;
with (this) {
nCurrentFrame = _parent.Pers.Obj.Etat._currentframe;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
_parent.Pers.Obj.Etat.gotoAndPlay(nCurrentFrame);
nGetHitLeft = -1 * _parent.Pers.Obj.HitBack._x;
nGetHitRight = _parent.Pers.Obj.HitFront._x;
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
ComboKick = 0;
mcHitGetHurt = _parent.Pers.Obj.HitGetHurt;
}
};
ObjPers.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
}
};
ObjPers.prototype.Actions = function () {
with (this) {
if (WaitForActions) {
SetTruePos();
CheckHitGrd();
CheckSol();
CheckFall();
WaitForActions = false;
} else if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Pers.Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Pers.Obj.Etat.play();
}
SetTruePos();
InvincibleCheck();
this[Etat + aCharacter[ICharacter]]();
CheckCharSwitch();
CheckHit();
CheckEndLevel();
}
}
};
ObjPers.prototype.CheckCharSwitch = function () {
with (this) {
if (ICharacter == 1) {
if ((KeyListener.Dragon || (_global.dragonPower == 0)) && (Etat != "HurtNet")) {
CharacterSwitch();
} else if ((++nDragonPowerCount) == nDragonPowerRythm) {
_global.dragonPower--;
nDragonPowerCount = 0;
if (_global.dragonPower < 0) {
_global.dragonPower = 0;
}
}
} else {
if (((KeyListener.Dragon || (autoSwitchDragon)) && (bCanSwitch)) && (_global.dragonPower > 0)) {
autoSwitchDragon = false;
bCanSwitch = false;
FrSwitchCharacterCount = FrSwitchCharacter;
CharacterSwitch();
}
if (!bCanSwitch) {
FrSwitchCharacterCount--;
if (FrSwitchCharacterCount == 0) {
bCanSwitch = true;
}
}
}
}
};
ObjPers.prototype.CheckEndLevel = function () {
with (this) {
if (!_global.boss) {
if (((_global.level == 1) && (PosY <= -3930)) && (PosX >= 390)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if ((_global.level == 2) && (PosY <= -4670)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if (((_global.level == 3) && (PosY <= -5800)) && (PosX <= 105)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
}
}
};
ObjPers.prototype.CheckHit = function () {
with (this) {
if (KeyListener.X && (CanBeHit)) {
this.GetHit();
}
}
};
CreerNetBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("NetBall", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Net", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerFireBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("JackDragon_FireAnim", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Fire", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerSparkBall = function (PosX, PosY, Dir, Rotation, SpdX, SpdY) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("Medusa_Blast", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Spark", _local4, PosX, PosY, Dir, 8, 0, G_TabPersBall, "SlimeSplat", Rotation, SpdX, SpdY);
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
ObjPersBall.prototype.Move = function () {
with (this) {
_parent.Bg[1][Nom]._x = PosX + SpdX;
PosX = PosX + SpdX;
if (SpdY) {
_parent.Bg[1][Nom]._y = PosY + SpdY;
PosY = PosY + SpdY;
}
SetTruePos();
CheckHit();
CheckOut();
}
};
ObjPersBall.prototype.Hit = function () {
with (this) {
if ((Type == "Net") && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
Pers.Etat = "HurtNet";
_global.Snd.playSound("hurtNet", 100, 1, false);
CanBeKill = true;
}
}
};
ObjPersBall.prototype.End = function () {
with (this) {
if (((Type == "Fire") || (Type == "Spark")) && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.Burn = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckHit = function () {
with (this) {
if (Type == "Net") {
if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Burn";
_global.Game[Pers.CurrentFireID].Etat = "End";
} else if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.Hit))) {
Etat = "Hit";
}
}
if (((Type == "Spark") && (Pers.Etat != "Activate")) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.HitFront))) {
Pers.Etat = "Hurt";
Etat = "End";
}
if (((Type == "Spark") && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1].FinalHit))) && (G_Medusa.Etat != "Die")) {
_global.HUD.increaseScore(10000);
_parent.Control.Bg.CamOnMedusa = true;
G_Medusa.Etat = "Die";
}
}
};
ObjPersBall.prototype.CheckOut = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckKill = function () {
with (this) {
if (CanBeKill == true) {
KillBall();
}
}
};
ObjPersBall.prototype.KillBall = function () {
with (this) {
if (Tab == G_TabPersBall) {
G_TabPersBall.splice(PersBallI, 1);
PersBallI = PersBallI - 1;
} else if (Tab == G_TabMinionBall) {
G_TabMinionBall.splice(MinionBallI, 1);
MinionBallI = MinionBallI - 1;
}
delete _parent.Control[Nom];
_parent.Bg[1][Nom].removeMovieClip();
if (Type == "Fire") {
Pers.CurrentFireID = null;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = null;
}
}
};
ObjPersBall.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjPersBall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
};
ObjPersBall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Etat.play();
}
this[Etat]();
CheckKill();
}
}
};
CreerSwitch = function (Nom, PosX, PosY) {
if (this[Nom] == null) {
this[Nom] = new ObjSwitch(Nom, PosX, PosY);
G_TabSwitch.push(Nom);
}
};
ObjSwitch.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjSwitch.prototype.Idle = function () {
with (this) {
CheckPersOn();
CheckBoxOn();
CheckSleep();
}
};
ObjSwitch.prototype.Baisse = function () {
with (this) {
if (_parent[Nom].Etat._currentframe >= FrBaisse) {
_global.SoundCTRL.playSound("SwitchOn", 100, 0);
_parent[Nom].Activate();
Etat = "Active";
}
}
};
ObjSwitch.prototype.Active = function () {
with (this) {
CheckSleep();
if (!FlagBoxUse) {
CheckRelease();
}
}
};
ObjSwitch.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
FlagUse = true;
Etat = "Baisse";
}
}
};
ObjSwitch.prototype.CheckBoxOn = function () {
with (this) {
var Box = Pers.PushedBox;
if ((Pers.Etat == "Push") && (Box != 0)) {
if (Box.Dir == "G") {
if (((((Box.PosX - Box.LgHitG) >= (PosX - LgOnX)) and ((Box.PosX - Box.LgHitG) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Etat = "Baisse";
Activate();
}
} else if (Box.Dir == "D") {
if (((((Box.PosX + Box.LgHitD) >= (PosX - LgOnX)) and ((Box.PosX + Box.LgHitD) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
} else if ((Box.Etat == "LandFin") && (Box != 0)) {
if ((((Box.PosX >= (PosX - LgOnX)) and (Box.PosX <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
Box.Dir = "";
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
}
};
ObjSwitch.prototype.CheckRelease = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
} else {
Etat = "Idle";
FlagUse = false;
_parent[Nom].Desactivate();
_global.SoundCTRL.playSound("SwitchOff", 100, 0);
}
}
};
ObjSwitch.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjSwitch.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjSwitch.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjSwitch.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerElevator = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjElevator(l_mcElement, "Y", 0, -1 * l_mcElement.distance);
G_TabElevator.push(l_mcElement._name);
}
};
this.onSwitchLift = function (l_Nom) {
with (this) {
if (_global.Game[l_Nom + "Lift"].Active == true) {
_global.Game[l_Nom + "Lift"].Active = false;
_global.Game[l_Nom].Etat = "Idle";
_global.Snd.stopSound("lift");
} else {
_global.Game[l_Nom + "Lift"].Active = true;
_global.Game[l_Nom].Etat = "IdleActivate";
_global.Snd.playSound("lift", 100, 999, true);
}
}
};
ObjElevator.prototype.Sleep = function () {
with (this) {
CheckActif();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Idle = function () {
with (this) {
CheckSleep();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Wait = function () {
with (this) {
if (frWaitCount >= frWaitTime) {
Etat = "Idle";
frWaitCount = 0;
} else {
frWaitCount++;
}
}
};
ObjElevator.prototype.SetMove = function () {
with (this) {
CheckPersOn();
CheckLimit();
MoveElevator();
}
};
ObjElevator.prototype.MoveElevator = function () {
with (this) {
this["Pos" + Axis] = this["Pos" + Axis] + this["Move" + Axis];
_parent[Nom]._x = PosX;
_parent[Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY;
if (PersOn) {
Pers["Move" + Axis] = this["Move" + Axis];
Pers.MovePers();
}
UpdateLift();
}
};
ObjElevator.prototype.UpdateLift = function () {
with (this) {
var cableH = (this["Pos" + Axis] - Max);
mc.Obj.cable1._height = cableH;
mc.Obj.cable2._height = cableH;
mc._y = mc._y + this["Move" + Axis];
mc._parent[Nom.substr(0, -4)]._y = mc._parent[Nom.substr(0, -4)]._y + this["Move" + Axis];
_global.Game[Nom.substr(0, -4)].PosY = _global.Game[Nom.substr(0, -4)].PosY + this["Move" + Axis];
_global.Game._parent.overlay[Nom + "ramp"]._y = _global.Game._parent.overlay[Nom + "ramp"]._y + this["Move" + Axis];
_global.Game._parent.Bg[1][Nom + "ramp"]._y = _global.Game._parent.Bg[1][Nom + "ramp"]._y + this["Move" + Axis];
}
};
ObjElevator.prototype.CheckLimit = function () {
with (this) {
this["Move" + Axis] = Speed * Dir;
if ((Dir == -1) && ((this["Pos" + Axis] + this["Move" + Axis]) <= Max)) {
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = false;
CanReposition = true;
RepositionCount = 0;
Dir = 0;
}
if ((Dir == 1) && ((this["Pos" + Axis] + this["Move" + Axis]) >= Min)) {
CanReposition = false;
Dir = -1;
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = true;
_global.Game[Nom.substr(0, -4)].Etat = "Idle";
}
}
};
ObjElevator.prototype.CheckReposition = function () {
with (this) {
if (CanReposition) {
CheckPersOn();
if (!PersOn) {
if ((++RepositionCount) == RepositionDelay) {
RepositionCount = 0;
CanReposition = false;
Active = true;
Dir = 1;
_global.Snd.playSound("lift", 100, 999, true);
}
}
}
}
};
ObjElevator.prototype.Activate = function () {
with (this) {
Active = true;
}
};
ObjElevator.prototype.Desactivate = function () {
with (this) {
Active = false;
}
};
ObjElevator.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
PersOn = true;
} else {
PersOn = false;
}
}
};
ObjElevator.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
Etat = "Idle";
if (Active) {
CheckLimit();
MoveElevator();
}
}
}
};
ObjElevator.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjElevator.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjElevator.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLevier = function (Nom, PosX, PosY, listener) {
if (this[Nom] == null) {
this[Nom] = new ObjLevier(Nom, PosX, PosY, listener);
G_TabLevier.push(Nom);
}
};
ObjLevier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjLevier.prototype.Idle = function () {
with (this) {
if (Active) {
CheckPersOn();
CheckSleep();
}
}
};
ObjLevier.prototype.IdleActivate = ObjLevier.prototype.Idle;
ObjLevier.prototype.Activate = function () {
with (this) {
if (Pers.ICharacter == 0) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.Etat == "Activate")) && (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes)) {
listener(Nom);
}
}
}
};
ObjLevier.prototype.CheckPersOn = function () {
with (this) {
if ((Pers.ICharacter == 0) && (Pers.Etat != "Push")) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.HitGrd == true)) && (Pers.CanBeHit || (Pers.Invincible))) {
if (KeyListener.Action) {
Pers.canJumpCount = 0;
Etat = "Activate";
Pers.Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
}
}
} else if (((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
} else if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
};
ObjLevier.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjLevier.prototype.CheckSleep = function () {
};
ObjLevier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjLevier.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLadder = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjLadder(l_mcElement);
G_TabLadder.push(l_mcElement._name);
}
};
this.onSwitchLadder = function (l_Nom) {
with (this) {
_global.Game[l_Nom + "Ladder"].Etat = "Opening";
}
};
ObjLadder.prototype.Off = function () {
with (this) {
}
};
ObjLadder.prototype.Opening = function () {
with (this) {
if (mc.etat._currentframe == mc.etat._totalframes) {
Etat = "On";
}
}
};
ObjLadder.prototype.On = function () {
with (this) {
CheckPersOn();
}
};
ObjLadder.prototype.CheckPersOn = function () {
with (this) {
if (Pers.ladderDisabledCount >= Pers.ladderDisabledMax) {
if (((((Pers.PosX >= PosX) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= PosY)) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
if (((Pers.ICharacter == 0) && (Pers.Etat != "Climbing")) && (Pers.Etat != "Hurt")) {
if ((KeyListener.Up && (Pers.PosY >= (PosY + 70))) || (KeyListener.Dw && (Pers.PosY <= (PosY + 165)))) {
Pers.onLadderID = Nom;
Pers.Etat = "Climbing";
Pers.ClimbedDistance = 0;
}
}
} else if ((Pers.Etat == "Climbing") && (Pers.onLadderID == Nom)) {
if (Pers.PosX < PosX) {
Pers.ChangeDir("G");
}
if (Pers.PosX > (PosX + LgOnX)) {
Pers.ChangeDir("D");
}
Pers.Etat = "Fall";
Pers.onLadderID = null;
}
} else {
Pers.ladderDisabledCount++;
}
}
};
ObjLadder.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjLadder.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerBouncingChair = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBouncingChair(l_mcElement);
G_TabChair.push(l_mcElement._name);
}
};
ObjBouncingChair.prototype.Idle = function () {
with (this) {
if (CheckPersOn()) {
Etat = "Bounce";
if ((Pers.onBouncingID == Nom) && (Pers.HitGrd)) {
Pers.onBouncingID = null;
}
}
}
};
ObjBouncingChair.prototype.Bounce = function () {
with (this) {
if (mc.Etat._currentframe == 9) {
BouncePers();
}
if (mc.Etat._currentframe == mc.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjBouncingChair.prototype.CheckPersOn = function () {
with (this) {
if ((((((((Pers.ICharacter == 0) && (Pers.Etat != "Idle")) && (Pers.Etat != "Run")) and (Pers.PosX >= PosX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
return(true);
}
}
};
ObjBouncingChair.prototype.BouncePers = function () {
with (this) {
if (CheckPersOn()) {
Pers.SpdYUp = Pers.SpdYUpBase;
if (Pers.onBouncingID != Nom) {
Pers.onBouncingID = Nom;
Pers.bounceCount = 0;
} else {
Pers.bounceCount++;
if (Pers.bounceCount > 0) {
Pers.bounceCount = Pers.bounceCountMax;
}
Pers.SpdYUp = Pers.SpdYUp - (Pers.bounceCount * 0.34);
}
Pers.Etat = "JumpStart";
} else if (Pers.HitGrd) {
Pers.onBouncingID = null;
}
}
};
ObjBouncingChair.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjBouncingChair.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerHuntSoldier = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntSoldier";
this[l_mcElement._name] = new ObjHuntSoldier(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntSoldier.push(l_mcElement._name);
}
};
ObjHuntSoldier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntSoldier.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckShield();
CheckDir();
CheckHurt();
CheckSleep();
}
};
ObjHuntSoldier.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Stunned = ObjHuntSoldier.prototype.Hurt;
ObjHuntSoldier.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack1 = function () {
with (this) {
if (((Pers.Etat != "Hurt") && (_parent.Bg[1][Nom].Obj.Etat._currentframe >= 9)) && (_parent.Bg[1][Nom].Obj.Etat._currentframe <= 25)) {
if (_parent.Bg[1][Nom].Obj.Etat.wave.hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack2 = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 7) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
_global.Snd.playSound("hurtJake", 100, 1, false);
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjHuntSoldier.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if ((Etat != "Shield") && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
if ((++HurtCount) == 3) {
enemyHitScore();
Etat = "Stunned";
HurtCount = 0;
} else {
Etat = "Hurt";
}
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
}
};
ObjHuntSoldier.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjHuntSoldier.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Math.abs(Pers.PosY - PosY) < 180) && (Math.random() < AttackChance)) {
if (Math.abs(Pers.PosX - PosX) < 150) {
Etat = "Attack2";
} else {
Etat = "Attack1";
}
AttackDelayCount = 0;
}
}
};
ObjHuntSoldier.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntSoldier.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjHuntSoldier.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntSoldier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjHuntSoldier.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerHuntWindow = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntWindow";
this[l_mcElement._name] = new ObjHuntWindow(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntWindow.push(l_mcElement._name);
}
};
ObjHuntWindow.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntWindow.prototype.IdleClose = function () {
with (this) {
CheckCanOpen();
CheckSleep();
}
};
ObjHuntWindow.prototype.IdleOpen = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt._currentframe == 1) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.gotoAndStop(HuntID);
SetHuntEtat("Appear");
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
}
if ((HuntEtat == "Appear") && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
SetHuntEtat("idle");
}
if (HuntEtat == "idle") {
CheckFlip();
CheckAttack();
}
if (((HuntEtat == "disappear") || (HuntEtat == "flee")) && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat.stop();
Etat = "Close";
if (HuntEtat == "flee") {
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = -80;
}
}
if (HuntEtat == "Throw") {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes) {
SetHuntEtat("idle");
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == FrThrow) {
var l_dir = "G";
if (HuntID == "A") {
l_dir = "D";
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
if (l_dir == "D") {
l_dir = "G";
} else {
l_dir = "D";
}
}
var l_netY = 70;
if (PosY < Pers.TrueY) {
l_netY = l_netY + (Math.abs(Pers.PosY - TrueY) - 150);
} else {
l_netY = l_netY - Math.abs(Pers.PosY - TrueY);
}
if (l_netY > 120) {
l_netY = 120;
}
if (l_netY < 20) {
l_netY = 20;
}
CreerNetBall(PosX, PosY + l_netY, l_dir);
_global.Snd.playSound("net", 130, 1, false);
}
}
CheckCanClose();
CheckHurt();
CheckSleep();
}
};
ObjHuntWindow.prototype.Open = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleOpen";
AttackDelayCount = AttackDelay * 0.9;
}
}
};
ObjHuntWindow.prototype.Close = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleClose";
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
}
};
ObjHuntWindow.prototype.CheckCanOpen = function () {
with (this) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == null) {
if (_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] >= _global.Game.G_WindowOpenDelay) {
if ((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown))) {
if (((Pers.ICharacter == 0) && (Math.random() <= OpenChanceJake)) || ((Pers.ICharacter == 1) && (Math.random() <= OpenChanceDragon))) {
Etat = "Open";
_global.Game["G_HuntWindowCurrent" + HuntID] = Nom;
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = 0;
}
}
}
}
}
};
ObjHuntWindow.prototype.CheckCanClose = function () {
with (this) {
if (CloseDelayCount < CloseDelay) {
CloseDelayCount++;
} else if ((HuntEtat != "disappear") && ((!((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown)))) || ((Pers.ICharacter == 0) && (Math.random() <= CloseChance)))) {
if (Math.random() <= OpenChance) {
SetHuntEtat("disappear");
CloseDelayCount = 0;
}
}
}
};
ObjHuntWindow.prototype.CheckFlip = function () {
with (this) {
if (FlipDelayCount < FlipDelay) {
FlipDelayCount++;
} else {
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
FlipDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Pers.ICharacter == 1) && (Math.abs(Pers.PosY - PosY) < 300)) {
SetHuntEtat("Throw");
AttackDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckHurt = function () {
with (this) {
if ((((HuntEtat == "idle") || (HuntEtat == "Throw")) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].Obj.hitTest(_parent.Pers.Obj.HitFront))) {
SetHuntEtat("flee");
enemyHitScore();
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
};
ObjHuntWindow.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "IdleClose";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntWindow.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == Nom) {
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
Etat = "Sleep";
}
}
};
ObjHuntWindow.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntWindow.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.window.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.overlay.gotoAndStop(G_CurrentLevel);
}
};
ObjHuntWindow.prototype.SetHuntEtat = function (newEtat) {
with (this) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.gotoAndStop(newEtat);
HuntEtat = newEtat;
}
};
ObjHuntWindow.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusa = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "Medusa";
this[l_mcElement._name] = new ObjMedusa(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusa.push(l_mcElement._name);
}
};
ObjMedusa.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckDir();
CheckHurt();
}
};
ObjMedusa.prototype.Captured = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showNextScreen();
}
}
};
ObjMedusa.prototype.Die = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showWinScreen();
}
}
};
ObjMedusa.prototype.Laugh = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Attack = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe < FrPrepareAttack) {
CheckDir();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrPrepareAttack) {
if (Pers.ICharacter == 0) {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 1.5));
} else {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 3));
}
NextAttackRotation = Math.round(pointsGetAngle(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY));
var l_dst = pointsGetDistance(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY);
var l_step = (l_dst / 20);
NextAttackRotationSpdX = (Pers.TrueX - G_Medusa.TrueX) / l_step;
NextAttackRotationSpdY = (l_PersY - G_Medusa.TrueY) / l_step;
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrAttack) {
var l_PosX = PosX;
CreerSparkBall(PosX, PosY - 95, Dir, NextAttackRotation, NextAttackRotationSpdX, NextAttackRotationSpdY);
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
HasAttacked = true;
Etat = "Idle";
}
CheckHurt();
}
};
ObjMedusa.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjMedusa.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Laugh";
}
}
}
};
ObjMedusa.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjMedusa.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if (Math.random() < AttackChance) {
Etat = "Attack";
HasAttacked = false;
AttackDelayCount = 0;
}
}
};
ObjMedusa.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjMedusa.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjMedusa.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjMedusa.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusaSister = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "MedusaSister";
this[l_mcElement._name] = new ObjMedusaSister(l_mcElement, Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusaSister.push(l_mcElement._name);
}
};
ObjMedusaSister.prototype.UpdateSister = function (SisterID) {
with (this) {
if (CurrentSister == SisterID) {
mc[SisterID].gotoAndStop(CurrentAction);
} else {
mc[SisterID].gotoAndStop("Idle");
}
}
};
ObjMedusaSister.prototype.UpdatePosition = function () {
with (this) {
var l_maxOffset = 70;
var l_posX = Math.abs(_parent.Control.Bg.PosX);
mc._x = -((l_posX / 450) * l_maxOffset);
mc._y = mc._y + (_global.MoveY / 2.5);
if (mc._y < 145) {
mc._y = 145;
}
}
};
ObjMedusaSister.prototype.UpdateAttack = function () {
with (this) {
if ((CurrentAction == "Idle") && (!MedusaAttack)) {
if ((++AttackDelayCount) == AttackDelay) {
if (CurrentSister == "SisterLeft") {
CurrentSister = "SisterRight";
} else {
CurrentSister = "SisterLeft";
}
CurrentAction = "Charge";
AttackDelayCount = 0;
}
} else if (CurrentAction == "Charge") {
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
var PersY = Math.abs(_global.Game.Pers.PosY);
switch (true) {
case PersY < 100 :
CurrentAction = "Attack3";
break;
case PersY < 250 :
CurrentAction = "Attack2";
break;
case PersY >= 250 :
CurrentAction = "Attack1";
}
}
} else if (((CurrentAction == "Attack1") || (CurrentAction == "Attack2")) || (CurrentAction == "Attack3")) {
if (mc[CurrentSister].Etat._currentframe == 9) {
if ((Pers.Etat != "Activate") && (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Pers))) {
Pers.Etat = "Hurt";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna1)) {
_global.Game.Antenna1.Etat = "Charged";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna2)) {
_global.Game.Antenna2.Etat = "Charged";
}
}
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
CurrentAction = "Idle";
if (CurrentSister == "SisterRight") {
MedusaAttack = true;
G_Medusa.HasAttacked = false;
}
}
}
if (!MedusaAttack) {
G_Medusa.AttackDelayCount = 0;
} else if (G_Medusa.HasAttacked) {
MedusaAttack = false;
}
}
};
ObjMedusaSister.prototype.Actions = function () {
with (this) {
UpdatePosition();
UpdateAttack();
UpdateSister("SisterLeft");
UpdateSister("SisterRight");
}
};
CreerWall = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjWall(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabWall.push(l_mcElement._name);
}
};
ObjWall.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjWall.prototype.Idle = function () {
with (this) {
CheckHurt();
CheckSleep();
}
};
ObjWall.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrRemoveWallHit) {
_parent.Collider.Wall[Nom].removeMovieClip();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Out";
}
}
};
ObjWall.prototype.CheckHurt = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjWall.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjWall.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjWall.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjWall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.wall.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.wall.gotoAndStop(G_CurrentLevel);
}
};
ObjWall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerDragonObstacle = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjDragonObstacle(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabDragonObstacle.push(l_mcElement._name);
}
};
ObjDragonObstacle.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjDragonObstacle.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjDragonObstacle.prototype.Hit = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.HitBoss = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 4) {
_global.Game.Web.Etat = "Fall";
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.Fall = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == (_parent.Bg[1][Nom].Obj.Etat._totalframes - 1)) {
G_Medusa.Etat = "Captured";
}
}
};
ObjDragonObstacle.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_parent.Bg[1][Nom].Obj.Etat.stop();
}
}
};
ObjDragonObstacle.prototype.CheckHit = function () {
with (this) {
if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitTop) || (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitBottomFront)))) {
Pers.Etat = "Hurt";
Etat = "Hit";
Pers.InvincibleEnd();
Pers.MoveY = 40;
}
}
};
ObjDragonObstacle.prototype.CheckActif = function () {
with (this) {
if (_global.boss || (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep"))) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjDragonObstacle.prototype.CheckSleep = function () {
with (this) {
if (((((!_global.boss) && (PosX < (Bg.InvPosX - LgOutG))) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjDragonObstacle.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjDragonObstacle.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjDragonObstacle.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerAntenna = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjAntenna(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabAntenna.push(l_mcElement._name);
}
};
ObjAntenna.prototype.Idle = function () {
with (this) {
CheckHit();
}
};
ObjAntenna.prototype.Charged = function () {
with (this) {
CheckHit();
if ((++ChargedCount) == ChargedDelay) {
Etat = "Idle";
ChargedCount = 0;
}
}
};
ObjAntenna.prototype.CheckHit = function () {
with (this) {
if ((G_Medusa.CurrentSparkID != null) && (Pers.Etat != "Hurt")) {
if (_parent.Bg[1][Nom].Obj.Hit.hitTest(_parent.Bg[1][G_Medusa.CurrentSparkID])) {
Etat = "Charged";
ChargedCount = 0;
if ((_global.level == 1) && (_global.Game.Web.Etat != "Fall")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Web.Etat = "Fall";
_global.HUD.increaseScore(1000);
}
if ((((_global.level == 2) && (_global.Game.Antenna1.Etat == "Charged")) && (_global.Game.Antenna2.Etat == "Charged")) && (_global.Game.Wire.Etat != "HitBoss")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Wire.Etat = "HitBoss";
_global.HUD.increaseScore(2000);
}
}
}
}
};
ObjAntenna.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjAntenna.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if (Etat == "Charged") {
_global.Snd.playSound("antenna", 250, 1, false);
}
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjAntenna.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerBonus = function (type, l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBonus(type, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabBonus.push(l_mcElement._name);
}
};
ObjBonus.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjBonus.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBonus.prototype.CheckHit = function () {
with (this) {
if (((Pers.ICharacter == 0) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj))) || ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.Hit)))) {
switch (Type) {
case "Score" :
_global.Score = _global.Score + 500;
_global.Snd.playSound("energy", 200, 1, false);
_global.HUD.increaseScore(500);
break;
case "Life" :
if (_global.lives < 3) {
_global.lives++;
}
_global.Snd.playSound("life", 200, 1, false);
_global.HUD.increaseScore(200);
break;
case "Energy" :
_global.energy = _global.energy + 50;
if (_global.energy > 100) {
_global.energy = 100;
}
_global.Snd.playSound("bonus", 300, 1, false);
_global.HUD.increaseScore(200);
break;
case "Power" :
_global.dragonPower = 100;
_global.Snd.playSound("power", 300, 1, false);
_global.HUD.increaseScore(200);
}
KillBonus();
}
}
};
ObjBonus.prototype.KillBonus = function () {
with (this) {
G_TabBonus.splice(BonusI, 1);
BonusI = BonusI - 1;
delete _parent.Control[Nom];
_parent.Bg[1][Nom].swapDepths(90210);
_parent.Bg[1][Nom].removeMovieClip();
}
};
ObjBonus.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
Etat = "Idle";
}
}
};
ObjBonus.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjBonus.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjBonus.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
CheckKill();
}
}
};
this.cnt = 0;
this.G_CurrentLevel = _global.level;
switch (G_CurrentLevel) {
case 1 :
this.G_MaxEnemyHit = 28;
break;
case 2 :
this.G_MaxEnemyHit = 28;
break;
case 3 :
this.G_MaxEnemyHit = 38;
}
G_MaxEnemyHitCount = 0;
this.G_Pause = true;
this.G_PauseOut = false;
this.G_PRealese = true;
this.G_Resume = false;
this.G_TabBox = new Array();
this.G_TabSwitch = new Array();
this.G_TabDoor = new Array();
this.G_TabElevator = new Array();
this.G_TabPersBall = new Array();
this.G_TabLevier = new Array();
this.G_TabLadder = new Array();
this.G_TabChair = new Array();
this.G_TabHuntSoldier = new Array();
this.G_TabHuntWindow = new Array();
this.G_TabMedusa = new Array();
this.G_TabMedusaSister = new Array();
this.G_TabWall = new Array();
this.G_TabDragonObstacle = new Array();
this.G_TabAntenna = new Array();
this.G_TabBonus = new Array();
this.G_NextPersBall = 1;
this.G_NextPersBallDepth = 10000;
this.G_NextMinionBall = 1;
this.G_NextMinionBallDepth = 20000;
this.G_OverlayDepth = 0;
this.G_HuntWindowCurrentA = null;
this.G_HuntActiveSinceA = 0;
this.G_HuntWindowCurrentB = null;
this.G_HuntActiveSinceB = 0;
this.G_AlphaZones = new Array();
this.G_Medusa = null;
this.G_WindowOpenDelay = 20;
this.G_WindowAOpenDelayCount = 0;
this.G_WindowBOpenDelayCount = 0;
this.addAlphaZone = function (mc) {
if (_global.Packaging.bShadowDisabled) {
mc._visible = false;
}
};
this.resetLevel = function () {
_global.dragonPower = 100;
_global.energy = 100;
if (_global.boss) {
_global.resetDestination = "Game_BOSS" + _global.level;
} else {
_global.resetDestination = "Game_LEVEL" + _global.level;
}
_parent._parent.gotoAndStop("Reset");
};
this.bossStart = function () {
_global.boss = true;
_global.resetDestination = "Game_BOSS" + _global.level;
_parent._parent.gotoAndStop("Reset");
};
this.enemyHitScore = function () {
if ((++G_MaxEnemyHitCount) < G_MaxEnemyHit) {
_global.HUD.increaseScore(100);
}
};
this.Creer_PBalcony = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 235);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PRoofTop = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
var pt = new Object();
pt = {x:l_mcElement._x - 5, y:l_mcElement._y + 95};
var mcCeil = _parent.Collider.Ceil;
mcCeil.moveTo(pt.x, pt.y);
mcCeil.beginFill(16711935);
pt.x = pt.x + 115;
pt.y = pt.y - 70;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x + 115;
pt.y = pt.y + 70;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y - 80;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x - 230;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y + 80;
mcCeil.lineTo(pt.x, pt.y);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBalconyOpen = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + (l_mcElement._parent._y + 10);
CreerPlateforme(pt, 235);
if (l_mcElement.flipped) {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01OverlayFlip", {x:pt.x + 32, y:pt.y}, true);
CreerObstacle({x:pt.x + 19, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
} else {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01Overlay", {x:pt.x + 120, y:pt.y + 0.5}, true);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 195, y:pt.y}, 15, 15);
}
_parent.overlay[l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
_parent.Bg[1][l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBox = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 70);
CreerObstacle(pt, 70, 70);
}
};
this.CheckVisible = function () {
if ((this._y < (Bg.InvPosY - Stage.height)) or (this._y > (Bg.InvPosY + Stage.height))) {
this._visible = false;
} else {
this._visible = true;
}
};
this.CreerObstacle = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Wall;
var _local4 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local4.moveTo(pt.x, pt.y);
_local4.beginFill(16711935);
_local4.lineTo(pt.x, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y);
_local4.lineTo(pt.x, pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711680);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerObstacleDragon = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Dragon;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16776960);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerPlateforme = function (pt, l_nWidth) {
var _local3 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711935);
_local3.lineTo(pt.x, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerOverlay = function (id, linkage, pt, bReversed) {
var _local4;
var _local5;
_local5 = _parent.overlay.attachMovie(linkage, id, G_OverlayDepth++);
_local5._x = pt.x;
_local5._y = pt.y;
_local4 = _parent.Bg[1].attachMovie(linkage, id, G_OverlayDepth++);
_local4._x = pt.x;
_local4._y = pt.y;
_local4.overlay = _local5;
if (!bReversed) {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = false;
this.overlay._visible = true;
} else {
this._visible = true;
this.overlay._visible = false;
}
};
} else {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = true;
this.overlay._visible = false;
} else {
this._visible = false;
this.overlay._visible = true;
}
};
}
};
this.replaceTile = function (l_mcElement) {
var _local1 = l_mcElement._name;
var _local2 = 1499;
if (_local1.slice(0, 8) == "instance") {
} else {
l_mcElement._x = 0;
l_mcElement._y = -((Number(_local1) - 1) * _local2);
}
};
this.CreerFloor = function (l_nPosX, l_nPosY, l_nWidth, l_nHeight) {
var mcGround = _parent.Collider.Sol;
with (this) {
pt = new Object();
pt = {x:l_nPosX, y:l_nPosY};
pt.y = pt.y - l_nHeight;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor1 = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -60;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloorBoss = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -88;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 120;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 200;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 300;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 360;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 400;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 440;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor5 = function (l_mcElement) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
}
};
}
onClipEvent (enterFrame) {
BoxI = 0;
for (BoxI in G_TabBox) {
var BoxActif = G_TabBox[BoxI];
if (this[BoxActif].Etat != this[BoxActif].EtatOld) {
this[BoxActif].ChangeEtat(this[BoxActif].Etat);
}
this[BoxActif].Actions();
}
PersBallI = 0;
for (PersBallI in G_TabPersBall) {
var PersBallActif = G_TabPersBall[PersBallI];
if (this[PersBallActif].Etat != this[PersBallActif].EtatOld) {
this[PersBallActif].ChangeEtat(this[PersBallActif].Etat);
}
this[PersBallActif].Actions();
}
LevierI = 0;
for (LevierI in G_TabLevier) {
var LevierActif = G_TabLevier[LevierI];
if (this[LevierActif].Etat != this[LevierActif].EtatOld) {
this[LevierActif].ChangeEtat(this[LevierActif].Etat);
}
this[LevierActif].Actions();
}
LadderI = 0;
for (LadderI in G_TabLadder) {
var LadderActif = G_TabLadder[LadderI];
if (this[LadderActif].Etat != this[LadderActif].EtatOld) {
this[LadderActif].ChangeEtat(this[LadderActif].Etat);
}
this[LadderActif].Actions();
}
ChairI = 0;
for (ChairI in G_TabChair) {
var ChairActif = G_TabChair[ChairI];
if (this[ChairActif].Etat != this[ChairActif].EtatOld) {
this[ChairActif].ChangeEtat(this[ChairActif].Etat);
}
this[ChairActif].Actions();
}
ElevatorI = 0;
for (ElevatorI in G_TabElevator) {
var ElevatorActif = G_TabElevator[ElevatorI];
if (this[ElevatorActif].Etat != this[ElevatorActif].EtatOld) {
this[ElevatorActif].ChangeEtat(this[ElevatorActif].Etat);
}
this[ElevatorActif].Actions();
}
I = 0;
for (HuntSoldierI in G_TabHuntSoldier) {
var HuntSoldierActif = G_TabHuntSoldier[HuntSoldierI];
if (this[HuntSoldierActif].Dir != this[HuntSoldierActif].DirOld) {
this[HuntSoldierActif].ChangeDir(this[HuntSoldierActif].Dir);
}
if (this[HuntSoldierActif].Etat != this[HuntSoldierActif].EtatOld) {
this[HuntSoldierActif].ChangeEtat(this[HuntSoldierActif].Etat);
}
this[HuntSoldierActif].Actions();
}
I = 0;
for (HuntWindowI in G_TabHuntWindow) {
var HuntWindowActif = G_TabHuntWindow[HuntWindowI];
if (this[HuntWindowActif].Dir != this[HuntWindowActif].DirOld) {
this[HuntWindowActif].ChangeDir(this[HuntWindowActif].Dir);
}
if (this[HuntWindowActif].Etat != this[HuntWindowActif].EtatOld) {
this[HuntWindowActif].ChangeEtat(this[HuntWindowActif].Etat);
}
this[HuntWindowActif].Actions();
}
if (!G_Pause) {
if (_global.Game.G_HuntWindowCurrentA == null) {
_global.Game.G_WindowAOpenDelayCount++;
}
if (_global.Game.G_HuntWindowCurrentB == null) {
_global.Game.G_WindowBOpenDelayCount++;
}
}
I = 0;
for (MedusaI in G_TabMedusa) {
var MedusaActif = G_TabMedusa[MedusaI];
if (this[MedusaActif].Dir != this[MedusaActif].DirOld) {
this[MedusaActif].ChangeDir(this[MedusaActif].Dir);
}
if (this[MedusaActif].Etat != this[MedusaActif].EtatOld) {
this[MedusaActif].ChangeEtat(this[MedusaActif].Etat);
}
this[MedusaActif].Actions();
}
I = 0;
for (WallI in G_TabWall) {
var WallActif = G_TabWall[WallI];
if (this[WallActif].Dir != this[WallActif].DirOld) {
this[WallActif].ChangeDir(this[WallActif].Dir);
}
if (this[WallActif].Etat != this[WallActif].EtatOld) {
this[WallActif].ChangeEtat(this[WallActif].Etat);
}
this[WallActif].Actions();
}
I = 0;
for (DragonObstacleI in G_TabDragonObstacle) {
var DragonObstacleActif = G_TabDragonObstacle[DragonObstacleI];
if (this[DragonObstacleActif].Dir != this[DragonObstacleActif].DirOld) {
this[DragonObstacleActif].ChangeDir(this[DragonObstacleActif].Dir);
}
if (this[DragonObstacleActif].Etat != this[DragonObstacleActif].EtatOld) {
this[DragonObstacleActif].ChangeEtat(this[DragonObstacleActif].Etat);
}
this[DragonObstacleActif].Actions();
}
I = 0;
for (AntennaI in G_TabAntenna) {
var AntennaActif = G_TabAntenna[AntennaI];
if (this[AntennaActif].Dir != this[AntennaActif].DirOld) {
this[AntennaActif].ChangeDir(this[AntennaActif].Dir);
}
if (this[AntennaActif].Etat != this[AntennaActif].EtatOld) {
this[AntennaActif].ChangeEtat(this[AntennaActif].Etat);
}
this[AntennaActif].Actions();
}
I = 0;
for (MedusaSisterI in G_TabMedusaSister) {
var MedusaSisterActif = G_TabMedusaSister[MedusaSisterI];
if (this[MedusaSisterActif].Dir != this[MedusaSisterActif].DirOld) {
this[MedusaSisterActif].ChangeDir(this[MedusaSisterActif].Dir);
}
if (this[MedusaSisterActif].Etat != this[MedusaSisterActif].EtatOld) {
this[MedusaSisterActif].ChangeEtat(this[MedusaSisterActif].Etat);
}
this[MedusaSisterActif].Actions();
}
I = 0;
for (BonusI in G_TabBonus) {
var BonusActif = G_TabBonus[BonusI];
if (this[BonusActif].Dir != this[BonusActif].DirOld) {
this[BonusActif].ChangeDir(this[BonusActif].Dir);
}
if (this[BonusActif].Etat != this[BonusActif].EtatOld) {
this[BonusActif].ChangeEtat(this[BonusActif].Etat);
}
this[BonusActif].Actions();
}
if (Pers.Dir != Pers.DirOld) {
Pers.ChangeDir(Pers.Dir);
}
if (Pers.Etat != Pers.EtatOld) {
Pers.setState(Pers.Etat);
}
this.Pers.Actions();
this.Bg.Actions();
_global.HUD.update();
G_CheckPause();
}
Symbol 1393 MovieClip Frame 2
stop();
_global.C.beginLevel();
Instance of Symbol 1392 MovieClip "Bg" in Symbol 1393 MovieClip Frame 2
onClipEvent (load) {
this._x = 0;
this._y = 0;
this.noUpdateCamCount = 0;
this.noUpdateCamDelay = 50;
_parent.Control.CreerBg(_parent._x, _parent._y);
BG = _parent.Control.Bg;
Pers = _global.Game.Pers;
for (var i in _parent.Bg) {
if (Number(_parent.Bg[i]._name) <= 20) {
_parent.Bg[i].gotoAndStop(2);
} else {
_parent.Bg[i].gotoAndStop(3);
}
}
BG.NoCamUpdate = true;
if (_global.level == 1) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -300;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(380, -280, 250, 20);
}
if (_global.level == 2) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -450;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(95, -280, 250, 20);
_parent.Control.CreerFloor(725, -280, 250, 20);
}
if (_global.level == 3) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -450;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(95, -280, 250, 20);
_parent.Control.CreerFloor(725, -280, 250, 20);
}
_parent.Control.CreerFloor(0, -480, 1100, 20);
BG.ParallaxRateSky = 1.1;
BG.ParallaxRateCity = 1.05;
BG.CheckScreen = function () {
with (this) {
MaxDw = MaxDw1;
MaxUp = MaxUp1;
MaxG = MaxG1;
MaxD = MaxD1;
if (BG.NoCamUpdate && ((++noUpdateCamCount) == noUpdateCamDelay)) {
BG.NoCamUpdate = false;
}
}
};
}
Instance of Symbol 1150 MovieClip "Pers" in Symbol 1393 MovieClip Frame 2
onClipEvent (load) {
_parent.Control.CreerPers(this._x, this._y, "Jake");
this.gotoAndStop("D");
_global.Game.Pers.Etat = "Sleep";
_global.Game.Pers.setState("Idle");
}
Instance of Symbol 1154 MovieClip "Collider" in Symbol 1393 MovieClip Frame 2
onClipEvent (load) {
this._visible = 0;
}
Symbol 1406 MovieClip Frame 1
stop();
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "moveable", "G");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "regular", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "regular", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "regular", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "destroyable", "D");
}
Instance of Symbol 1202 MovieClip in Symbol 1406 MovieClip Frame 1
onClipEvent (load) {
_global.Game.CreerBox(this._name, this._x, this._y, "moveable", "D");
}
Symbol 1406 MovieClip Frame 2
_parent._parent.Control.CreerFloorBoss(this, this._x, this._y);
stop();
Symbol 1407 MovieClip Frame 2
stop();
Instance of Symbol 560 MovieClip "Control" in Symbol 1408 MovieClip Frame 1
onClipEvent (load) {
function ObjBg(PosX, PosY) {
this.Nom = "Bg";
this.PosX = PosX;
this.PosY = PosY;
this.ParallaxPosX = 0;
this.ParallaxPosY = 0;
this.ParallaxSkyPosX = 0;
this.ParallaxSkyPosY = 0;
this.ParallaxCityPosX = 0;
this.ParallaxCityPosY = 0;
this.ParallaxRateSky = 1.2;
this.ParallaxRateCity = 1.1;
this.MoveX = 0;
this.MoveY = 0;
this.MaxDw = 0;
this.MaxUp = 0;
this.MaxG = 0;
this.MaxD = 0;
this.InvPosX = PosX * -1;
this.InvPosY = PosY * -1;
this.DeadX = PosX;
this.DeadY = PosY;
this.CurrentScreen = 1;
this.OldScreen = 0;
this.MaxYDie = 5000;
this.CenterX = 300;
this.CenterY = 370;
this.SpdXD = 15;
this.SpdXG = -15;
this.SpdYDw = 20;
this.SpdYUp = -20;
this.SpdYUpForce = 0;
this.InPause = false;
this.NoCamUpdate = false;
this.CamOnMedusa = false;
}
function ObjBox(Nom, PosX, PosY, Type, Dir) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.MoveX = 0;
this.MoveY = 0;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 75;
this.LgOutD = 525;
this.LgOutUp = 25;
this.LgOutDw = 475;
this.LgHitG = 34;
this.LgHitD = 35;
this.LgHitUp = 25;
this.LgHitDw = 26;
this.HitRightX;
this.HitLeftX;
this.PushDir = Dir;
this.Dir = Pers.Dir;
if (Dir == "D") {
_parent.Bg[1][Nom]._xscale = -100;
}
this.FlagUse = false;
this.LandSide = "Center";
this.MinionBlock = 0;
this.Etat = "Wait";
this.EtatOld = "Sleep";
this.FixedFlag = false;
_parent.Collider.Sol.attachMovie("TopBox", Nom, _parent.Collider.Sol.getNextHighestDepth());
_parent.Collider.Wall.attachMovie("BorderBox", Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Ceil.attachMovie("BottomBox", Nom, _parent.Collider.Ceil.getNextHighestDepth());
this.frTurn = 20;
this.SoundPush = false;
this.WebDestroyed = false;
this.MoveBox();
}
function ObjPers(PosX, PosY, Perso) {
this.nGetHitLeft = 0;
this.nGetHitRight = 0;
this.nGetHitTop = 0;
this.Nom = "Pers";
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.DirOld = "D";
this.Point = _global.C.Score;
this.Life = _global.C.Life;
this.SpdXMinion = 3;
this.SpdXNormal = 15;
this.SpdXBase = this.SpdXNormal;
this.SpdXNow = 0;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.FrontX = 0;
this.FrontY = 0;
this.BottomFrontX = 0;
this.BottomBackX = 0;
this.BackX = 0;
this.HitGrdPoint = 0;
this.WallHitBloc = 2;
this.SpdYNow = 0;
this.SpdYUpBase = 1.7;
this.SpdYUp = this.SpdYUpBase;
this.SpdYMax = 30;
this.SpdYFall = 2.2;
this.SpdYFly = 5;
this.SpdXHitBase = 0;
this.SpdYHitBase = -4;
this.SpdStartJump = -17;
this.SolOut = 2;
this.SolHitMin = 5;
this.MaxSol = 3;
this.HitGrd = false;
this.SolForJump = 6;
this.DistYFall = 0;
this.DistYFallMax = 900;
this.autoSwitchDragon = false;
this.DistYLand = 80;
this.CanHit = false;
this.CanBeHit = true;
this.FrWalkNow = 1;
this.InPause = false;
this.FrJump = 1;
this.FrFall = 1;
this.FrLand = 13;
this.FrGetHit = 7;
this.FrGetHitCount = 0;
this.FrBoomTir = 9;
this.FrFinBoom = 6;
this.FrDead = 20;
this.FrDeadCount = 0;
this.aCharacter = ["Jake", "Dragon"];
this.ICharacter = 0;
this.Perso = this.aCharacter[this.ICharacter];
this.updatePerso();
this.LgGetShootX = 20;
this.LgGetShootUp = 72;
this.LgGetShootUpBas = 44;
this.FrInvincibleCount = 0;
this.FrInvincible = 20;
this.Invincible = false;
this.FrSwitchCharacter = 15;
this.FrSwitchCharacterCount = 0;
this.bCanSwitch = true;
this.bJumpRelease = true;
this.SpdXBaseJumpKick = 20;
this.bComboCheck = false;
this.nFrDelayCombo = 15;
this.nFrDelayComboCount = 0;
this.bCanAttack = true;
this.bAttackRelease = true;
this.bSkipDie = false;
this.mcHitGetHurt = null;
this.HitPointX = 0;
this.HitPointY = 0;
this.nDragonPowerRythm = 25;
this.nDragonPowerCount = 0;
this.DragonHitTop = 0;
this.DragonHitBottom = 0;
this.DragonHeight = 130;
this.onLadderID = null;
this.ClimbedDistance = 0;
this.ladderDisabledMax = 15;
this.ladderDisabledCount = this.ladderDisabledMax;
this.onBouncingID = null;
this.bounceCount = 0;
this.bounceCountMax = 3;
this.bouncingDisabledMax = 15;
this.bouncingDisabledCount = this.bouncingDisabledMax;
this.bHitAttack = false;
this.FrShootFire = 15;
this.FrAttackTailHit = 9;
this.CurrentFireID = null;
if (_global.boss) {
this.WaitForActions = true;
} else {
this.WaitForActions = false;
}
}
function ObjPersBall(Type, Nom, PosX, PosY, Dir, HitBullet, Speed, Tab, HitSound, Rotation, SpdX, SpdY) {
this.Nom = Nom;
this.Type = Type;
this.HitSound = HitSound;
this.Tab = Tab;
this.Etat = "Move";
this.EtatOld = "Idle";
this.Dir = Dir;
this.OldDir = "D";
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.LgOutG = 50;
this.LgOutD = 600;
this.LgOutUp = 0;
this.LgOutDw = 500;
this.CanBeKill = false;
if (Dir == "D") {
this.SpdX = Speed;
} else {
this.SpdX = -1 * Speed;
_parent.Bg[1][Nom]._xscale = -100;
}
this.InPause = false;
this.FrHit = HitBullet;
this.FrHide = 1;
if (Type == "Fire") {
Pers.CurrentFireID = Nom;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = Nom;
this.LgOutG = 1100;
this.LgOutD = 1100;
_parent.Bg[1][Nom]._xscale = -100;
_parent.Bg[1][Nom]._rotation = Rotation;
this.SpdX = SpdX;
this.SpdY = SpdY;
}
}
function ObjSwitch(Nom, PosX, PosY) {
this.Nom = Nom;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 20;
this.LgOnY = 20;
this.PosX = PosX;
this.PosY = PosY;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrBaisse = 13;
}
function ObjElevator(mc, Axis, Min, Max) {
this.Nom = mc._name;
this.mc = mc;
this.Etat = "Sleep";
this.EtatOld = "Sleep";
this.LgOutD = 750;
this.LgOutG = 200;
this.LgOutUp = 500;
this.LgOutDw = 900;
this.Speed = 2;
this.frWaitCount = 0;
this.frWaitTime = 30;
this.LgOnX = 200;
this.LgOnY = 25;
this.PersOn = false;
this.MoveX = 0;
this.MoveY = 0;
this.PosX = mc._x + 40;
this.PosY = mc._y + 140;
this.Axis = Axis;
this.Min = this["Pos" + Axis] + Min;
this.Max = this["Pos" + Axis] + Max;
this.Active = false;
this.InPause = false;
this.Dir = -1;
this.CanReposition = false;
this.RepositionCount = 0;
this.RepositionDelay = 30;
_parent.Collider.Sol.attachMovie("GroundElevator", this.Nom, _parent.Collider.Sol.getNextHighestDepth());
_global.Game.CreerOverlay(mc._name + "ramp", "AM_RampeAscenseur01_overlay", {x:mc._x, y:mc._y + 140});
this.MoveElevator();
}
function ObjLevier(Nom, PosX, PosY, listener) {
this.Nom = Nom;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutD = 542;
this.LgOutG = 42;
this.LgOutUp = 15;
this.LgOutDw = 450;
this.LgOnX = 30;
this.LgOnY = 100;
this.PosX = PosX;
this.PosY = PosY;
this.PersYCorrection = 60;
this.FlagUse = false;
this.FlagBoxUse = false;
this.InPause = false;
this.FrFinLevelCount = 0;
this.FrFinLevel = 70;
this.Active = true;
this.listener = listener;
}
function pointsGetAngle(l_x1, l_y1, l_x2, l_y2) {
var _local4 = 0;
var _local3 = 0;
var _local1 = 0;
var _local2 = 0;
_local4 = (l_x1 - l_x2) * -1;
_local3 = (l_y1 - l_y2) * -1;
_local1 = Math.atan2(_local3, _local4);
_local1 = (_local1 * 180) / Math.PI;
if (_local1 < 0) {
_local1 = _local1 * -1;
_local2 = 180 - _local1;
_local1 = 180 + _local2;
}
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
function pointsGetDistance(l_x1, l_y1, l_x2, l_y2) {
var _local1 = Math.sqrt(Math.pow(Math.abs(l_x2 - l_x1), 2) + Math.pow(Math.abs(l_y2 - l_y1), 2));
return(_local1);
}
function ObjLadder(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.obj;
this.Etat = "Off";
this.EtatOld = "Off";
this.LgOnX = 70;
this.LgOnY = 265;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
}
function ObjBouncingChair(l_mcElement) {
this.Nom = l_mcElement._name;
this.mc = l_mcElement.Obj;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOnX = 70;
this.LgOnY = 50;
this.PosX = l_mcElement._x;
this.PosY = l_mcElement._y;
this.InPause = false;
_global.Game.CreerPlateforme({x:this.PosX, y:this.PosY}, 73);
}
function ObjHuntSoldier(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 115;
this.AttackDelayCount = 0;
this.AttackChance = 0.03;
this.ShieldChance = 0.25;
this.HurtCount = 0;
}
function ObjHuntWindow(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "IdleClose";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 450;
this.LgOutDw = 450;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.AttackDelay = 100;
this.AttackDelayCount = 0;
if (PosX < 150) {
this.HuntID = "A";
this.FlipPosition = 20;
} else {
this.HuntID = "B";
this.FlipPosition = -20;
}
this.OpenRangeDown = 450;
this.OpenRangeUp = -20;
this.OpenChanceDragon = 0.85;
this.OpenChanceJake = 0.1;
this.HuntEtat = "idle";
this.AttackDelay = 100;
this.AttackDelayCount = 0;
this.AttackChance = 0.85;
this.FlipDelay = 10;
this.FlipDelayCount = 0;
this.CloseDelay = 100;
this.closeDelayCount = 0;
this.CloseChance = 0.5;
this.FrThrow = 11;
}
function ObjMedusa(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Perso = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -60;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSparkID = null;
this.HasAttacked = false;
G_Medusa = this;
_global.Medusa = this;
}
function ObjMedusaSister(mc, Type, Nom, PosX, PosY) {
this.mc = mc;
this.Nom = Nom;
this.Perso = Type;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
this.AttackDelay = 20;
this.AttackDelayCount = -110;
this.AttackChance = 1;
this.FrPrepareAttack = 35;
this.FrAttack = 63;
this.NextAttackRotation = 0;
this.NextAttackSpdX = 0;
this.NextAttackSpdY = 0;
this.CurrentSister = "SisterRight";
this.CurrentAction = "Idle";
this.MedusaAttack = false;
}
function ObjWall(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.TooNearWall = false;
this.DistMinWall = 100;
_parent.Collider.Wall.attachMovie("WallHit", this.Nom, _parent.Collider.Wall.getNextHighestDepth());
_parent.Collider.Wall[Nom]._x = PosX;
_parent.Collider.Wall[Nom]._y = PosY;
this.FrRemoveWallHit = 4;
}
function ObjDragonObstacle(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Sleep";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
}
function ObjAntenna(Nom, PosX, PosY) {
this.Nom = Nom;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.Dir = "D";
this.OldDir = Dir;
this.BaseDir = Dir;
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.GetHitG = 50;
this.GetHitD = 50;
this.GetHitUp = 115;
this.GetHitDw = 0;
this.LgCheckPersX = 500;
this.LgCheckFightX = 100;
this.LgHitX = 60;
this.LgHitUp = 35;
this.LgHitDw = 60;
this.LgFront = 35;
this.LgHitBox = 42;
this.LgCharge = 65;
this.LgBack = 35;
this.AssPointX = 12;
this.AssPointY = 35;
this.Life = 2;
this.InPause = false;
this.ChargedDelay = 300;
this.ChargedCount = 0;
}
function ObjBonus(Type, Nom, PosX, PosY) {
this.Nom = Nom;
this.Type = Type;
this.PosX = PosX;
this.PosY = PosY;
this.TrueX = PosX;
this.TrueY = PosY;
this.Etat = "Idle";
this.EtatOld = "Idle";
this.LgOutG = 0;
this.LgOutD = 550;
this.LgOutUp = 400;
this.LgOutDw = 400;
this.CanBeKill = false;
}
_global.Game = this;
this.KeyListener = new com.sarbakan.utils.KeyManager();
KeyListener.addKeyListener(39, "R");
KeyListener.addKeyListener(37, "L");
KeyListener.addKeyListener(40, "Dw");
KeyListener.addKeyListener(38, "Up");
KeyListener.addKeyListener(32, "Dragon");
KeyListener.addKeyListener(66, "Attack");
KeyListener.addKeyListener(78, "Action");
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
G_CheckPause = function () {
if ((Pers.Etat != "Die") and (Pers.Etat != "Dead")) {
if (G_PauseOut && (!G_Pause)) {
G_Pause = true;
_parent.ControlBall.stop();
_parent._parent.Popup.gotoAndStop("Pause");
if (_global.C.SoundActive) {
_global.SoundCTRL.muteAllSounds();
}
_global.C.DesactivateHud();
} else if ((G_Resume == true) and (G_Pause == true)) {
G_PauseOut = false;
Selection.setFocus(_parent._parent.FocusBtn);
G_CurrentFocus = Selection.getFocus();
KeyListener.Up = false;
KeyListener.UpRelease = true;
KeyListener.Dw = false;
KeyListener.L = false;
KeyListener.R = false;
KeyListener.X = false;
KeyListener.Z = false;
KeyListener.Sp = false;
Music.VolDest = 70;
Music.Etat = "FadeIn";
G_Pause = false;
G_Resume = false;
_parent._parent.Popup.gotoAndStop(1);
if (_global.C.SoundActive) {
_global.SoundCTRL.unmuteAllSounds();
}
_global.C.ActivateHud();
if (_parent.ControlBall._currentframe != 1) {
_parent.ControlBall.play();
}
}
}
};
CreerBg = function (PosX, PosY) {
this.Bg = new ObjBg(PosX, PosY);
};
ObjBg.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
CheckScreen();
if (!NoCamUpdate) {
ScrollBg();
}
}
}
};
ObjBg.prototype.ScrollBg = function () {
with (this) {
if (CamOnMedusa) {
Pers.TrueX = _global.Medusa.TrueX;
Pers.TrueY = _global.Medusa.TrueY;
}
if ((PosY <= MaxDw) and (PosY >= MaxUp)) {
if (Pers.TrueX > (CenterX + 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else {
if ((CenterX - Pers.TrueX) > SpdXG) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXG;
}
if ((PosX + MoveX) < MaxG) {
MoveX = MaxG - PosX;
}
}
} else if (Pers.TrueX < (CenterX - 1)) {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
} else {
if ((CenterX - Pers.TrueX) < SpdXD) {
MoveX = CenterX - Pers.TrueX;
} else {
MoveX = SpdXD;
}
if ((PosX + MoveX) > MaxD) {
MoveX = MaxD - PosX;
}
}
} else {
if ((Pers.HitGrd == false) and (Pers.TrueY >= 300)) {
SpdXG = -30;
SpdXD = 30;
} else if (Pers.SpdXNow > 0) {
SpdXG = (Pers.SpdXNow * -1) - 5;
} else if (Pers.SpdXNow < 0) {
SpdXD = (Pers.SpdXNow * -1) + 5;
} else {
SpdXG = -8;
SpdXD = 8;
}
if (PosX < MaxG) {
if ((PosX + SpdXD) > MaxG) {
MoveX = MaxG - PosX;
} else {
MoveX = SpdXD;
}
} else if (PosX > MaxD) {
if ((PosX + SpdXG) < MaxD) {
MoveX = MaxD - PosX;
} else {
MoveX = SpdXG;
}
}
}
}
if ((PosX <= MaxD) and (PosX >= MaxG)) {
if (Pers.TrueY > (CenterY + 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxUp - PosY;
} else {
MoveY = SpdYDw;
}
} else {
if ((CenterY - Pers.TrueY) > SpdYUp) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYUp;
}
if ((PosY + MoveY) < MaxUp) {
MoveY = MaxUp - PosY;
}
}
} else if (Pers.TrueY < (CenterY - 1)) {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
} else {
if ((CenterY - Pers.TrueY) < SpdYDw) {
MoveY = CenterY - Pers.TrueY;
} else {
MoveY = SpdYDw;
}
if ((PosY + MoveY) > MaxDw) {
MoveY = MaxDw - PosY;
}
}
} else {
if (Pers.SpdYNow > 0) {
SpdYUp = (Pers.SpdYNow * -1) - 5;
} else if (Pers.SpdYNow < 0) {
SpdYDw = (Pers.SpdYNow * -1) + 5;
} else {
SpdYUp = -5;
SpdYDw = 5;
}
if (SpdYUpForce != 0) {
SpdYUp = SpdYUpForce;
}
if (PosY < MaxUp) {
if ((PosY + SpdYDw) > MaxUp) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYDw;
}
} else if (PosY > MaxDw) {
if ((PosY + SpdYUp) < MaxDw) {
MoveY = MaxDw - PosY;
} else {
MoveY = SpdYUp;
}
}
}
}
_parent._x = Math.floor(_parent._x + MoveX);
PosX = _parent._x;
InvPosX = PosX * -1;
MoveX = 0;
_parent._y = Math.floor(_parent._y + MoveY);
PosY = _parent._y;
InvPosY = PosY * -1;
_global.MoveY = MoveY;
MoveY = 0;
_parent.ParallaxSky._y = (Math.floor(_parent._y / (-ParallaxRateSky)) + 350) + 30;
ParallaxSkyPosY = _parent.ParallaxSky._y;
_parent.ParallaxCity._y = (Math.floor(_parent._y / (-ParallaxRateCity)) + 140) + 30;
ParallaxCityPosY = _parent.ParallaxCity._y;
}
};
CreerBox = function (Nom, PosX, PosY, Type, Dir) {
if (this[Nom] == null) {
this[Nom] = new ObjBox(Nom, PosX, PosY, Type, Dir);
G_TabBox.push(Nom);
}
};
ObjBox.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBox.prototype.Wait = function () {
with (this) {
if (Type == "moveable") {
CheckPush();
}
CheckHitGrd();
CheckSleep();
CheckFall();
if (Type == "destroyable") {
CheckDestroy();
}
}
};
ObjBox.prototype.Fall = function () {
with (this) {
CheckHitGrd();
SetSpdFall();
MoveBox();
if (((Nom == "BoxDestroyWeb") && (!WebDestroyed)) && (TrueY > 350)) {
_global.Game.WebDestroyable.Etat = "Destroy";
WebDestroyed = true;
}
}
};
ObjBox.prototype.Land = function () {
with (this) {
CheckHitGrd();
SetSpdLand();
MoveBox();
if ((TrueX > 0) && (TrueX < 500)) {
_global.SoundCTRL.playSound("BoxLand", 100, 0);
}
}
};
ObjBox.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe >= _parent.Bg[1][Nom].Etat._totalframes) {
_parent.Bg[1][Nom].Etat.stop();
_parent.Collider.Sol[Nom].removeMovieClip();
_parent.Collider.Ceil[Nom].removeMovieClip();
_parent.Collider.Wall[Nom].removeMovieClip();
}
}
};
ObjBox.prototype.LandFin = function () {
with (this) {
Etat = "Wait";
Pers.PushedBox = 0;
}
};
ObjBox.prototype.Fixed = function () {
with (this) {
CheckSleep();
}
};
ObjBox.prototype.CheckPush = function () {
with (this) {
if (Pers.Etat == "Push") {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.PushPoint)) {
Dir = Pers.Dir;
if (Dir == "D") {
this.MoveX = 2;
} else if (Dir == "G") {
this.MoveX = -2;
}
CheckWall();
if (Pers.Dir != PushDir) {
MoveX = 0;
}
MoveBox();
Pers.PushedBox = this;
if (MoveX != 0) {
_global.Snd.playSound("push", 100, 999, true);
}
}
} else {
_global.Snd.stopSound("push");
}
}
};
ObjBox.prototype.CheckDestroy = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjBox.prototype.CheckHitGrd = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (_parent.Collider.Sol.hitTest(HitX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitRightX, HitY, true)) {
HitGrd = true;
} else if (_parent.Collider.Sol.hitTest(HitLeftX, HitY, true)) {
HitGrd = true;
} else {
HitGrd = false;
}
}
};
ObjBox.prototype.SetSpdFall = function () {
with (this) {
MaxMoveY = 15;
MoveY = MoveY + 5;
if (MoveY > MaxMoveY) {
MoveY = MaxMoveY;
}
aCheckPoint = [TrueX, HitLeftX, HitRightX];
for (CheckPointI in aCheckPoint) {
var activePointX = aCheckPoint[CheckPointI];
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 2), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
if (_parent.Collider.Sol.hitTest(activePointX, TrueY + (MoveY / 4), true)) {
MoveY = 5;
while (_parent.Collider.Sol.hitTest(activePointX, TrueY + MoveY, true)) {
MoveY--;
}
Etat = "Land";
break;
}
}
}
};
ObjBox.prototype.SetSpdLand = function () {
with (this) {
while ((_parent.Collider.Sol.hitTest(TrueX, TrueY + MoveY, true) || (_parent.Collider.Sol.hitTest(HitLeftX, TrueY + MoveY, true))) || (_parent.Collider.Sol.hitTest(HitRightX, TrueY + MoveY, true))) {
MoveY--;
}
if (MoveY < 1) {
MoveY = 1;
Etat = "LandFin";
}
}
};
ObjBox.prototype.CheckFall = function () {
with (this) {
if (HitGrd == true) {
MoveY = 0;
Etat = "Wait";
} else {
Etat = "Fall";
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
MoveX = 0;
MoveY = 0;
}
}
};
ObjBox.prototype.CheckWall = function () {
with (this) {
var HitX = TrueX;
var HitY = TrueY;
if (Pers.Dir == "G") {
HitX = HitX + (MoveX - LgHitG);
} else if (Pers.Dir == "D") {
HitX = HitX + (MoveX + LgHitD);
}
if (_parent.Collider.Wall.hitTest(HitX, HitY, true)) {
MoveX = 0;
if (SoundPush) {
_global.SoundCTRL.fadeOutSound("BoxPushed");
SoundPush = false;
}
}
}
};
ObjBox.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjBox.prototype.MoveBox = function () {
with (this) {
PosX = Number(PosX + MoveX);
PosY = Number(PosY + MoveY);
_parent.Bg[1][Nom]._x = PosX;
_parent.Bg[1][Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY - 15;
_parent.Collider.Wall[Nom]._x = PosX + 30;
_parent.Collider.Wall[Nom]._y = PosY + 4;
_parent.Collider.Ceil[Nom]._x = PosX;
_parent.Collider.Ceil[Nom]._y = PosY + 40;
}
};
ObjBox.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (FixedFlag) {
Etat = "Fixed";
} else {
Etat = "Wait";
}
}
}
};
ObjBox.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = (PosY + _parent._y) + LgHitDw;
HitRightX = TrueX + LgHitD;
HitLeftX = TrueX - LgHitG;
}
};
ObjBox.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if ((NewAction == "Turn") || (NewAction == "Fixed")) {
_parent.Bg[1][Nom].gotoAndStop(NewAction + Dir);
} else {
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
_parent.Bg[1][Nom].Etat.box.gotoAndStop(Type);
_parent.Bg[1][Nom].Etat.box.box.gotoAndStop(Type);
}
};
ObjBox.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
}
} else {
if (InPause == true) {
InPause = false;
}
SetTruePos();
this[Etat]();
}
}
};
ObjPers.prototype.IdleJake = function () {
with (this) {
DistYFall = 0;
KeepDeadPos = true;
bCanAttack = true;
if (Life > 0) {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckPush();
CheckJump();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusJake = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.RunJake = function () {
with (this) {
bCanAttack = true;
DistYFall = 0;
SetSpdXJake();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckJump();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartJake = function () {
with (this) {
Pers.bouncingDisabledCount = 0;
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallJake = function () {
with (this) {
SetSpdXJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
} else if (DistYFall >= DistYFallMax) {
autoSwitchDragon = true;
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingJake = function () {
with (this) {
CheckGetFire();
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (!_global.Game[onBouncingID].CheckPersOn()) {
bounceCount = 0;
Pers.onBouncingID = null;
}
if (_parent.Pers.Obj.Etat._currentframe >= 3) {
if (_global.energy <= 0) {
_global.energy = 0;
Etat = "Die";
}
}
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.ClimbingJake = function () {
with (this) {
SpdXNow = 0;
SpdYNow = 0;
CheckHitGrd();
if ((Pers.ClimbedDistance > 30) && (HitGrd)) {
Etat = "Idle";
Pers.ladderDisabledCount = 0;
} else if (KeyListener.Action) {
Etat = "Fall";
} else {
if (KeyListener.L) {
SpdXNow = -2;
} else if (KeyListener.R) {
SpdXNow = 2;
}
if (KeyListener.Up) {
SpdYNow = -3;
} else if (KeyListener.Dw) {
SpdYNow = 3;
}
SetMoveX();
SetMoveY();
CheckWall(FrontX, FrontY - 15);
CheckWall(BackX, FrontY - 15);
CheckWall(FrontX, FrontY);
CheckWall(BackX, FrontY);
CheckWall(FrontX, FrontY + 15);
CheckWall(BackX, FrontY + 15);
CheckWall(FrontX, FrontY + 30);
CheckWall(BackX, FrontY + 30);
CheckWall(FrontX, FrontY + 45);
CheckWall(BackX, FrontY + 45);
MovePers();
Pers.ClimbedDistance++;
}
if ((SpdXNow != 0) || (SpdYNow != 0)) {
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
_parent.Pers.Obj.Etat.gotoAndStop(1);
} else {
_parent.Pers.Obj.Etat.nextFrame();
}
} else {
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.ActivateJake = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckGetFire();
CheckDie();
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.HurtJake = function () {
with (this) {
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetJake = function () {
with (this) {
CheckHitGrd();
if (HitGrd) {
Etat = "Idle";
} else {
Etat = "Fall";
}
FrGetHitCount = 0;
InvincibleInit();
}
};
ObjPers.prototype.AttackJake = function () {
with (this) {
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe == Math.round(_parent.Pers.Obj.Etat._totalframes / 2)) {
bHitAttack = true;
} else {
bHitAttack = false;
}
if (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjPers.prototype.GetHitJake = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireJake = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformJake = function () {
with (this) {
DistYFall = 0;
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 1;
Etat = "Idle";
nDragonPowerCount = 0;
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.PushJake = function () {
with (this) {
CheckHitGrd();
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (!KeyListener.Action) {
Etat = "Idle";
} else if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (PushedBox != 0) {
MoveX = PushedBox.MoveX;
} else {
MoveX = 0;
}
} else {
var AddBlock = (35 * NumDir);
var i = 0;
while (i != AddBlock) {
if (_parent.Collider.Wall.hitTest(PushPointX + i, PushPointY, true)) {
goToTarget = true;
if (((i > 5) && (NumDir == 1)) || ((i < -5) && (NumDir == -1))) {
MoveX = 5 * NumDir;
} else {
MoveX = i;
}
break;
}
i = i + NumDir;
}
}
MovePers();
}
};
ObjPers.prototype.TransformFallJake = ObjPers.prototype.TransformJake;
ObjPers.prototype.DieJake = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
if (FrDeadCount == 0) {
_global.lives--;
_global.Snd.stopSound("lift");
_global.Snd.stopSound("push");
if (_global.lives == 0) {
_global.Packaging.showLoseScreen();
} else {
_global.HUD.fade(resetLevel);
}
}
FrDeadCount++;
}
}
};
ObjPers.prototype.SleepJake = function () {
};
ObjPers.prototype.IdleDragon = function () {
with (this) {
bCanAttack = true;
KeepDeadPos = true;
if (Life > 0) {
SetSpdDragon();
SetMoveX();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
} else {
SetSpdDragon();
SetMoveX();
CheckWall(FrontX, FrontY);
CheckHitGrd();
CheckSol();
CheckFall();
MovePers();
CheckDie();
}
}
};
ObjPers.prototype.GetLifeBonusDragon = function (AddPoints) {
with (this) {
newTotalPoint = Point + AddPoints;
if (Math.floor(newTotalPoint / 1000) > Math.floor(Point / 1000)) {
if (Life < 5) {
Life++;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
}
}
Point = newTotalPoint;
_parent._parent.Hud.BonusPoints.text = Point;
_parent._parent.Hud.BonusPointsShadow.text = Point;
}
};
ObjPers.prototype.FlyDragon = function () {
with (this) {
bCanAttack = true;
SetSpdDragon();
SetMoveX();
SetMoveY();
CheckDragonObstacle();
CheckWall(FrontX, FrontY);
CheckCeilDragon();
CheckSolDragon();
CheckGroundDragon();
MovePers();
this["CheckAttack" + Perso]();
CheckGetFire();
CheckDie();
}
};
ObjPers.prototype.JumpStartDragon = function () {
with (this) {
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
CheckGetFire();
MovePers();
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
}
}
};
ObjPers.prototype.JumpIdleDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
CheckCeil();
MovePers();
this["CheckAttack" + Perso]();
if (HitGrd == true) {
Etat = "Land";
} else if (SpdYNow >= 0) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.FallDragon = function () {
with (this) {
SetSpdDragonJump();
SetMoveX();
CheckGetFire();
CheckWall(FrontX, FrontY);
CheckWall(BottomFrontX, TrueY);
CheckWall(FrontX, TopY);
CheckHitGrd();
CheckSol();
MovePers();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe == nFrTotalAnim) {
_parent.Pers.Obj.Etat.stop();
}
if (HitGrd == true) {
if ((DistYFall >= DistYLand) || (Math.abs(SpdXNow) < 5)) {
Etat = "JumpLanding";
SpdXNow = 0;
MoveX = 0;
} else {
Etat = "Run";
}
}
CheckHole();
}
};
ObjPers.prototype.JumpLandingDragon = function () {
with (this) {
CheckGetFire();
this["CheckAttack" + Perso]();
if (_parent.Pers.Obj.Etat._currentframe >= this.nFrTotalAnim) {
if (Life <= 0) {
Etat = "Die";
} else {
Etat = "Idle";
}
}
}
};
ObjPers.prototype.HurtDragon = function () {
with (this) {
MovePers();
if (FrGetHitCount == 0) {
_global.energy = _global.energy - 8;
if (_global.energy < 0) {
_global.energy = 0;
}
}
if (FrGetHitCount >= FrGetHit) {
CheckHitGrd();
Etat = "Idle";
FrGetHitCount = 0;
InvincibleInit();
} else {
FrGetHitCount++;
}
GetHitGeneral();
}
};
ObjPers.prototype.HurtNetDragon = ObjPers.prototype.HurtDragon;
ObjPers.prototype.AttackTailDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrAttackTailHit) {
bHitAttack = true;
} else {
bHitAttack = false;
}
}
};
ObjPers.prototype.AttackFireDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
Etat = "Idle";
}
if (_parent.Pers.Obj.Etat._currentframe == FrShootFire) {
if (Dir == "D") {
CreerFireBall(PosX + 70, PosY - 70, Dir);
} else {
CreerFireBall(PosX - 70, PosY - 70, Dir);
}
}
}
};
ObjPers.prototype.GetHitDragon = function () {
with (this) {
if (CanBeHit) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = SpdYHitBase;
CanBeHit = false;
Etat = "Hurt";
GetHitGeneral();
}
}
};
ObjPers.prototype.GetFireDragon = function () {
with (this) {
var RandomHit = 0;
Life = Life - 1;
_parent._parent.Hud.LifeBar.gotoAndStop(Life + 1);
CanHit = false;
SpdXNow = SpdXHitBase;
SpdYNow = 0;
RandomHit = Math.ceil(Math.random() * 2);
Etat = "GetHit";
}
};
ObjPers.prototype.TransformDragon = function () {
with (this) {
if (_parent.Pers.Obj.Etat._currentframe >= _parent.Pers.Obj.Etat._totalframes) {
ICharacter = 0;
Etat = "Fall";
Perso = aCharacter[ICharacter];
updatePerso();
}
}
};
ObjPers.prototype.DieDragon = function () {
with (this) {
CanBeHit = false;
if (_parent.Pers.Obj.Etat._currentframe >= nFrTotalAnim) {
FrDeadCount++;
_parent.Pers.Obj.Etat.stop();
}
}
};
ObjPers.prototype.SleepDragon = function () {
};
CreerPers = function (PosX, PosY, Perso) {
this.Pers = new ObjPers(PosX, PosY, Perso);
};
ObjPers.prototype.CharacterSwitch = function () {
with (this) {
if (Etat == "Fall") {
Etat = "TransformFall";
} else {
Etat = "Transform";
}
}
};
ObjPers.prototype.HeroChange = function (NewHero) {
with (this) {
Perso = NewHero;
updatePerso();
}
};
ObjPers.prototype.GetHitGeneral = function () {
with (this) {
SetSpdXHit();
CheckWall(BackX, TrueY);
CheckHitGrd();
CheckSol();
MovePers();
CheckDie();
}
};
ObjPers.prototype.CheckGetFire = function () {
with (this) {
var NbMinionBall = G_TabMinionBall.length;
if ((NbMinionBall > 0) && (Perso != "TuesdayDisguised")) {
var i = 0;
while (i < NbMinionBall) {
var BallX = _parent.Control[G_TabMinionBall[i]].PosX;
var BallY = _parent.Control[G_TabMinionBall[i]].PosY;
if (((((BallX >= (PosX - GetFireG)) and (BallX <= (PosX + GetFireD))) and (BallY >= (PosY - GetFireUp))) and (BallY <= (PosY + GetFireDw))) && (!Invincible)) {
Etat = "GetFire";
if (_parent.Control[G_TabMinionBall[i]].Dir == "D") {
Dir = "G";
} else if (_parent.Control[G_TabMinionBall[i]].Dir == "G") {
Dir = "D";
}
_parent.Control[G_TabMinionBall[i]].Etat = "Hit";
}
i++;
}
}
}
};
ObjPers.prototype.InvincibleInit = function () {
with (this) {
Invincible = true;
}
};
ObjPers.prototype.InvincibleEnd = function () {
with (this) {
Invincible = false;
FrInvincibleCount = 0;
_parent.Pers._visible = true;
}
};
ObjPers.prototype.InvincibleCheck = function () {
with (this) {
if (Invincible) {
if (FrInvincibleCount >= FrInvincible) {
InvincibleEnd();
CanBeHit = true;
} else {
FrInvincibleCount++;
if ((FrInvincibleCount % 3) == 0) {
_parent.Pers._visible = !_parent.Pers._visible;
}
}
}
}
};
ObjPers.prototype.SetSpdXHit = function () {
with (this) {
MoveX = SpdXNow;
if (SpdXNow > 0) {
SpdXNow = SpdXNow * 0.7;
}
if (Dir eq "D") {
MoveX = MoveX * -1;
}
}
};
ObjPers.prototype.SetSpdXJake = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX - WallHitBloc, TrueY, true)) {
Etat = "Idle";
SpdXNow = 0;
} else {
Etat = "Run";
SpdXNow = SpdXBase * -1;
}
} else {
Etat = "Idle";
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdDragon = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(FrontX + WallHitBloc, TrueY - 40, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (KeyListener.Dw == true) {
SpdYNow = SpdYFly;
} else if (KeyListener.Up == true) {
SpdYNow = SpdYFly * -1;
} else {
SpdYNow = 0;
}
if ((SpdXNow == 0) && (SpdYNow == 0)) {
Etat = "Idle";
} else {
Etat = "Fly";
}
}
};
ObjPers.prototype.SetSpdXJump = function () {
with (this) {
if (KeyListener.R == true) {
Dir = "D";
if (_parent.Collider.Wall.hitTest(TrueX + WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase;
}
} else if (KeyListener.L == true) {
Dir = "G";
if (_parent.Collider.Wall.hitTest(TrueX - WallHitBloc, TrueY, true)) {
SpdXNow = 0;
} else {
SpdXNow = SpdXBase * -1;
}
} else {
SpdXNow = 0;
}
if (Dir ne DirOld) {
SpdXNow = 0;
}
}
};
ObjPers.prototype.SetSpdXJumpKick = function () {
with (this) {
if (Dir == "G") {
if (SpdXNow < -5) {
SpdXNow = SpdXNow + 2;
} else {
SpdXNow = -5;
}
} else if (Dir == "D") {
if (SpdXNow > 5) {
SpdXNow = SpdXNow - 2;
} else {
SpdXNow = 5;
}
}
}
};
ObjPers.prototype.SetMoveX = function () {
with (this) {
MoveX = SpdXNow;
}
};
ObjPers.prototype.SetMoveY = function () {
with (this) {
MoveY = SpdYNow;
}
};
ObjPers.prototype.CheckWall = function (CoordX, CoordY) {
with (this) {
if (MoveX != 0) {
if (MoveX > 0) {
var WallStop = WallHitBloc;
} else {
var WallStop = (-1 * WallHitBloc);
}
var WallHit1 = (MoveX / 3);
var WallHit2 = (WallHit1 * 2);
var WallHit3 = (WallHit1 * 4);
if (_parent.Collider.Wall.hitTest(CoordX + WallStop, CoordY, true)) {
MoveX = 0;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit1, CoordY, true)) {
MoveX = WallHitBloc;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit2, CoordY, true)) {
MoveX = WallHit1;
} else if (_parent.Collider.Wall.hitTest(CoordX + WallHit3, CoordY, true)) {
MoveX = WallHit2;
} else if (_parent.Collider.Wall.hitTest(CoordX + MoveX, CoordY, true)) {
MoveX = WallHit2;
}
}
}
};
ObjPers.prototype.CheckDragonObstacle = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Dragon.hitTest(TopX, TopY + MoveY, true)) {
MoveY = DragonHitTop;
} else if (_parent.Collider.Dragon.hitTest(BottomFrontX, (TopY + MoveY) + DragonHeight, true) or _parent.Collider.Dragon.hitTest(BottomBackX, (TopY + MoveY) + DragonHeight, true)) {
MoveY = DragonHitBottom;
}
}
}
};
ObjPers.prototype.CheckCeil = function () {
with (this) {
if (MoveY != 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
Etat = "Fall";
DistYFall = 0;
}
}
}
};
ObjPers.prototype.CheckSolDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Sol.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckCeilDragon = function () {
with (this) {
if (MoveY < 0) {
if (_parent.Collider.Ceil.hitTest(TopX, TopY + MoveY, true)) {
MoveY = 0;
SpdYNow = 0;
}
}
}
};
ObjPers.prototype.CheckGroundDragon = function () {
with (this) {
if (MoveY > 0) {
if (_parent.Collider.Sol.hitTest(BottomFrontX, TrueY - _parent.Pers.Obj.HitBottomFront._y, true)) {
MoveY = 0;
}
}
}
};
ObjPers.prototype.CheckJump = function () {
with (this) {
if (Etat != "Push") {
if ((!KeyListener.Up) && (!bJumpRelease)) {
bJumpRelease = true;
}
if (((KeyListener.Up == true) && (HitGrd == true)) && (bJumpRelease)) {
bJumpRelease = false;
if (Etat == "Run") {
SpdYNow = SpdStartJump;
Etat = "JumpIdle";
} else {
Etat = "JumpStart";
}
}
}
}
};
ObjPers.prototype.CheckPush = function () {
with (this) {
PushPointX = _parent.Pers.Obj.PushPoint._x;
var goToTarget = false;
if (Dir == "G") {
PushPointX = TrueX - PushPointX;
var NumDir = -1;
} else if (Dir == "D") {
PushPointX = TrueX + PushPointX;
var NumDir = 1;
}
PushPointY = TrueY + _parent.Pers.Obj.PushPoint._y;
if (_parent.Collider.Wall.hitTest(PushPointX, PushPointY, true)) {
if (KeyListener.Action && (((Dir == "G") && (KeyListener.L)) || ((Dir == "D") && (KeyListener.R)))) {
Etat = "Push";
}
}
}
};
ObjPers.prototype.CheckAttackJake = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "Attack";
}
}
};
ObjPers.prototype.CheckAttackDragon = function () {
with (this) {
if ((KeyListener.Attack == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackTail";
}
if ((KeyListener.Action == true) && (bCanAttack)) {
bCanAttack = false;
Etat = "AttackFire";
}
}
};
ObjPers.prototype.CheckFall = function () {
with (this) {
if (SpdYNow >= SpdYFall) {
Etat = "Fall";
DistYFall = 0;
}
}
};
ObjPers.prototype.CheckDie = function () {
with (this) {
if (_global.energy <= 0) {
_global.dragonPower = 0;
Etat = "Fall";
}
}
};
ObjPers.prototype.MovePers = function () {
with (this) {
if ((Pers.TrueX + MoveX) < 30) {
MoveX = (TrueX * -1) + 30;
} else if ((Pers.TrueX + MoveX) > 520) {
MoveX = 520 - Pers.TrueX;
}
PosX = _parent.Pers._x + MoveX;
_parent.Pers._x = PosX;
MoveX = 0;
PosY = _parent.Pers._y + MoveY;
_parent.Pers._y = PosY;
MoveY = 0;
}
};
ObjPers.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
TopX = TrueX;
TopY = TrueY + _parent.Pers.Obj.HitTop._y;
FrontX = _parent.Pers.Obj.HitFront._x;
FrontY = TrueY + _parent.Pers.Obj.HitFront._y;
BottomFrontX = _parent.Pers.Obj.HitBottomFront._x;
BottomBackX = _parent.Pers.Obj.HitBottomBack._x;
BackX = _parent.Pers.Obj.HitBack._x;
if (Dir == "G") {
FrontX = TrueX - FrontX;
BottomFrontX = TrueX - BottomFrontX;
BottomBackX = TrueX - BottomBackX;
BackX = TrueX - BackX;
} else if (Dir == "D") {
FrontX = TrueX + FrontX;
BottomFrontX = TrueX + BottomFrontX;
BottomBackX = TrueX + BottomBackX;
BackX = TrueX + BackX;
}
}
};
ObjPers.prototype.CheckHitGrd = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = TrueX;
CheckY = TrueY;
aCheckPoints = [CheckX, BottomFrontX, BottomBackX];
} else {
aCheckPoints = [CheckX];
}
for (var i in aCheckPoints) {
if (_parent.Collider.Sol.hitTest(aCheckPoints[i], CheckY + MaxSol, true) and (SpdYNow >= 0)) {
HitGrd = true;
HitGrdPoint = aCheckPoints[i];
if ((onBouncingID != null) && (_global.Game[onBouncingID].CheckPersOn() != true)) {
Pers.SpdYUp = Pers.SpdYUpBase;
}
break;
}
HitGrd = false;
HitGrdPoint = TrueX;
}
}
};
ObjPers.prototype.CheckSol = function (CheckX, CheckY) {
with (this) {
if ((CheckX == undefined) && (CheckY == undefined)) {
CheckX = HitGrdPoint;
CheckY = TrueY;
}
if (_parent.Collider.Sol.hitTest(CheckX, CheckY, true) and (SpdYNow >= 0)) {
SpdYNow = 0;
var InSol = true;
while (InSol == true) {
MoveY = MoveY - SolOut;
InSol = _parent.Collider.Sol.hitTest(CheckX, CheckY + MoveY, true);
}
} else if (SpdYNow >= 0) {
if (HitGrd == true) {
SpdYNow = 0;
MoveY = SpdYNow;
} else {
SpdYNow = SpdYNow + SpdYUp;
if (Etat == "JumpKick") {
SpdYNow = SpdYNow + 1;
}
if (SpdYNow > SpdYMax) {
SpdYNow = SpdYMax;
}
var SolHit1 = (SpdYNow / 3);
var SolHit2 = (SolHit1 * 2);
if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit1, true)) {
MoveY = SolHitMin;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SolHit2, true)) {
MoveY = SolHit1;
} else if (_parent.Collider.Sol.hitTest(CheckX, CheckY + SpdYNow, true)) {
MoveY = SolHit2;
} else {
MoveY = SpdYNow;
}
}
} else {
SpdYNow = SpdYNow + SpdYUp;
MoveY = SpdYNow;
}
if (MoveY > 0) {
DistYFall = DistYFall + MoveY;
}
}
};
ObjPers.prototype.setState = function (l_sNewState) {
with (this) {
EtatOld = Etat;
Etat = l_sNewState;
var nOldTransformFr = _parent.Pers.Obj.Transform._currentframe;
_parent.Pers.Obj.gotoAndStop(l_sNewState);
_parent.Pers.Obj.Etat.gotoAndPlay(1);
this.nFrTotalAnim = _parent.Pers.Obj.Etat._totalframes;
_parent.Pers.Obj.Transform.gotoAndStop(1);
if ((Etat == "Die") && (bSkipDie)) {
_parent.Pers.Obj.Etat.gotoAndPlay(9);
}
if ((nOldTransformFr < 15) && (nOldTransformFr > 5)) {
_parent.Pers.Obj.Transform.gotoAndPlay(nOldTransformFr);
}
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
}
};
ObjPers.prototype.updatePerso = function () {
var nCurrentFrame;
with (this) {
nCurrentFrame = _parent.Pers.Obj.Etat._currentframe;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
_parent.Pers.Obj.Etat.gotoAndPlay(nCurrentFrame);
nGetHitLeft = -1 * _parent.Pers.Obj.HitBack._x;
nGetHitRight = _parent.Pers.Obj.HitFront._x;
nGetHitTop = -1 * _parent.Pers.Obj.HitTop._y;
ComboKick = 0;
mcHitGetHurt = _parent.Pers.Obj.HitGetHurt;
}
};
ObjPers.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Pers.gotoAndStop((Perso + "_") + Dir);
}
};
ObjPers.prototype.Actions = function () {
with (this) {
if (WaitForActions) {
SetTruePos();
CheckHitGrd();
CheckSol();
CheckFall();
WaitForActions = false;
} else if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Pers.Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Pers.Obj.Etat.play();
}
SetTruePos();
InvincibleCheck();
this[Etat + aCharacter[ICharacter]]();
CheckCharSwitch();
CheckHit();
CheckEndLevel();
}
}
};
ObjPers.prototype.CheckCharSwitch = function () {
with (this) {
if (ICharacter == 1) {
if ((KeyListener.Dragon || (_global.dragonPower == 0)) && (Etat != "HurtNet")) {
CharacterSwitch();
} else if ((++nDragonPowerCount) == nDragonPowerRythm) {
_global.dragonPower--;
nDragonPowerCount = 0;
if (_global.dragonPower < 0) {
_global.dragonPower = 0;
}
}
} else {
if (((KeyListener.Dragon || (autoSwitchDragon)) && (bCanSwitch)) && (_global.dragonPower > 0)) {
autoSwitchDragon = false;
bCanSwitch = false;
FrSwitchCharacterCount = FrSwitchCharacter;
CharacterSwitch();
}
if (!bCanSwitch) {
FrSwitchCharacterCount--;
if (FrSwitchCharacterCount == 0) {
bCanSwitch = true;
}
}
}
}
};
ObjPers.prototype.CheckEndLevel = function () {
with (this) {
if (!_global.boss) {
if (((_global.level == 1) && (PosY <= -3930)) && (PosX >= 390)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if ((_global.level == 2) && (PosY <= -4670)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
if (((_global.level == 3) && (PosY <= -5800)) && (PosX <= 105)) {
_global.HUD.fade(bossStart);
_global.boss = true;
}
}
}
};
ObjPers.prototype.CheckHit = function () {
with (this) {
if (KeyListener.X && (CanBeHit)) {
this.GetHit();
}
}
};
CreerNetBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("NetBall", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Net", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerFireBall = function (PosX, PosY, Dir) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("JackDragon_FireAnim", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Fire", _local4, PosX, PosY, Dir, 8, 20, G_TabPersBall, "SlimeSplat");
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
CreerSparkBall = function (PosX, PosY, Dir, Rotation, SpdX, SpdY) {
var _local4 = "Ball" + G_NextPersBall;
G_NextPersBall = G_NextPersBall + 1;
if (G_NextPersBall > 50) {
G_NextPersBall = 1;
}
if (this[_local4] == null) {
var _local5 = G_NextPersBallDepth;
G_NextPersBallDepth++;
_parent.Bg[1].attachMovie("Medusa_Blast", _local4, _local5);
_parent.Bg[1][_local4]._x = PosX;
_parent.Bg[1][_local4]._y = PosY;
this[_local4] = new ObjPersBall("Spark", _local4, PosX, PosY, Dir, 8, 0, G_TabPersBall, "SlimeSplat", Rotation, SpdX, SpdY);
_global.SoundCTRL.playSound("SlimeShoot", 60, 0);
G_TabPersBall.push(_local4);
}
};
ObjPersBall.prototype.Move = function () {
with (this) {
_parent.Bg[1][Nom]._x = PosX + SpdX;
PosX = PosX + SpdX;
if (SpdY) {
_parent.Bg[1][Nom]._y = PosY + SpdY;
PosY = PosY + SpdY;
}
SetTruePos();
CheckHit();
CheckOut();
}
};
ObjPersBall.prototype.Hit = function () {
with (this) {
if ((Type == "Net") && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
Pers.Etat = "HurtNet";
_global.Snd.playSound("hurtNet", 100, 1, false);
CanBeKill = true;
}
}
};
ObjPersBall.prototype.End = function () {
with (this) {
if (((Type == "Fire") || (Type == "Spark")) && (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes)) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.Burn = function () {
with (this) {
if (_parent.Bg[1][Nom].Etat._currentframe == _parent.Bg[1][Nom].Etat._totalframes) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckHit = function () {
with (this) {
if (Type == "Net") {
if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Burn";
_global.Game[Pers.CurrentFireID].Etat = "End";
} else if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.Hit))) {
Etat = "Hit";
}
}
if (((Type == "Spark") && (Pers.Etat != "Activate")) && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Pers.Obj.HitFront))) {
Pers.Etat = "Hurt";
Etat = "End";
}
if (((Type == "Spark") && (_parent.Bg[1][Nom].Etat.hitTest(_parent.Bg[1].FinalHit))) && (G_Medusa.Etat != "Die")) {
_global.HUD.increaseScore(10000);
_parent.Control.Bg.CamOnMedusa = true;
G_Medusa.Etat = "Die";
}
}
};
ObjPersBall.prototype.CheckOut = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
CanBeKill = true;
}
}
};
ObjPersBall.prototype.CheckKill = function () {
with (this) {
if (CanBeKill == true) {
KillBall();
}
}
};
ObjPersBall.prototype.KillBall = function () {
with (this) {
if (Tab == G_TabPersBall) {
G_TabPersBall.splice(PersBallI, 1);
PersBallI = PersBallI - 1;
} else if (Tab == G_TabMinionBall) {
G_TabMinionBall.splice(MinionBallI, 1);
MinionBallI = MinionBallI - 1;
}
delete _parent.Control[Nom];
_parent.Bg[1][Nom].removeMovieClip();
if (Type == "Fire") {
Pers.CurrentFireID = null;
}
if (Type == "Spark") {
G_Medusa.CurrentSparkID = null;
}
}
};
ObjPersBall.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjPersBall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].gotoAndStop(NewAction);
}
};
ObjPersBall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Etat.play();
}
this[Etat]();
CheckKill();
}
}
};
CreerSwitch = function (Nom, PosX, PosY) {
if (this[Nom] == null) {
this[Nom] = new ObjSwitch(Nom, PosX, PosY);
G_TabSwitch.push(Nom);
}
};
ObjSwitch.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjSwitch.prototype.Idle = function () {
with (this) {
CheckPersOn();
CheckBoxOn();
CheckSleep();
}
};
ObjSwitch.prototype.Baisse = function () {
with (this) {
if (_parent[Nom].Etat._currentframe >= FrBaisse) {
_global.SoundCTRL.playSound("SwitchOn", 100, 0);
_parent[Nom].Activate();
Etat = "Active";
}
}
};
ObjSwitch.prototype.Active = function () {
with (this) {
CheckSleep();
if (!FlagBoxUse) {
CheckRelease();
}
}
};
ObjSwitch.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
FlagUse = true;
Etat = "Baisse";
}
}
};
ObjSwitch.prototype.CheckBoxOn = function () {
with (this) {
var Box = Pers.PushedBox;
if ((Pers.Etat == "Push") && (Box != 0)) {
if (Box.Dir == "G") {
if (((((Box.PosX - Box.LgHitG) >= (PosX - LgOnX)) and ((Box.PosX - Box.LgHitG) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Etat = "Baisse";
Activate();
}
} else if (Box.Dir == "D") {
if (((((Box.PosX + Box.LgHitD) >= (PosX - LgOnX)) and ((Box.PosX + Box.LgHitD) <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
_global.SoundCTRL.playSound("PushSwitch", 100, 0);
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
} else if ((Box.Etat == "LandFin") && (Box != 0)) {
if ((((Box.PosX >= (PosX - LgOnX)) and (Box.PosX <= (PosX + LgOnX))) and ((Box.PosY + Box.LgHitDw) >= (PosY - LgOnY))) and ((Box.PosY + Box.LgHitDw) <= (PosY + LgOnY))) {
FlagBoxUse = true;
Box.Etat = "Turn";
Box.Dir = "";
_global.SoundCTRL.playSound("BoxSwitch", 50, 0);
Pers.Etat = "Idle";
Etat = "Baisse";
}
}
}
};
ObjSwitch.prototype.CheckRelease = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
} else {
Etat = "Idle";
FlagUse = false;
_parent[Nom].Desactivate();
_global.SoundCTRL.playSound("SwitchOff", 100, 0);
}
}
};
ObjSwitch.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjSwitch.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjSwitch.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjSwitch.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerElevator = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjElevator(l_mcElement, "Y", 0, -1 * l_mcElement.distance);
G_TabElevator.push(l_mcElement._name);
}
};
this.onSwitchLift = function (l_Nom) {
with (this) {
if (_global.Game[l_Nom + "Lift"].Active == true) {
_global.Game[l_Nom + "Lift"].Active = false;
_global.Game[l_Nom].Etat = "Idle";
_global.Snd.stopSound("lift");
} else {
_global.Game[l_Nom + "Lift"].Active = true;
_global.Game[l_Nom].Etat = "IdleActivate";
_global.Snd.playSound("lift", 100, 999, true);
}
}
};
ObjElevator.prototype.Sleep = function () {
with (this) {
CheckActif();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Idle = function () {
with (this) {
CheckSleep();
CheckReposition();
if (Active) {
SetMove();
}
}
};
ObjElevator.prototype.Wait = function () {
with (this) {
if (frWaitCount >= frWaitTime) {
Etat = "Idle";
frWaitCount = 0;
} else {
frWaitCount++;
}
}
};
ObjElevator.prototype.SetMove = function () {
with (this) {
CheckPersOn();
CheckLimit();
MoveElevator();
}
};
ObjElevator.prototype.MoveElevator = function () {
with (this) {
this["Pos" + Axis] = this["Pos" + Axis] + this["Move" + Axis];
_parent[Nom]._x = PosX;
_parent[Nom]._y = PosY;
_parent.Collider.Sol[Nom]._x = PosX;
_parent.Collider.Sol[Nom]._y = PosY;
if (PersOn) {
Pers["Move" + Axis] = this["Move" + Axis];
Pers.MovePers();
}
UpdateLift();
}
};
ObjElevator.prototype.UpdateLift = function () {
with (this) {
var cableH = (this["Pos" + Axis] - Max);
mc.Obj.cable1._height = cableH;
mc.Obj.cable2._height = cableH;
mc._y = mc._y + this["Move" + Axis];
mc._parent[Nom.substr(0, -4)]._y = mc._parent[Nom.substr(0, -4)]._y + this["Move" + Axis];
_global.Game[Nom.substr(0, -4)].PosY = _global.Game[Nom.substr(0, -4)].PosY + this["Move" + Axis];
_global.Game._parent.overlay[Nom + "ramp"]._y = _global.Game._parent.overlay[Nom + "ramp"]._y + this["Move" + Axis];
_global.Game._parent.Bg[1][Nom + "ramp"]._y = _global.Game._parent.Bg[1][Nom + "ramp"]._y + this["Move" + Axis];
}
};
ObjElevator.prototype.CheckLimit = function () {
with (this) {
this["Move" + Axis] = Speed * Dir;
if ((Dir == -1) && ((this["Pos" + Axis] + this["Move" + Axis]) <= Max)) {
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = false;
CanReposition = true;
RepositionCount = 0;
Dir = 0;
}
if ((Dir == 1) && ((this["Pos" + Axis] + this["Move" + Axis]) >= Min)) {
CanReposition = false;
Dir = -1;
Active = false;
_global.Snd.stopSound("lift");
_global.Game[Nom.substr(0, -4)].Active = true;
_global.Game[Nom.substr(0, -4)].Etat = "Idle";
}
}
};
ObjElevator.prototype.CheckReposition = function () {
with (this) {
if (CanReposition) {
CheckPersOn();
if (!PersOn) {
if ((++RepositionCount) == RepositionDelay) {
RepositionCount = 0;
CanReposition = false;
Active = true;
Dir = 1;
_global.Snd.playSound("lift", 100, 999, true);
}
}
}
}
};
ObjElevator.prototype.Activate = function () {
with (this) {
Active = true;
}
};
ObjElevator.prototype.Desactivate = function () {
with (this) {
Active = false;
}
};
ObjElevator.prototype.CheckPersOn = function () {
with (this) {
if (((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) and (Pers.HitGrd == true)) {
PersOn = true;
} else {
PersOn = false;
}
}
};
ObjElevator.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
Etat = "Idle";
if (Active) {
CheckLimit();
MoveElevator();
}
}
}
};
ObjElevator.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
Etat = "Sleep";
}
}
};
ObjElevator.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent[Nom].gotoAndStop(NewAction);
}
};
ObjElevator.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLevier = function (Nom, PosX, PosY, listener) {
if (this[Nom] == null) {
this[Nom] = new ObjLevier(Nom, PosX, PosY, listener);
G_TabLevier.push(Nom);
}
};
ObjLevier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjLevier.prototype.Idle = function () {
with (this) {
if (Active) {
CheckPersOn();
CheckSleep();
}
}
};
ObjLevier.prototype.IdleActivate = ObjLevier.prototype.Idle;
ObjLevier.prototype.Activate = function () {
with (this) {
if (Pers.ICharacter == 0) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.Etat == "Activate")) && (_parent.Pers.Obj.Etat._currentframe == _parent.Pers.Obj.Etat._totalframes)) {
listener(Nom);
}
}
}
};
ObjLevier.prototype.CheckPersOn = function () {
with (this) {
if ((Pers.ICharacter == 0) && (Pers.Etat != "Push")) {
if ((((((Pers.PosX >= (PosX - LgOnX)) and (Pers.PosX <= (PosX + LgOnX))) and ((Pers.PosY - PersYCorrection) >= (PosY - LgOnY))) and ((Pers.PosY - PersYCorrection) <= (PosY + LgOnY))) and (Pers.HitGrd == true)) && (Pers.CanBeHit || (Pers.Invincible))) {
if (KeyListener.Action) {
Pers.canJumpCount = 0;
Etat = "Activate";
Pers.Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
}
}
} else if (((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
} else if ((Pers.CurrentFireID != null) && (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID]))) {
Etat = "Activate";
_global.Snd.playSound("click", 200, 1, false);
listener(Nom);
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
};
ObjLevier.prototype.CheckActif = function () {
with (this) {
if ((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) {
if (FlagUse || (FlagBoxUse)) {
Etat = "Active";
} else {
Etat = "Idle";
}
}
}
};
ObjLevier.prototype.CheckSleep = function () {
};
ObjLevier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjLevier.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
_parent[Nom].Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent[Nom].Etat.play();
}
this[Etat]();
}
}
};
CreerLadder = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjLadder(l_mcElement);
G_TabLadder.push(l_mcElement._name);
}
};
this.onSwitchLadder = function (l_Nom) {
with (this) {
_global.Game[l_Nom + "Ladder"].Etat = "Opening";
}
};
ObjLadder.prototype.Off = function () {
with (this) {
}
};
ObjLadder.prototype.Opening = function () {
with (this) {
if (mc.etat._currentframe == mc.etat._totalframes) {
Etat = "On";
}
}
};
ObjLadder.prototype.On = function () {
with (this) {
CheckPersOn();
}
};
ObjLadder.prototype.CheckPersOn = function () {
with (this) {
if (Pers.ladderDisabledCount >= Pers.ladderDisabledMax) {
if (((((Pers.PosX >= PosX) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= PosY)) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
if (((Pers.ICharacter == 0) && (Pers.Etat != "Climbing")) && (Pers.Etat != "Hurt")) {
if ((KeyListener.Up && (Pers.PosY >= (PosY + 70))) || (KeyListener.Dw && (Pers.PosY <= (PosY + 165)))) {
Pers.onLadderID = Nom;
Pers.Etat = "Climbing";
Pers.ClimbedDistance = 0;
}
}
} else if ((Pers.Etat == "Climbing") && (Pers.onLadderID == Nom)) {
if (Pers.PosX < PosX) {
Pers.ChangeDir("G");
}
if (Pers.PosX > (PosX + LgOnX)) {
Pers.ChangeDir("D");
}
Pers.Etat = "Fall";
Pers.onLadderID = null;
}
} else {
Pers.ladderDisabledCount++;
}
}
};
ObjLadder.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjLadder.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerBouncingChair = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBouncingChair(l_mcElement);
G_TabChair.push(l_mcElement._name);
}
};
ObjBouncingChair.prototype.Idle = function () {
with (this) {
if (CheckPersOn()) {
Etat = "Bounce";
if ((Pers.onBouncingID == Nom) && (Pers.HitGrd)) {
Pers.onBouncingID = null;
}
}
}
};
ObjBouncingChair.prototype.Bounce = function () {
with (this) {
if (mc.Etat._currentframe == 9) {
BouncePers();
}
if (mc.Etat._currentframe == mc.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjBouncingChair.prototype.CheckPersOn = function () {
with (this) {
if ((((((((Pers.ICharacter == 0) && (Pers.Etat != "Idle")) && (Pers.Etat != "Run")) and (Pers.PosX >= PosX)) and (Pers.PosX <= (PosX + LgOnX))) and (Pers.PosY >= (PosY - LgOnY))) and (Pers.PosY <= (PosY + LgOnY))) && (Pers.CanBeHit || (Pers.Invincible))) {
return(true);
}
}
};
ObjBouncingChair.prototype.BouncePers = function () {
with (this) {
if (CheckPersOn()) {
Pers.SpdYUp = Pers.SpdYUpBase;
if (Pers.onBouncingID != Nom) {
Pers.onBouncingID = Nom;
Pers.bounceCount = 0;
} else {
Pers.bounceCount++;
if (Pers.bounceCount > 0) {
Pers.bounceCount = Pers.bounceCountMax;
}
Pers.SpdYUp = Pers.SpdYUp - (Pers.bounceCount * 0.34);
}
Pers.Etat = "JumpStart";
} else if (Pers.HitGrd) {
Pers.onBouncingID = null;
}
}
};
ObjBouncingChair.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
mc.gotoAndStop(NewAction);
}
};
ObjBouncingChair.prototype.Actions = function () {
with (this) {
if ((G_Pause == true) && (Etat != "Activate")) {
if (InPause == false) {
InPause = true;
mc.etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
mc.etat.play();
}
this[Etat]();
}
}
};
CreerHuntSoldier = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntSoldier";
this[l_mcElement._name] = new ObjHuntSoldier(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntSoldier.push(l_mcElement._name);
}
};
ObjHuntSoldier.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntSoldier.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckShield();
CheckDir();
CheckHurt();
CheckSleep();
}
};
ObjHuntSoldier.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Stunned = ObjHuntSoldier.prototype.Hurt;
ObjHuntSoldier.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack1 = function () {
with (this) {
if (((Pers.Etat != "Hurt") && (_parent.Bg[1][Nom].Obj.Etat._currentframe >= 9)) && (_parent.Bg[1][Nom].Obj.Etat._currentframe <= 25)) {
if (_parent.Bg[1][Nom].Obj.Etat.wave.hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.Attack2 = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 7) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
if (Pers.Etat != "Activate") {
Pers.Etat = "Hurt";
_global.Snd.playSound("hurtJake", 100, 1, false);
}
}
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjHuntSoldier.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjHuntSoldier.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if ((Etat != "Shield") && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront))) {
if ((++HurtCount) == 3) {
enemyHitScore();
Etat = "Stunned";
HurtCount = 0;
} else {
Etat = "Hurt";
}
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
}
};
ObjHuntSoldier.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjHuntSoldier.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Math.abs(Pers.PosY - PosY) < 180) && (Math.random() < AttackChance)) {
if (Math.abs(Pers.PosX - PosX) < 150) {
Etat = "Attack2";
} else {
Etat = "Attack1";
}
AttackDelayCount = 0;
}
}
};
ObjHuntSoldier.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntSoldier.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjHuntSoldier.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntSoldier.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjHuntSoldier.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerHuntWindow = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "HuntWindow";
this[l_mcElement._name] = new ObjHuntWindow(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabHuntWindow.push(l_mcElement._name);
}
};
ObjHuntWindow.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjHuntWindow.prototype.IdleClose = function () {
with (this) {
CheckCanOpen();
CheckSleep();
}
};
ObjHuntWindow.prototype.IdleOpen = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt._currentframe == 1) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.gotoAndStop(HuntID);
SetHuntEtat("Appear");
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
}
if ((HuntEtat == "Appear") && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
SetHuntEtat("idle");
}
if (HuntEtat == "idle") {
CheckFlip();
CheckAttack();
}
if (((HuntEtat == "disappear") || (HuntEtat == "flee")) && (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes)) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat.stop();
Etat = "Close";
if (HuntEtat == "flee") {
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = -80;
}
}
if (HuntEtat == "Throw") {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._totalframes) {
SetHuntEtat("idle");
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.Etat._currentframe == FrThrow) {
var l_dir = "G";
if (HuntID == "A") {
l_dir = "D";
}
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
if (l_dir == "D") {
l_dir = "G";
} else {
l_dir = "D";
}
}
var l_netY = 70;
if (PosY < Pers.TrueY) {
l_netY = l_netY + (Math.abs(Pers.PosY - TrueY) - 150);
} else {
l_netY = l_netY - Math.abs(Pers.PosY - TrueY);
}
if (l_netY > 120) {
l_netY = 120;
}
if (l_netY < 20) {
l_netY = 20;
}
CreerNetBall(PosX, PosY + l_netY, l_dir);
_global.Snd.playSound("net", 130, 1, false);
}
}
CheckCanClose();
CheckHurt();
CheckSleep();
}
};
ObjHuntWindow.prototype.Open = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleOpen";
AttackDelayCount = AttackDelay * 0.9;
}
}
};
ObjHuntWindow.prototype.Close = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "IdleClose";
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
}
};
ObjHuntWindow.prototype.CheckCanOpen = function () {
with (this) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == null) {
if (_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] >= _global.Game.G_WindowOpenDelay) {
if ((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown))) {
if (((Pers.ICharacter == 0) && (Math.random() <= OpenChanceJake)) || ((Pers.ICharacter == 1) && (Math.random() <= OpenChanceDragon))) {
Etat = "Open";
_global.Game["G_HuntWindowCurrent" + HuntID] = Nom;
_global.Game[("G_Window" + HuntID) + "OpenDelayCount"] = 0;
}
}
}
}
}
};
ObjHuntWindow.prototype.CheckCanClose = function () {
with (this) {
if (CloseDelayCount < CloseDelay) {
CloseDelayCount++;
} else if ((HuntEtat != "disappear") && ((!((Pers.PosY > (PosY - OpenRangeUp)) && (Pers.PosY < (PosY + OpenRangeDown)))) || ((Pers.ICharacter == 0) && (Math.random() <= CloseChance)))) {
if (Math.random() <= OpenChance) {
SetHuntEtat("disappear");
CloseDelayCount = 0;
}
}
}
};
ObjHuntWindow.prototype.CheckFlip = function () {
with (this) {
if (FlipDelayCount < FlipDelay) {
FlipDelayCount++;
} else {
if (((HuntID == "A") && (PosX > Pers.PosX)) || ((HuntID == "B") && (PosX < Pers.PosX))) {
if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == 100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = -100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x + FlipPosition;
}
} else if (_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale == -100) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._xscale = 100;
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x = _parent.Bg[1][Nom].Obj.Etat.Hunt.Obj._x - FlipPosition;
}
FlipDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if ((Pers.ICharacter == 1) && (Math.abs(Pers.PosY - PosY) < 300)) {
SetHuntEtat("Throw");
AttackDelayCount = 0;
}
}
};
ObjHuntWindow.prototype.CheckHurt = function () {
with (this) {
if ((((HuntEtat == "idle") || (HuntEtat == "Throw")) && (Pers.bHitAttack == true)) && (_parent.Bg[1][Nom].Obj.hitTest(_parent.Pers.Obj.HitFront))) {
SetHuntEtat("flee");
enemyHitScore();
if (Pers.ICharacter == 0) {
_global.Snd.playSound("jakeHit", 200, 1, false);
} else {
_global.Snd.playSound("dragonHit", 500, 1, false);
}
}
}
};
ObjHuntWindow.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "IdleClose";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjHuntWindow.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (_global.Game["G_HuntWindowCurrent" + HuntID] == Nom) {
_global.Game["G_HuntWindowCurrent" + HuntID] = null;
}
Etat = "Sleep";
}
}
};
ObjHuntWindow.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjHuntWindow.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.window.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.overlay.gotoAndStop(G_CurrentLevel);
}
};
ObjHuntWindow.prototype.SetHuntEtat = function (newEtat) {
with (this) {
_parent.Bg[1][Nom].Obj.Etat.Hunt.Obj.gotoAndStop(newEtat);
HuntEtat = newEtat;
}
};
ObjHuntWindow.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusa = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "Medusa";
this[l_mcElement._name] = new ObjMedusa(Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusa.push(l_mcElement._name);
}
};
ObjMedusa.prototype.Idle = function () {
with (this) {
CheckAttack();
CheckDir();
CheckHurt();
}
};
ObjMedusa.prototype.Captured = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showNextScreen();
}
}
};
ObjMedusa.prototype.Die = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_global.Packaging.showWinScreen();
}
}
};
ObjMedusa.prototype.Laugh = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Hurt = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Shield = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjMedusa.prototype.Attack = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe < FrPrepareAttack) {
CheckDir();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrPrepareAttack) {
if (Pers.ICharacter == 0) {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 1.5));
} else {
var l_PersY = (Pers.TrueY + (_parent.Pers.Obj._height / 3));
}
NextAttackRotation = Math.round(pointsGetAngle(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY));
var l_dst = pointsGetDistance(G_Medusa.TrueX, G_Medusa.TrueY, Pers.TrueX, l_PersY);
var l_step = (l_dst / 20);
NextAttackRotationSpdX = (Pers.TrueX - G_Medusa.TrueX) / l_step;
NextAttackRotationSpdY = (l_PersY - G_Medusa.TrueY) / l_step;
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrAttack) {
var l_PosX = PosX;
CreerSparkBall(PosX, PosY - 95, Dir, NextAttackRotation, NextAttackRotationSpdX, NextAttackRotationSpdY);
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
HasAttacked = true;
Etat = "Idle";
}
CheckHurt();
}
};
ObjMedusa.prototype.CheckDir = function () {
with (this) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
}
};
ObjMedusa.prototype.CheckHurt = function () {
with (this) {
if (Pers.bHitAttack == true) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Laugh";
}
}
}
};
ObjMedusa.prototype.CheckShield = function () {
with (this) {
if ((((((Etat == "Idle") && (Pers.Etat == "AttackTail")) && (_parent.Pers.Obj.Etat._currentframe == 2)) && (Dir != Pers.Dir)) && (Math.abs(Pers.PosY - PosY) < 200)) && (Math.random() < ShieldChance)) {
Etat = "Shield";
}
}
};
ObjMedusa.prototype.CheckAttack = function () {
with (this) {
if (AttackDelayCount < AttackDelay) {
AttackDelayCount++;
} else if (Math.random() < AttackChance) {
Etat = "Attack";
HasAttacked = false;
AttackDelayCount = 0;
}
}
};
ObjMedusa.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjMedusa.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjMedusa.prototype.SetTruePos = function () {
with (this) {
TrueX = PosX + _parent._x;
TrueY = PosY + _parent._y;
}
};
ObjMedusa.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerMedusaSister = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
Perso = "MedusaSister";
this[l_mcElement._name] = new ObjMedusaSister(l_mcElement, Perso, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabMedusaSister.push(l_mcElement._name);
}
};
ObjMedusaSister.prototype.UpdateSister = function (SisterID) {
with (this) {
if (CurrentSister == SisterID) {
mc[SisterID].gotoAndStop(CurrentAction);
} else {
mc[SisterID].gotoAndStop("Idle");
}
}
};
ObjMedusaSister.prototype.UpdatePosition = function () {
with (this) {
var l_maxOffset = 70;
var l_posX = Math.abs(_parent.Control.Bg.PosX);
mc._x = -((l_posX / 450) * l_maxOffset);
mc._y = mc._y + (_global.MoveY / 2.5);
if (mc._y < 145) {
mc._y = 145;
}
}
};
ObjMedusaSister.prototype.UpdateAttack = function () {
with (this) {
if ((CurrentAction == "Idle") && (!MedusaAttack)) {
if ((++AttackDelayCount) == AttackDelay) {
if (CurrentSister == "SisterLeft") {
CurrentSister = "SisterRight";
} else {
CurrentSister = "SisterLeft";
}
CurrentAction = "Charge";
AttackDelayCount = 0;
}
} else if (CurrentAction == "Charge") {
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
var PersY = Math.abs(_global.Game.Pers.PosY);
switch (true) {
case PersY < 100 :
CurrentAction = "Attack3";
break;
case PersY < 250 :
CurrentAction = "Attack2";
break;
case PersY >= 250 :
CurrentAction = "Attack1";
}
}
} else if (((CurrentAction == "Attack1") || (CurrentAction == "Attack2")) || (CurrentAction == "Attack3")) {
if (mc[CurrentSister].Etat._currentframe == 9) {
if ((Pers.Etat != "Activate") && (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Pers))) {
Pers.Etat = "Hurt";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna1)) {
_global.Game.Antenna1.Etat = "Charged";
}
if (mc[CurrentSister].Etat.blast.hit.hitTest(mc._parent.Game.Bg[1].Antenna2)) {
_global.Game.Antenna2.Etat = "Charged";
}
}
if (mc[CurrentSister].Etat._currentframe == mc[CurrentSister].Etat._totalframes) {
CurrentAction = "Idle";
if (CurrentSister == "SisterRight") {
MedusaAttack = true;
G_Medusa.HasAttacked = false;
}
}
}
if (!MedusaAttack) {
G_Medusa.AttackDelayCount = 0;
} else if (G_Medusa.HasAttacked) {
MedusaAttack = false;
}
}
};
ObjMedusaSister.prototype.Actions = function () {
with (this) {
UpdatePosition();
UpdateAttack();
UpdateSister("SisterLeft");
UpdateSister("SisterRight");
}
};
CreerWall = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjWall(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabWall.push(l_mcElement._name);
}
};
ObjWall.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjWall.prototype.Idle = function () {
with (this) {
CheckHurt();
CheckSleep();
}
};
ObjWall.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == FrRemoveWallHit) {
_parent.Collider.Wall[Nom].removeMovieClip();
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Out";
}
}
};
ObjWall.prototype.CheckHurt = function () {
with (this) {
if ((Pers.ICharacter == 1) && (Pers.bHitAttack == true)) {
if (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitFront)) {
Etat = "Destroy";
}
}
if (Pers.CurrentFireID != null) {
if (_parent.Bg[1][Nom].hitTest(_parent.Bg[1][Pers.CurrentFireID])) {
Etat = "Destroy";
_global.Game[Pers.CurrentFireID].Etat = "End";
}
}
}
};
ObjWall.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjWall.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjWall.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjWall.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
_parent.Bg[1][Nom].Obj.Etat.wall.gotoAndStop(G_CurrentLevel);
_parent.Bg[1][Nom].Obj.wall.gotoAndStop(G_CurrentLevel);
}
};
ObjWall.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerDragonObstacle = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjDragonObstacle(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabDragonObstacle.push(l_mcElement._name);
}
};
ObjDragonObstacle.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjDragonObstacle.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjDragonObstacle.prototype.Hit = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.HitBoss = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == 4) {
_global.Game.Web.Etat = "Fall";
}
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
Etat = "Idle";
}
}
};
ObjDragonObstacle.prototype.Fall = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == (_parent.Bg[1][Nom].Obj.Etat._totalframes - 1)) {
G_Medusa.Etat = "Captured";
}
}
};
ObjDragonObstacle.prototype.Destroy = function () {
with (this) {
if (_parent.Bg[1][Nom].Obj.Etat._currentframe == _parent.Bg[1][Nom].Obj.Etat._totalframes) {
_parent.Bg[1][Nom].Obj.Etat.stop();
}
}
};
ObjDragonObstacle.prototype.CheckHit = function () {
with (this) {
if ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitTop) || (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.HitBottomFront)))) {
Pers.Etat = "Hurt";
Etat = "Hit";
Pers.InvincibleEnd();
Pers.MoveY = 40;
}
}
};
ObjDragonObstacle.prototype.CheckActif = function () {
with (this) {
if (_global.boss || (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep"))) {
if (Life > 0) {
Etat = "Idle";
Dir = BaseDir;
} else {
Etat = "Dead";
}
}
}
};
ObjDragonObstacle.prototype.CheckSleep = function () {
with (this) {
if (((((!_global.boss) && (PosX < (Bg.InvPosX - LgOutG))) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjDragonObstacle.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjDragonObstacle.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjDragonObstacle.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerAntenna = function (l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjAntenna(l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabAntenna.push(l_mcElement._name);
}
};
ObjAntenna.prototype.Idle = function () {
with (this) {
CheckHit();
}
};
ObjAntenna.prototype.Charged = function () {
with (this) {
CheckHit();
if ((++ChargedCount) == ChargedDelay) {
Etat = "Idle";
ChargedCount = 0;
}
}
};
ObjAntenna.prototype.CheckHit = function () {
with (this) {
if ((G_Medusa.CurrentSparkID != null) && (Pers.Etat != "Hurt")) {
if (_parent.Bg[1][Nom].Obj.Hit.hitTest(_parent.Bg[1][G_Medusa.CurrentSparkID])) {
Etat = "Charged";
ChargedCount = 0;
if ((_global.level == 1) && (_global.Game.Web.Etat != "Fall")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Web.Etat = "Fall";
_global.HUD.increaseScore(1000);
}
if ((((_global.level == 2) && (_global.Game.Antenna1.Etat == "Charged")) && (_global.Game.Antenna2.Etat == "Charged")) && (_global.Game.Wire.Etat != "HitBoss")) {
_parent.Control.Bg.CamOnMedusa = true;
_global.Game.Wire.Etat = "HitBoss";
_global.HUD.increaseScore(2000);
}
}
}
}
};
ObjAntenna.prototype.ChangeDir = function (NewDir) {
with (this) {
DirOld = Dir;
Dir = NewDir;
_parent.Bg[1][Nom].gotoAndStop(Perso + NewDir);
_parent.Bg[1][Nom].Obj.gotoAndStop(Etat);
}
};
ObjAntenna.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
if (Etat == "Charged") {
_global.Snd.playSound("antenna", 250, 1, false);
}
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjAntenna.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
}
}
};
CreerBonus = function (type, l_mcElement) {
if (this[l_mcElement._name] == null) {
this[l_mcElement._name] = new ObjBonus(type, l_mcElement._name, l_mcElement._x, l_mcElement._y);
G_TabBonus.push(l_mcElement._name);
}
};
ObjBonus.prototype.Idle = function () {
with (this) {
CheckHit();
CheckSleep();
}
};
ObjBonus.prototype.Sleep = function () {
with (this) {
CheckActif();
}
};
ObjBonus.prototype.CheckHit = function () {
with (this) {
if (((Pers.ICharacter == 0) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj))) || ((Pers.ICharacter == 1) && (_parent.Bg[1][Nom].hitTest(_parent.Pers.Obj.Hit)))) {
switch (Type) {
case "Score" :
_global.Score = _global.Score + 500;
_global.Snd.playSound("energy", 200, 1, false);
_global.HUD.increaseScore(500);
break;
case "Life" :
if (_global.lives < 3) {
_global.lives++;
}
_global.Snd.playSound("life", 200, 1, false);
_global.HUD.increaseScore(200);
break;
case "Energy" :
_global.energy = _global.energy + 50;
if (_global.energy > 100) {
_global.energy = 100;
}
_global.Snd.playSound("bonus", 300, 1, false);
_global.HUD.increaseScore(200);
break;
case "Power" :
_global.dragonPower = 100;
_global.Snd.playSound("power", 300, 1, false);
_global.HUD.increaseScore(200);
}
KillBonus();
}
}
};
ObjBonus.prototype.KillBonus = function () {
with (this) {
G_TabBonus.splice(BonusI, 1);
BonusI = BonusI - 1;
delete _parent.Control[Nom];
_parent.Bg[1][Nom].swapDepths(90210);
_parent.Bg[1][Nom].removeMovieClip();
}
};
ObjBonus.prototype.CheckActif = function () {
with (this) {
if (((((PosX >= (Bg.InvPosX - LgOutG)) and (PosX <= (Bg.InvPosX + LgOutD))) and (PosY >= (Bg.InvPosY - LgOutUp))) and (PosY <= (Bg.InvPosY + LgOutDw))) and (Etat eq "Sleep")) {
Etat = "Idle";
}
}
};
ObjBonus.prototype.CheckSleep = function () {
with (this) {
if ((((PosX < (Bg.InvPosX - LgOutG)) or (PosX > (Bg.InvPosX + LgOutD))) or (PosY < (Bg.InvPosY - LgOutUp))) or (PosY > (Bg.InvPosY + LgOutDw))) {
if (Pers.PosX < PosX) {
Dir = "G";
} else {
Dir = "D";
}
Etat = "Sleep";
}
}
};
ObjBonus.prototype.ChangeEtat = function (NewAction) {
with (this) {
EtatOld = Etat;
Etat = NewAction;
_parent.Bg[1][Nom].Obj.gotoAndStop(NewAction);
}
};
ObjBonus.prototype.Actions = function () {
with (this) {
if (G_Pause == true) {
if (InPause == false) {
InPause = true;
_parent.Bg[1][Nom].Obj.Etat.stop();
}
} else {
if (InPause == true) {
InPause = false;
_parent.Bg[1][Nom].Obj.Etat.play();
}
SetTruePos();
this[Etat]();
CheckKill();
}
}
};
this.cnt = 0;
this.G_CurrentLevel = _global.level;
switch (G_CurrentLevel) {
case 1 :
this.G_MaxEnemyHit = 28;
break;
case 2 :
this.G_MaxEnemyHit = 28;
break;
case 3 :
this.G_MaxEnemyHit = 38;
}
G_MaxEnemyHitCount = 0;
this.G_Pause = true;
this.G_PauseOut = false;
this.G_PRealese = true;
this.G_Resume = false;
this.G_TabBox = new Array();
this.G_TabSwitch = new Array();
this.G_TabDoor = new Array();
this.G_TabElevator = new Array();
this.G_TabPersBall = new Array();
this.G_TabLevier = new Array();
this.G_TabLadder = new Array();
this.G_TabChair = new Array();
this.G_TabHuntSoldier = new Array();
this.G_TabHuntWindow = new Array();
this.G_TabMedusa = new Array();
this.G_TabMedusaSister = new Array();
this.G_TabWall = new Array();
this.G_TabDragonObstacle = new Array();
this.G_TabAntenna = new Array();
this.G_TabBonus = new Array();
this.G_NextPersBall = 1;
this.G_NextPersBallDepth = 10000;
this.G_NextMinionBall = 1;
this.G_NextMinionBallDepth = 20000;
this.G_OverlayDepth = 0;
this.G_HuntWindowCurrentA = null;
this.G_HuntActiveSinceA = 0;
this.G_HuntWindowCurrentB = null;
this.G_HuntActiveSinceB = 0;
this.G_AlphaZones = new Array();
this.G_Medusa = null;
this.G_WindowOpenDelay = 20;
this.G_WindowAOpenDelayCount = 0;
this.G_WindowBOpenDelayCount = 0;
this.addAlphaZone = function (mc) {
if (_global.Packaging.bShadowDisabled) {
mc._visible = false;
}
};
this.resetLevel = function () {
_global.dragonPower = 100;
_global.energy = 100;
if (_global.boss) {
_global.resetDestination = "Game_BOSS" + _global.level;
} else {
_global.resetDestination = "Game_LEVEL" + _global.level;
}
_parent._parent.gotoAndStop("Reset");
};
this.bossStart = function () {
_global.boss = true;
_global.resetDestination = "Game_BOSS" + _global.level;
_parent._parent.gotoAndStop("Reset");
};
this.enemyHitScore = function () {
if ((++G_MaxEnemyHitCount) < G_MaxEnemyHit) {
_global.HUD.increaseScore(100);
}
};
this.Creer_PBalcony = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 235);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PRoofTop = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
var pt = new Object();
pt = {x:l_mcElement._x - 5, y:l_mcElement._y + 95};
var mcCeil = _parent.Collider.Ceil;
mcCeil.moveTo(pt.x, pt.y);
mcCeil.beginFill(16711935);
pt.x = pt.x + 115;
pt.y = pt.y - 70;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x + 115;
pt.y = pt.y + 70;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y - 80;
mcCeil.lineTo(pt.x, pt.y);
pt.x = pt.x - 230;
mcCeil.lineTo(pt.x, pt.y);
pt.y = pt.y + 80;
mcCeil.lineTo(pt.x, pt.y);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBalconyOpen = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
if (l_mcElement.flipped) {
pt.x = pt.x - l_mcElement._width;
}
pt.y = pt.y + (l_mcElement._parent._y + 10);
CreerPlateforme(pt, 235);
if (l_mcElement.flipped) {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01OverlayFlip", {x:pt.x + 32, y:pt.y}, true);
CreerObstacle({x:pt.x + 19, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
} else {
CreerOverlay(l_mcElement._name + "trou", "AM_BlaconOuvert01Overlay", {x:pt.x + 120, y:pt.y + 0.5}, true);
CreerObstacle({x:pt.x + 107, y:pt.y}, 15, 15);
CreerObstacle({x:pt.x + 195, y:pt.y}, 15, 15);
}
_parent.overlay[l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
_parent.Bg[1][l_mcElement._name + "trou"].gotoAndStop(G_CurrentLevel);
CreerOverlay(l_mcElement._name, "AM_Rampe01_overlay", pt);
pt.y = pt.y - 50;
CreerObstacle(pt, 15, 80);
pt.x = pt.x + 220;
CreerObstacle(pt, 15, 80);
l_mcElement.obj.gotoAndStop(this.G_CurrentLevel);
}
};
this.Creer_PBox = function (l_mcElement) {
with (this) {
l_mcElement.onEnterFrame = CheckVisible;
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + l_mcElement._parent._x;
pt.y = pt.y + l_mcElement._parent._y;
CreerPlateforme(pt, 70);
CreerObstacle(pt, 70, 70);
}
};
this.CheckVisible = function () {
if ((this._y < (Bg.InvPosY - Stage.height)) or (this._y > (Bg.InvPosY + Stage.height))) {
this._visible = false;
} else {
this._visible = true;
}
};
this.CreerObstacle = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Wall;
var _local4 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local4.moveTo(pt.x, pt.y);
_local4.beginFill(16711935);
_local4.lineTo(pt.x, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y + 30);
_local4.lineTo(pt.x + l_nWidth, pt.y);
_local4.lineTo(pt.x, pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711680);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerObstacleDragon = function (pt, l_nWidth, l_nHeight) {
var _local3 = _parent.Collider.Dragon;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16776960);
_local3.lineTo(pt.x, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerPlateforme = function (pt, l_nWidth) {
var _local3 = _parent.Collider.Sol;
pt.x = Math.round(pt.x);
pt.y = Math.round(pt.y);
_local3.moveTo(pt.x, pt.y);
_local3.beginFill(16711935);
_local3.lineTo(pt.x, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y + 30);
_local3.lineTo(pt.x + l_nWidth, pt.y);
_local3.lineTo(pt.x, pt.y);
};
this.CreerOverlay = function (id, linkage, pt, bReversed) {
var _local4;
var _local5;
_local5 = _parent.overlay.attachMovie(linkage, id, G_OverlayDepth++);
_local5._x = pt.x;
_local5._y = pt.y;
_local4 = _parent.Bg[1].attachMovie(linkage, id, G_OverlayDepth++);
_local4._x = pt.x;
_local4._y = pt.y;
_local4.overlay = _local5;
if (!bReversed) {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = false;
this.overlay._visible = true;
} else {
this._visible = true;
this.overlay._visible = false;
}
};
} else {
_local4.onEnterFrame = function () {
if (_global.Game.Pers.PosY < this._y) {
this._visible = true;
this.overlay._visible = false;
} else {
this._visible = false;
this.overlay._visible = true;
}
};
}
};
this.replaceTile = function (l_mcElement) {
var _local1 = l_mcElement._name;
var _local2 = 1499;
if (_local1.slice(0, 8) == "instance") {
} else {
l_mcElement._x = 0;
l_mcElement._y = -((Number(_local1) - 1) * _local2);
}
};
this.CreerFloor = function (l_nPosX, l_nPosY, l_nWidth, l_nHeight) {
var mcGround = _parent.Collider.Sol;
with (this) {
pt = new Object();
pt = {x:l_nPosX, y:l_nPosY};
pt.y = pt.y - l_nHeight;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y + l_nHeight);
mcGround.lineTo(pt.x + l_nWidth, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor1 = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -60;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloorBoss = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -88;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y + 60);
mcGround.lineTo(pt.x + 1100, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 120;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 200;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor2c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.x = pt.x + 300;
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 360;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y + 40);
mcGround.lineTo(pt.x + 240, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 400;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y + 40);
mcGround.lineTo(pt.x + 200, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor3c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
pt.x = pt.x + 440;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y + 40);
mcGround.lineTo(pt.x + 160, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4a = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y + 40);
mcGround.lineTo(pt.x + 480, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4b = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y + 40);
mcGround.lineTo(pt.x + 400, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor4c = function (l_mcElement, l_nPosX, l_nPosY) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
pt = new Object();
pt = {x:l_mcElement._x, y:l_mcElement._y};
pt.y = pt.y + -40;
mcGround.moveTo(pt.x, pt.y);
mcGround.beginFill(16711935);
mcGround.lineTo(pt.x, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y + 40);
mcGround.lineTo(pt.x + 300, pt.y);
mcGround.lineTo(pt.x, pt.y);
}
};
this.CreerFloor5 = function (l_mcElement) {
var mcGround = _parent.Collider.Sol;
with (this) {
replaceTile(l_mcElement);
}
};
}
onClipEvent (enterFrame) {
BoxI = 0;
for (BoxI in G_TabBox) {
var BoxActif = G_TabBox[BoxI];
if (this[BoxActif].Etat != this[BoxActif].EtatOld) {
this[BoxActif].ChangeEtat(this[BoxActif].Etat);
}
this[BoxActif].Actions();
}
PersBallI = 0;
for (PersBallI in G_TabPersBall) {
var PersBallActif = G_TabPersBall[PersBallI];
if (this[PersBallActif].Etat != this[PersBallActif].EtatOld) {
this[PersBallActif].ChangeEtat(this[PersBallActif].Etat);
}
this[PersBallActif].Actions();
}
LevierI = 0;
for (LevierI in G_TabLevier) {
var LevierActif = G_TabLevier[LevierI];
if (this[LevierActif].Etat != this[LevierActif].EtatOld) {
this[LevierActif].ChangeEtat(this[LevierActif].Etat);
}
this[LevierActif].Actions();
}
LadderI = 0;
for (LadderI in G_TabLadder) {
var LadderActif = G_TabLadder[LadderI];
if (this[LadderActif].Etat != this[LadderActif].EtatOld) {
this[LadderActif].ChangeEtat(this[LadderActif].Etat);
}
this[LadderActif].Actions();
}
ChairI = 0;
for (ChairI in G_TabChair) {
var ChairActif = G_TabChair[ChairI];
if (this[ChairActif].Etat != this[ChairActif].EtatOld) {
this[ChairActif].ChangeEtat(this[ChairActif].Etat);
}
this[ChairActif].Actions();
}
ElevatorI = 0;
for (ElevatorI in G_TabElevator) {
var ElevatorActif = G_TabElevator[ElevatorI];
if (this[ElevatorActif].Etat != this[ElevatorActif].EtatOld) {
this[ElevatorActif].ChangeEtat(this[ElevatorActif].Etat);
}
this[ElevatorActif].Actions();
}
I = 0;
for (HuntSoldierI in G_TabHuntSoldier) {
var HuntSoldierActif = G_TabHuntSoldier[HuntSoldierI];
if (this[HuntSoldierActif].Dir != this[HuntSoldierActif].DirOld) {
this[HuntSoldierActif].ChangeDir(this[HuntSoldierActif].Dir);
}
if (this[HuntSoldierActif].Etat != this[HuntSoldierActif].EtatOld) {
this[HuntSoldierActif].ChangeEtat(this[HuntSoldierActif].Etat);
}
this[HuntSoldierActif].Actions();
}
I = 0;
for (HuntWindowI in G_TabHuntWindow) {
var HuntWindowActif = G_TabHuntWindow[HuntWindowI];
if (this[HuntWindowActif].Dir != this[HuntWindowActif].DirOld) {
this[HuntWindowActif].ChangeDir(this[HuntWindowActif].Dir);
}
if (this[HuntWindowActif].Etat != this[HuntWindowActif].EtatOld) {
this[HuntWindowActif].ChangeEtat(this[HuntWindowActif].Etat);
}
this[HuntWindowActif].Actions();
}
if (!G_Pause) {
if (_global.Game.G_HuntWindowCurrentA == null) {
_global.Game.G_WindowAOpenDelayCount++;
}
if (_global.Game.G_HuntWindowCurrentB == null) {
_global.Game.G_WindowBOpenDelayCount++;
}
}
I = 0;
for (MedusaI in G_TabMedusa) {
var MedusaActif = G_TabMedusa[MedusaI];
if (this[MedusaActif].Dir != this[MedusaActif].DirOld) {
this[MedusaActif].ChangeDir(this[MedusaActif].Dir);
}
if (this[MedusaActif].Etat != this[MedusaActif].EtatOld) {
this[MedusaActif].ChangeEtat(this[MedusaActif].Etat);
}
this[MedusaActif].Actions();
}
I = 0;
for (WallI in G_TabWall) {
var WallActif = G_TabWall[WallI];
if (this[WallActif].Dir != this[WallActif].DirOld) {
this[WallActif].ChangeDir(this[WallActif].Dir);
}
if (this[WallActif].Etat != this[WallActif].EtatOld) {
this[WallActif].ChangeEtat(this[WallActif].Etat);
}
this[WallActif].Actions();
}
I = 0;
for (DragonObstacleI in G_TabDragonObstacle) {
var DragonObstacleActif = G_TabDragonObstacle[DragonObstacleI];
if (this[DragonObstacleActif].Dir != this[DragonObstacleActif].DirOld) {
this[DragonObstacleActif].ChangeDir(this[DragonObstacleActif].Dir);
}
if (this[DragonObstacleActif].Etat != this[DragonObstacleActif].EtatOld) {
this[DragonObstacleActif].ChangeEtat(this[DragonObstacleActif].Etat);
}
this[DragonObstacleActif].Actions();
}
I = 0;
for (AntennaI in G_TabAntenna) {
var AntennaActif = G_TabAntenna[AntennaI];
if (this[AntennaActif].Dir != this[AntennaActif].DirOld) {
this[AntennaActif].ChangeDir(this[AntennaActif].Dir);
}
if (this[AntennaActif].Etat != this[AntennaActif].EtatOld) {
this[AntennaActif].ChangeEtat(this[AntennaActif].Etat);
}
this[AntennaActif].Actions();
}
I = 0;
for (MedusaSisterI in G_TabMedusaSister) {
var MedusaSisterActif = G_TabMedusaSister[MedusaSisterI];
if (this[MedusaSisterActif].Dir != this[MedusaSisterActif].DirOld) {
this[MedusaSisterActif].ChangeDir(this[MedusaSisterActif].Dir);
}
if (this[MedusaSisterActif].Etat != this[MedusaSisterActif].EtatOld) {
this[MedusaSisterActif].ChangeEtat(this[MedusaSisterActif].Etat);
}
this[MedusaSisterActif].Actions();
}
I = 0;
for (BonusI in G_TabBonus) {
var BonusActif = G_TabBonus[BonusI];
if (this[BonusActif].Dir != this[BonusActif].DirOld) {
this[BonusActif].ChangeDir(this[BonusActif].Dir);
}
if (this[BonusActif].Etat != this[BonusActif].EtatOld) {
this[BonusActif].ChangeEtat(this[BonusActif].Etat);
}
this[BonusActif].Actions();
}
if (Pers.Dir != Pers.DirOld) {
Pers.ChangeDir(Pers.Dir);
}
if (Pers.Etat != Pers.EtatOld) {
Pers.setState(Pers.Etat);
}
this.Pers.Actions();
this.Bg.Actions();
_global.HUD.update();
G_CheckPause();
}
Symbol 1408 MovieClip Frame 2
stop();
_global.C.beginLevel();
Instance of Symbol 1407 MovieClip "Bg" in Symbol 1408 MovieClip Frame 2
onClipEvent (load) {
this._x = 0;
this._y = 0;
this.noUpdateCamCount = 0;
this.noUpdateCamDelay = 50;
_parent.Control.CreerBg(_parent._x, _parent._y);
BG = _parent.Control.Bg;
Pers = _global.Game.Pers;
for (var i in _parent.Bg) {
if (Number(_parent.Bg[i]._name) <= 20) {
_parent.Bg[i].gotoAndStop(2);
} else {
_parent.Bg[i].gotoAndStop(3);
}
}
BG.NoCamUpdate = true;
if (_global.level == 1) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -300;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(380, -280, 250, 20);
}
if (_global.level == 2) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -450;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(95, -280, 250, 20);
_parent.Control.CreerFloor(725, -280, 250, 20);
}
if (_global.level == 3) {
BG.MaxDw1 = 500;
BG.MaxUp1 = 0;
BG.MaxG1 = -450;
BG.MaxD1 = 0;
BG.CenterY = 350;
_parent.Control.CreerFloor(95, -280, 250, 20);
_parent.Control.CreerFloor(725, -280, 250, 20);
}
_parent.Control.CreerFloor(0, -480, 1100, 20);
BG.ParallaxRateSky = 1.1;
BG.ParallaxRateCity = 1.05;
BG.CheckScreen = function () {
with (this) {
MaxDw = MaxDw1;
MaxUp = MaxUp1;
MaxG = MaxG1;
MaxD = MaxD1;
if (BG.NoCamUpdate && ((++noUpdateCamCount) == noUpdateCamDelay)) {
BG.NoCamUpdate = false;
}
}
};
}
Instance of Symbol 1150 MovieClip "Pers" in Symbol 1408 MovieClip Frame 2
onClipEvent (load) {
_parent.Control.CreerPers(this._x, this._y, "Jake");
this.gotoAndStop("D");
_global.Game.Pers.Etat = "Sleep";
_global.Game.Pers.setState("Idle");
}
Instance of Symbol 1154 MovieClip "Collider" in Symbol 1408 MovieClip Frame 2
onClipEvent (load) {
this._visible = 0;
}
Symbol 1433 MovieClip Frame 3
_global.Snd.playSound("laser", 100, 1, false);
Symbol 1463 MovieClip Frame 1
stop();
Symbol 1463 MovieClip Frame 10
stop();
Symbol 1463 MovieClip Frame 21
stop();
Symbol 1463 MovieClip Frame 30
stop();
Symbol 1463 MovieClip Frame 40
stop();
Symbol 1486 MovieClip Frame 3
_global.Snd.playSound("laser", 100, 1, false);
Symbol 1494 MovieClip Frame 1
stop();
Symbol 1494 MovieClip Frame 10
stop();
Symbol 1494 MovieClip Frame 21
stop();
Symbol 1494 MovieClip Frame 30
stop();
Symbol 1494 MovieClip Frame 40
stop();