Frame 1
_global.root = this;
_global.game = this;
_focusrect = false;
_quality = "HIGH";
Stage.showMenu = false;
stop();
Instance of Symbol 27 MovieClip in Frame 1
onClipEvent (load) {
var ratio = 0;
var fullsize = meter._width;
var loadingComplete = false;
meter._width = 0;
_visible = false;
}
onClipEvent (enterFrame) {
if (!loadingComplete) {
if (ratio >= 1) {
loadingComplete = true;
root.loader.gotoAndPlay("LOADED");
}
ratio = root.getBytesLoaded() / root.getBytesTotal();
meter._width = ratio * fullsize;
txtMeter.text = Math.round(ratio * 100) + "%";
if (ratio < 0.1) {
root.loader.gotoAndStop("EYE10");
} else if (ratio < 0.2) {
root.loader.gotoAndStop("EYE20");
} else if (ratio < 0.3) {
root.loader.gotoAndStop("EYE30");
} else if (ratio < 0.4) {
root.loader.gotoAndStop("EYE40");
} else if (ratio < 0.5) {
root.loader.gotoAndStop("EYE50");
} else if (ratio < 0.6) {
root.loader.gotoAndStop("EYE60");
} else if (ratio < 0.7) {
root.loader.gotoAndStop("EYE70");
} else if (ratio < 0.8) {
root.loader.gotoAndStop("EYE80");
} else if (ratio < 0.9) {
root.loader.gotoAndStop("EYE90");
} else if (ratio < 1) {
root.loader.gotoAndStop("EYE100");
}
root.loader.txtLoadedWhite.txt.text = Math.round(ratio * 100) + "%";
root.loader.txtLoadedBlack.txt.text = Math.round(ratio * 100) + "%";
}
}
Frame 10
game.highscore = new Highscore("HarryPotterMadEye");
game.highscore.Init();
Mouse.addListener(this);
this.onMouseDown = function () {
Mouse.hide();
};
_focusrect = false;
_quality = "HIGH";
Stage.showMenu = false;
Mouse.hide();
this.onEnterFrame = function () {
cursor._x = _xmouse;
cursor._y = _ymouse;
jukebox.Update();
};
Frame 20
root._quality = "HIGH";
stop();
Instance of Symbol 103 MovieClip "messageBoxCredit" in Frame 20
onClipEvent (load) {
function Show(callback) {
callbackFunction = callback;
_x = 275;
_y = 200;
_visible = true;
gotoAndPlay ("ANIM");
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
startX = _x;
startY = _y;
var callbackFunction;
Hide();
}
Frame 30
root._quality = "HIGH";
stop();
Frame 40
_global.DEBUG = true;
_global.WIDTH = 550;
_global.HEIGHT = 400;
_global.NULL = 0;
_global.NONE = -1;
_global.LEFT = 0;
_global.RIGHT = 1;
_global.NORTH = 0;
_global.SOUTH = 1;
_global.EAST = 2;
_global.WEST = 3;
_global.HORIZONTAL = 0;
_global.VERTICAL = 1;
_global.LINE_SIZE = 3;
_global.LINE_COLOR = 6684825 /* 0x660099 */;
_global.LINE_ALPHA = 33;
_global.STATE_START = 0;
_global.STATE_INIT = 1;
_global.STATE_PLAY = 2;
_global.STATE_PAUSE = 3;
_global.STATE_GAMEOVER = 4;
_global.ID_ITEM_BOOK = 1;
_global.ID_ITEM_CAULDRON = 2;
_global.ID_ITEM_LIFE = 3;
_global.ID_ITEM_SHIELD = 4;
_global.DECISION_MOVE_DIRECTION = 0;
_global.DECISION_MOVE_DISTANCE = 1;
_global.DECISION_WANDER_POSITION = 2;
_global.DECISION_WANDER_ANGLE = 3;
_global.DECISION_SCAN_DIRECTION = 4;
_global.DECISION_SPELL_CAST = 5;
_global.DECISION_SPELL_CHOOSE = 6;
_global.DECISION_SPIDER_START = 7;
_global.BEHAVIOR_NONE = 0;
_global.BEHAVIOR_IDLE = 1;
_global.BEHAVIOR_MOVE = 2;
_global.BEHAVIOR_WANDER = 3;
_global.BEHAVIOR_SCAN = 4;
_global.BEHAVIOR_SEEK = 5;
_global.BEHAVIOR_BLINK = 6;
_global.BEHAVIOR_SPELL = 7;
_global.BEHAVIOR_CHASE = 8;
_global.BEHAVIOR_WAIT = 9;
_global.BEHAVIOR_HIDE = 10;
_global.BEHAVIOR_LOOK = 11;
_global.SPELL_SPIDER = 0;
_global.SPELL_FIRE = 1;
_global.SPELL_CONFUSE = 2;
_global.AXIS_X = new Vector(1, 0, 0);
_global.AXIS_Y = new Vector(0, 1, 0);
_global.AXIS_Z = new Vector(0, 0, 1);
_global.KEY_C = 67;
_global.KEY_D = 68;
_global.KEY_Q = 81;
_global.KEY_S = 83;
_global.KEY_T = 84;
_global.KEY_V = 86;
_global.KEY_X = 88;
_global.KEY_Z = 90;
_focusrect = false;
_quality = "HIGH";
Stage.showMenu = false;
Key.addListener(this);
root.depth = 1000;
stop();
function IsInStage(obj, width, height) {
var _local1 = obj;
return((((_local1._x >= 0) && (_local1._x <= width)) && (_local1._y >= 0)) && (_local1._y <= height));
}
function IsInRectangle(obj, x, y, width, height) {
var _local1 = obj;
return((((_local1._x >= x) && (_local1._x <= width)) && (_local1._y >= y)) && (_local1._y <= height));
}
function Chase(obj1, obj2, speed) {
var _local1 = obj1;
_local1._x = _local1._x + ((obj2._x - _local1._x) * speed);
_local1._y = _local1._y + ((obj2._y - _local1._y) * speed);
}
function DetectCollisionWithShape(x, y, obj) {
return(obj.hitTest(x, y, true));
}
function DetectCollisionWithBox(obj1, obj2) {
return(obj1.hitTest(obj2));
}
function Respawn(obj, width, height) {
var _local1 = obj;
_local1._x = Math.random() * width;
_local1._y = Math.random() * height;
_local1._visible = true;
}
_global.Lerp = function (alpha, beta, time) {
return((alpha * (1 - time)) + (beta * time));
};
_global.QLerp = function (alpha, beta, time) {
var _local1 = time;
return((alpha * (1 - (_local1 * _local1))) + ((beta * _local1) * _local1));
};
_global.CLerp = function (alpha, beta, time) {
var _local1 = time;
return((alpha * (1 - ((_local1 * _local1) * _local1))) + (((beta * _local1) * _local1) * _local1));
};
_global.Clamp = function (val, a, b) {
var _local1 = val;
if (_local1 >= a) {
return(((_local1 > b) ? (b) : (_local1)));
}
return(a);
};
_global.Average = function (x1, x2) {
return((x2 - x1) / 2);
};
_global.Delta = function (x1, x2) {
return(Math.abs(x2 - x1));
};
_global.Slope2D = function (x1, y1, x2, y2) {
return((y2 - y1) / (x2 - x1));
};
_global.Distance2D = function (x1, y1, x2, y2) {
return(Math.sqrt(((y2 - y1) * (y2 - y1)) + ((x2 - x1) * (x2 - x1))));
};
_global.Distance3D = function (x1, y1, z1, x2, y2, z2) {
return(Math.sqrt((((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2))) + ((z1 - z2) * (z1 - z2))));
};
_global.Pi = function () {
return(Math.PI);
};
_global.DegreToRadian = function (angle) {
return(angle * (Math.PI/180));
};
_global.RadianToDegre = function (angle) {
return(angle * 57.2957795130823);
};
_global.Sinus = function (angle) {
return(Math.sin(DegreToRadian(angle)));
};
_global.Cosinus = function (angle) {
return(Math.cos(DegreToRadian(angle)));
};
_global.Tangent = function (angle) {
return(Math.tan(DegreToRadian(angle)));
};
_global.Cosecante = function (angle) {
return(1 / Math.sin(DegreToRadian(angle)));
};
_global.Secante = function (angle) {
return(1 / Math.cos(DegreToRadian(angle)));
};
_global.Cotangent = function (angle) {
return(1 / Math.tan(DegreToRadian(angle)));
};
_global.ArcSinus = function (angle) {
return(Math.asin(DegreToRadian(angle)));
};
_global.ArcCosinus = function (angle) {
return(Math.acos(DegreToRadian(angle)));
};
_global.ArcTangent = function (angle) {
return(Math.atan(DegreToRadian(angle)));
};
_global.ArcCosecante = function (angle) {
return(1 / Math.asin(DegreToRadian(angle)));
};
_global.ArcSecante = function (angle) {
return(Math.acos(DegreToRadian(angle)));
};
_global.ArcCotangent = function (angle) {
return(1 / Math.atan(DegreToRadian(angle)));
};
_global.SinusRadian = function (angle) {
return(Math.sin(angle));
};
_global.CosinusRadian = function (angle) {
return(Math.cos(angle));
};
_global.TangentRadian = function (angle) {
return(Math.tan(angle));
};
_global.ArcSinusRadian = function (angle) {
return(Math.asin(angle));
};
_global.ArcCosinusRadian = function (angle) {
return(Math.acos(angle));
};
_global.ArcTangentRadian = function (angle) {
return(Math.atan(angle));
};
var nbOfLifeStart = 1;
var maxLife = 5;
var bonus = 33;
var malus = -100;
var bonusCauldron = 5000;
var bonusBook = 10000;
var durationShield = 3000;
var durationFeedback = 2000;
var sparkleChaseSpeed = 0.5;
var margin = 25;
var harryChaseSpeedDefault = 0.35;
var madeyeWanderTweenType = Tween.TYPE_CUBIC_OUT;
var madeyeWanderTweenDuration = 1000;
var madeyeScanOscillatorPeriod = 1350;
var madeyeBlinkDuration = 1000;
var madeyeBlinkDurationAfter = 500;
var madeyeBlinkNoiseFactor = 100;
var madeyeBlinkTresholdRespawn = 100;
var madeyeSeekSpeed = 0.1;
var moodyMoveTweenType = Tween.TYPE_QUADRATIC_IN_OUT;
var moodySpellCastDuration = 2000;
var moodyLookDurationMin = 3000;
var moodyWalkDuration = 1000;
var snitchWanderTweenType = Tween.TYPE_LINEAR;
var snitchWanderTweenDuration = 125;
var spell = NONE;
var confuseFirstFrame = true;
var confuseTimeStart = 0;
var confuseTimeElapsed = 0;
var confuseDuration = 5000;
var confuseChaseSpeed = 0.075;
var confuseSeekTimeStart = 0;
var confuseSeekTimeElapsed = 0;
var confuseSeekDuration = 5000;
var confuseSeekChaseSpeed = 0.25;
var confuseSeekSpeed = 10;
var confuseRadius = 25;
var confuseOffset = 110;
var spiderSpeed = 35;
var spiderRadius = 10;
var spiderNumber = 0;
var spiderNumberMax = 8;
var spiderLifetime = 7500;
var spiderChaseSpeed = 0.1;
var spiderStartPosition = new Vector(0, 0, 0);
var fireFirstFrame = true;
var fireTerminated = false;
var fireTimeStart = 0;
var fireTimeElapsed = 0;
var fireDuration = 3000;
var fireRotationTheta = 2;
var fireSizeMax = false;
var fireStartPosition = new Vector(0, 0, 0);
var probabilityAddSpider = 0.1;
var probabilityItemRespawn = 0.0075;
var probabilitySnitchMove = 0.15;
var probabilityLookStop = 0.1;
var messageStartGame = "You must try to avoid\n Mad-Eye Moody's gaze and his Dark detectors.\nAre you ready?";
var messageFeedbackLostLife = "What a shame!\nYou\u2019ve been detected\n by Mad-Eye Moody.";
var messageLostLife = "You lost a life.\n Be careful !";
var messageGameOver = "What a shame!\nYou\u2019ve been detected\n by Mad-Eye Moody.";
var messageRetry = "Maybe the next time you will do better.\n Do you want to retry ?";
var wallOffset = 65;
function UpdateScore() {
if (IsInRectangle(harry, margin, margin, WIDTH - margin, HEIGHT - margin)) {
score = score + bonus;
if (frame % 10) {
scoreUI.Display(score, true);
}
} else {
score = score + malus;
score = ((score < 0) ? 0 : (score));
if (frame % 10) {
scoreUI.Display(score, false);
}
}
}
function AddLife() {
if (nbOfLife < maxLife) {
nbOfLife++;
}
life.gotoAndStop("LIFE" + nbOfLife);
feedback.display("one more life");
}
function LostLife() {
nbOfLife--;
nbOfLife = ((nbOfLife < 0) ? 0 : (nbOfLife));
jukebox.PlaySound("Character.Death");
life.gotoAndStop("LIFE" + nbOfLife);
if (nbOfLife == 0) {
gamestate = STATE_GAMEOVER;
death._x = harry._x;
death._y = harry._y;
death.gotoAndPlay("ANIM");
death.Show();
harry.Hide();
} else {
gamestate = STATE_PAUSE;
messageBox.Show(messageLostLife, CallbackLostLife);
}
}
function ItemBonus(bonusValue) {
score = score + bonusValue;
feedback.display(bonusValue + " points bonus");
}
function CallbackStartGame() {
InitHarry();
InitMoody();
gamestate = STATE_PLAY;
harry.Show();
scoreUI.Show();
}
function CallbackHighscore() {
windowHighscore.Hide();
replay = true;
Reset();
}
function CallbackRetry() {
Reset();
}
function CallbackLostLife() {
InitHarry();
InitMoody();
InitMadEye();
ResetSpell();
gamestate = STATE_PLAY;
}
function CallbackGameOver() {
harry.Hide();
moody.Hide();
madeye.Hide();
ResetSpell();
if (game.highscore.IsQualified(score)) {
inputBox.Show(CallbackNameHighscore);
} else {
windowHighscore.Show(CallbackHighscore);
}
}
function CallbackNameHighscore() {
player = inputBox.value;
game.highscore.Submit(player, score);
windowHighscore.Show(CallbackHighscore);
}
function DrawLineBegin(mc) {
var _local1 = mc;
_local1.clear();
_local1.lineStyle(5, LINE_COLOR, 20);
if (madeye._visible) {
_local1.moveTo(moody._x, moody._y);
_local1.lineTo(madeye._x, madeye._y);
}
}
function DrawLineEnd(mc) {
mc.endFill();
}
function Reset() {
Mouse.hide();
gamestate = STATE_INIT;
InitBorder();
InitHUD();
InitCursor();
InitItem();
InitHarry();
InitMoody();
InitMadEye();
InitSpell();
gamestate = STATE_PAUSE;
moody.position.x = WIDTH / 2;
moody.position.y = HEIGHT / 2;
moody._x = moody.position.x;
moody._y = moody.position.y;
if (!replay) {
AnimateMoody("RESPAWN");
} else {
CallbackStartGame();
}
}
function Launch() {
if (firstFrame) {
firstFrame = false;
} else {
Reset();
GenerateSpellBuffer();
this.onEnterFrame = Update;
}
}
function Update() {
UpdateCursor();
if (gamestate == STATE_PLAY) {
UpdateHarry();
UpdateMoody();
UpdateMadEye();
UpdateSpell();
UpdateItem();
UpdateScore();
}
frame++;
}
var gamestate = STATE_START;
var nbOfLife = nbOfLifeStart;
var score = 0;
var item = null;
var useShield = false;
var harryChaseSpeed = 0.35;
var frame = 0;
var replay = false;
var player = "anonyme";
root._quality = "MEDIUM";
var firstFrame = true;
function InitBorder() {
borderNorth = markerNorthEast.position.y;
borderSouth = markerSouthWest.position.y;
borderEast = markerNorthEast.position.x;
borderWest = markerSouthWest.position.x;
cornerNorthEast = new Vector(markerNorthEast.position.x, markerNorthEast.position.y, 0);
cornerNorthWest = new Vector(markerSouthWest.position.x, markerNorthEast.position.y, 0);
cornerSouthEast = new Vector(markerNorthEast.position.x, markerSouthWest.position.y, 0);
cornerSouthWest = new Vector(markerSouthWest.position.x, markerSouthWest.position.y, 0);
cornerEastNorth = new Vector(markerNorthEast.position.x, markerNorthEast.position.y, 0);
cornerEastSouth = new Vector(markerNorthEast.position.x, markerSouthWest.position.y, 0);
cornerWestNorth = new Vector(markerSouthWest.position.x, markerNorthEast.position.y, 0);
cornerWestSouth = new Vector(markerSouthWest.position.x, markerSouthWest.position.y, 0);
}
function DisplayBorder() {
}
function DrawBorder() {
root.moveTo(cornerNorthEast.x, cornerNorthEast.y);
root.lineTo(cornerNorthWest.x, cornerNorthWest.y);
root.moveTo(cornerSouthEast.x, cornerSouthEast.y);
root.lineTo(cornerSouthWest.x, cornerSouthWest.y);
root.moveTo(cornerEastNorth.x, cornerEastNorth.y);
root.lineTo(cornerEastSouth.x, cornerEastSouth.y);
root.moveTo(cornerWestNorth.x, cornerWestNorth.y);
root.lineTo(cornerWestSouth.x, cornerWestSouth.y);
}
_global.borderNorth;
_global.borderSouth;
_global.borderEast;
_global.borderWest;
_global.cornerNorthEast;
_global.cornerNorthWest;
_global.cornerSouthEast;
_global.cornerSouthWest;
_global.cornerEastNorth;
_global.cornerEastSouth;
_global.cornerWestNorth;
_global.cornerWestSouth;
function InitMoody() {
moody.behavior = BEHAVIOR_IDLE;
moody.behaviorLast = NONE;
moody.position = new Vector(0, 0, 0);
moody.position.x = Average(HEIGH, WIDTH);
moody.position.y = borderNorth + 25;
moody.tweenType = moodyMoveTweenType;
moody.tweenLoop = Tween.LOOP_ONCE;
moody.tweenStart = 0;
moody.tweenDelta = 0;
moody.tweenDuration = moodyWalkDuration;
moody.tweenDirection = NONE;
moody.tween = new Tween();
moody.tween.Init(moody.tweenType, moody.tweenLoop, moody.tweenStart, moody.tweenDelta, moody.tweenDuration);
moody.probabilityBehaviorIdle = 0.01;
moody.probabilityBehaviorMove = 0.2;
moody.probabilityBehaviorSpell = 0.3;
moody.probabilityBehaviorLook = 0.4;
moody.timeSpellCastStart = 0;
moody.timeSpellCastElapsed = 0;
moody.timeSpellCast = moodySpellCastDuration;
moody.timeLookStart = 0;
moody.timeLookElapsed = 0;
moody.timeLookDurationMin = moodyLookDurationMin;
moody.hasSpellCast = false;
moody._x = moody.position.x;
moody._y = moody.position.y;
moody.animation = "NONE";
moody._visible = true;
moody.stopLooking = false;
}
function DecideMoody(decision) {
switch (decision) {
case DECISION_MOVE_DIRECTION :
moody.tweenDirection = ((Math.random() < 0.5) ? (LEFT) : (RIGHT));
return;
case DECISION_MOVE_DISTANCE :
switch (moody.tweenDirection) {
case LEFT :
moody.tweenDelta = Math.random() * Delta(moody.position.x, wallNorthEast._x);
break;
case RIGHT :
moody.tweenDelta = Math.random() * Delta(moody.position.x, wallNorthWest._x);
break;
case NONE :
moody.tweenDelta = 25;
}
return;
case DECISION_SPELL_CAST :
moody.tweenDirection = ((Math.random() < 0.5) ? (LEFT) : (RIGHT));
return;
case DECISION_SPELL_CHOOSE :
switch (random(3)) {
case SPELL_SPIDER :
moody.spell = SPELL_SPIDER;
break;
case SPELL_FIRE :
moody.spell = SPELL_FIRE;
break;
case SPELL_CONFUSE :
moody.spell = SPELL_CONFUSE;
}
if ((moody.spell == SPELL_CONFUSE) && (harry.isConfuse)) {
moody.spell = ((Math.random() < 0.5) ? (SPELL_SPIDER) : (SPELL_FIRE));
}
return;
case DECISION_SPIDER_START :
switch (random(8)) {
case 0 :
spiderStartPosition.Set(tile00._x, tile00._y, 0);
break;
case 1 :
spiderStartPosition.Set(tile01._x, tile01._y, 0);
break;
case 2 :
spiderStartPosition.Set(tile02._x, tile02._y, 0);
break;
case 3 :
spiderStartPosition.Set(tile03._x, tile03._y, 0);
break;
case 4 :
spiderStartPosition.Set(tile04._x, tile04._y, 0);
break;
case 5 :
spiderStartPosition.Set(tile05._x, tile05._y, 0);
break;
case 6 :
spiderStartPosition.Set(tile06._x, tile06._y, 0);
break;
case 7 :
spiderStartPosition.Set(tile07._x, tile07._y, 0);
break;
}
tile._x = spiderStartPosition.x;
tile._y = spiderStartPosition.y;
tile.gotoAndPlay("OPEN");
tile.Show();
jukebox.PlaySound("Spell.Spider.Tile");
}
}
function UpdateMoody() {
UpdateAnimationMoody();
switch (moody.behavior) {
case BEHAVIOR_WAIT :
break;
case BEHAVIOR_IDLE :
AnimateMoody("IDLE");
var _local1 = Math.random();
if (_local1 < moody.probabilityBehaviorMove) {
moody.behavior = BEHAVIOR_MOVE;
} else if (_local1 < moody.probabilityBehaviorSpell) {
moody.behavior = BEHAVIOR_SPELL;
} else if (_local1 < moody.probabilityBehaviorLook) {
if (moody.behaviorLast != BEHAVIOR_LOOK) {
moody.behavior = BEHAVIOR_LOOK;
AnimateMoody("LOOK");
}
} else {
moody.behavior = BEHAVIOR_IDLE;
}
break;
case BEHAVIOR_LOOK :
AnimateMoody("LOOK");
if (madeye.behavior == BEHAVIOR_HIDE) {
madeye.behavior = BEHAVIOR_IDLE;
madeye.Show();
moody.timeLookStart = getTimer();
moody.timeLookElapsed = 0;
} else {
moody.timeLookElapsed = getTimer() - moody.timeLookStart;
if (moody.stopLooking) {
if (Math.random() < probabilityLookStop) {
madeye.behavior = BEHAVIOR_HIDE;
moody.behaviorLast = moody.behavior;
moody.behavior = BEHAVIOR_IDLE;
moody.stopLooking = false;
}
}
}
break;
case BEHAVIOR_MOVE :
if (moody.tween.IsStarted()) {
moody.tween.Update();
AnimateMoody("WALK");
switch (moody.tweenDirection) {
case LEFT :
moody.position.x = moody.position.x - moody.tween.PositionDelta();
break;
case RIGHT :
moody.position.x = moody.position.x + moody.tween.PositionDelta();
break;
case UP :
moody.position.y = moody.position.y - moody.tween.PositionDelta();
break;
case DOWN :
moody.position.y = moody.position.y + moody.tween.PositionDelta();
break;
case NONE :
}
if (moody.tween.IsFinish()) {
moody.behaviorLast = moody.behavior;
moody.behavior = BEHAVIOR_IDLE;
}
} else {
DecideMoody(DECISION_MOVE_DIRECTION);
DecideMoody(DECISION_MOVE_DISTANCE);
moody.tween.Init(moody.tweenType, moody.tweenLoop, moody.tweenStart, moody.tweenDelta, moody.tweenDuration);
moody.tween.Start();
}
break;
case BEHAVIOR_SPELL :
if (moody.hasSpellCast) {
moody.timeSpellCastElapsed = getTimer() - moody.timeSpellCastStart;
if (moody.castAnimationEnd) {
moody.castAnimationEnd = false;
switch (moody.spell) {
case SPELL_SPIDER :
spell = SPELL_SPIDER;
DecideMoody(DECISION_SPIDER_START);
break;
case SPELL_FIRE :
fireStartPosition.Set(moody.position.x, moody.position.y, 0);
spell = SPELL_FIRE;
moody.behavior = BEHAVIOR_WAIT;
break;
case SPELL_CONFUSE :
spell = SPELL_CONFUSE;
}
moody.behaviorLast = moody.behavior;
moody.behavior = BEHAVIOR_IDLE;
moody.hasSpellCast = false;
}
} else {
DecideMoody(DECISION_SPELL_CHOOSE);
moody.timeSpellCastElapsed = 0;
moody.timeSpellCastStart = getTimer();
moody.hasSpellCast = true;
switch (moody.spell) {
case SPELL_CONFUSE :
AnimateMoody("CAST1");
break;
case SPELL_SPIDER :
AnimateMoody("CAST2");
break;
case SPELL_FIRE :
AnimateMoody("CAST3");
break;
}
}
}
if (DetectCollisionWithBox(moody.collision, harry.collision) && (!useShield)) {
LostLife();
}
moody._x = moody.position.x;
moody._y = moody.position.y;
}
function AnimateMoody(anim) {
var _local1 = anim;
if (moody.animation != _local1) {
moody.gotoAndStop(_local1);
moody.animation = _local1;
}
}
Mouse.addListener(this);
this.onMouseDown = function () {
Mouse.hide();
};
this.onMouseUp = function () {
};
this.onMouseMove = function () {
};
this.onMouseWheel = function () {
};
this.onKeyDown = function () {
if (Key.getCode() == 13) {
if (inputBox.isOpen) {
inputBox.Hide();
inputBox.CallbackFunction();
}
}
if (Key.getCode() == 37) {
}
if (Key.getCode() == 39) {
}
if (Key.getCode() == 40) {
}
if (Key.getCode() == 32) {
}
if (Key.getCode() == KEY_Z) {
}
if (Key.getCode() == KEY_C) {
}
if (Key.getCode() == KEY_X) {
}
if (Key.getCode() == KEY_V) {
}
if (Key.getCode() == KEY_Q) {
}
};
this.onKeyUp = function () {
if (Key.getCode() == 37) {
}
if (Key.getCode() == 39) {
}
if (Key.getCode() == 40) {
}
if (Key.getCode() == 32) {
}
if (Key.getCode() == KEY_Z) {
}
if (Key.getCode() == KEY_C) {
}
if (Key.getCode() == KEY_X) {
}
if (Key.getCode() == KEY_V) {
}
};
function InitMadEye() {
madeye.behavior = BEHAVIOR_HIDE;
madeye.position = new Vector(0, 0, 0);
madeye.positionFrom = new Vector(0, 0, 0);
madeye.positionTo = new Vector(0, 0, 0);
madeye.velocity = new Vector(0, 0, 0);
madeye.angle = 0;
madeye.tweenType = madeyeWanderTweenType;
madeye.tweenLoop = Tween.LOOP_ONCE;
madeye.tweenStart = 0;
madeye.tweenDelta = 0;
madeye.tweenDuration = madeyeWanderTweenDuration;
madeye.tweenDirection = NONE;
madeye.tween = new Tween();
madeye.tween.Init(madeye.tweenType, madeye.tweenLoop, madeye.tweenStart, madeye.tweenDelta, madeye.tweenDuration);
madeye.oscillator = new Oscillator();
madeye.oscillator.SetAmplitude(HEIGHT / 2);
madeye.oscillator.SetPeriod(madeyeScanOscillatorPeriod);
madeye.scanXMove = 5;
madeye.hasConfigureScan = false;
madeye.probabilityBehaviorIdle = 0.015;
madeye.probabilityBehaviorWander = 0.3;
madeye.probabilityBehaviorScan = 0.6;
madeye.probabilityBehaviorBlink = 0.8;
madeye.probabilityBehaviorSeek = 1;
madeye.probabilityStopLooking = 0.25;
madeye.timeBlink = madeyeBlinkDuration;
madeye.timeBlinkStart = 0;
madeye.timeBlinkElapsed = 0;
madeye.hasBlinked = false;
madeye.isCollidable = true;
madeye.hasRespawn = false;
madeye.seekSpeed = madeyeSeekSpeed;
madeye.position.x = madeye.startX;
madeye.position.y = madeye.startY;
madeye._x = madeye.position.x;
madeye._y = madeye.position.y;
madeye.Hide();
madeye.animation = "NONE";
}
function DecideMadEye(decision) {
switch (decision) {
case DECISION_WANDER_POSITION :
madeye.positionFrom.x = madeye.position.x;
madeye.positionFrom.y = madeye.position.y;
madeye.positionTo.x = Math.round(Math.random() * WIDTH);
madeye.positionTo.y = Math.round(Math.random() * HEIGHT);
return;
case DECISION_WANDER_ANGLE :
var _local3 = madeye.positionTo.Minus(madeye.position);
madeye.tweenDelta = _local3.Magnitude();
_local3.Normalize();
madeye.angle = AXIS_X.Angle(_local3);
var testNegative = AXIS_X.RotateZ(-madeye.angle);
var testPositive = AXIS_X.RotateZ(madeye.angle);
var testNegativeTheta = _local3.Angle(testNegative);
var testPositiveTheta = _local3.Angle(testPositive);
if (testNegativeTheta < testPositiveTheta) {
madeye.angle = madeye.angle * -1;
} else {
madeye.angle = madeye.angle * 1;
}
return;
case DECISION_SCAN_DIRECTION :
madeye.scanDirection = ((Math.random() < 0.5) ? (HORIZONTAL) : (VERTICAL));
return;
case DECISION_BLINK_POSITION :
var _local2 = harry.position.Clone();
var _local1 = harry.position.Clone();
while (_local1.Distance(_local2) < madeyeBlinkTresholdRespawn) {
_local1 = _local2.Noise(madeyeBlinkNoiseFactor);
_local1.x = Clamp(_local1.x, 0, WIDTH);
_local1.y = Clamp(_local1.y, 0, HEIGHT);
}
madeye.positionFrom.x = madeye.position.x;
madeye.positionFrom.y = madeye.position.y;
madeye.positionTo.x = _local1.x;
madeye.positionTo.y = _local1.y;
}
}
function UpdateMadEye() {
switch (madeye.behavior) {
case BEHAVIOR_NONE :
break;
case BEHAVIOR_HIDE :
position.x = startX;
position.y = startY;
_x = position.x;
_y = position.y;
AnimateMadEye("LEAVE");
break;
case BEHAVIOR_IDLE :
if (Math.random() < madeye.probabilityStopLooking) {
moody.stopLooking = true;
madeye.behavior = BEHAVIOR_HIDE;
} else {
var _local2 = Math.random();
if (_local2 < madeye.probabilityBehaviorWander) {
madeye.behavior = BEHAVIOR_WANDER;
} else if (_local2 < madeye.probabilityBehaviorScan) {
madeye.behavior = BEHAVIOR_SCAN;
} else if (_local2 < madeye.probabilityBehaviorBlink) {
madeye.behavior = BEHAVIOR_BLINK;
} else if (_local2 < madeye.probabilityBehaviorseek) {
madeye.behavior = BEHAVIOR_SEEK;
} else {
madeye.behavior = BEHAVIOR_IDLE;
}
}
AnimateMadEye("IDLE");
break;
case BEHAVIOR_WANDER :
madeye.isCollidable = true;
if (madeye.tween.IsStarted()) {
madeye.tween.Update();
madeye.velocity.Set(madeye.tween.PositionDelta(), 0, 0);
madeye.velocity = madeye.velocity.RotateZ(madeye.angle);
madeye.position = madeye.position.plus(madeye.velocity);
madeye.position.x = Clamp(madeye.position.x, 0, WIDTH);
madeye.position.y = Clamp(madeye.position.y, 0, HEIGHT);
(DEBUG ? (root.moveTo(madeye.positionFrom.x, madeye.positionFrom.y)) : null);
(DEBUG ? (root.lineTo(madeye.positionTo.x, madeye.positionTo.y)) : null);
if (madeye.tween.IsFinish()) {
madeye.tween.Stop();
madeye.behavior = BEHAVIOR_IDLE;
}
txt.text = s;
} else {
DecideMadEye(DECISION_WANDER_POSITION);
DecideMadEye(DECISION_WANDER_ANGLE);
madeye.tween.Init(madeye.tweenType, madeye.tweenLoop, madeye.tweenStart, madeye.tweenDelta, madeye.tweenDuration);
madeye.tween.Start();
AnimateMadEye("IDLE");
madeye.Show();
}
break;
case BEHAVIOR_SCAN :
if (madeye.oscillator.IsStarted() && (Math.random() < madeye.probabilityBehaviorIdle)) {
madeye.oscillator.Stop();
madeye.hasConfigureScan = false;
madeye.behavior = BEHAVIOR_IDLE;
AnimateMadEye("LEAVE");
} else {
if (!madeye.oscillator.IsStarted()) {
if (!madeye.hasConfigureScan) {
DecideMadEye(DECISION_SCAN_DIRECTION);
madeye.oscillator.Reset();
switch (madeye.scanDirection) {
case HORIZONTAL :
madeye.positionTo.Set(10, Average(0, HEIGHT), 0);
madeye.oscillator.SetAmplitude(HEIGHT / 2);
break;
case VERTICAL :
madeye.positionTo.Set(Average(0, WIDTH), 10, 0);
madeye.oscillator.SetAmplitude(WIDTH / 2);
}
madeye.hasConfigureScan = true;
} else if (Distance2D(madeye.position.x, madeye.position.y, madeye.positionTo.x, madeye.positionTo.y) < 5) {
madeye.oscillator.Start();
} else {
madeye.position.Chase(madeye.positionTo, 0.1);
}
} else {
var _local1;
madeye.oscillator.Update();
switch (madeye.scanDirection) {
case HORIZONTAL :
if (Delta(harry._x, madeye.position.x) > 20) {
_local1 = ((harry._x < madeye.position.x) ? (-madeye.scanXMove) : (madeye.scanXMove));
} else {
_local1 = 0;
}
madeye.velocity.Set(_local1, madeye.oscillator.Delta(), 0);
break;
case VERTICAL :
if (Delta(harry._y, madeye.position.y) > 10) {
_local1 = ((harry._y < madeye.position.y) ? (-madeye.scanXMove) : (madeye.scanXMove));
} else {
_local1 = 0;
}
madeye.velocity.Set(madeye.oscillator.Delta(), _local1, 0);
}
madeye.isCollidable = true;
madeye.position = madeye.position.plus(madeye.velocity);
}
madeye.position.x = Clamp(madeye.position.x, 0, WIDTH);
madeye.position.y = Clamp(madeye.position.y, 0, HEIGHT);
}
break;
case BEHAVIOR_BLINK :
if (madeye.hasBlinked) {
madeye.timeBlinkElapsed = getTimer() - madeye.timeBlinkStart;
if (madeye.timeBlinkElapsed > madeye.timeBlink) {
madeye.position.x = madeye.positionTo.x;
madeye.position.y = madeye.positionTo.y;
madeye.Show();
AnimateMadEye("RESPAWN");
if (madeye.hasRespawn) {
madeye.hasRespawn = false;
madeye.hasBlinked = false;
madeye.isCollidable = true;
madeye.behavior = BEHAVIOR_IDLE;
}
} else {
DecideMadEye(DECISION_BLINK_POSITION);
}
} else {
DecideMadEye(DECISION_BLINK_POSITION);
madeye.timeBlinkElapsed = 0;
madeye.timeBlinkStart = getTimer();
madeye.hasBlinked = true;
madeye.isCollidable = false;
AnimateMadEye("LEAVE");
}
break;
case BEHAVIOR_SEEK :
AnimateMadEye("IDLE");
madeye.isCollidable = true;
if (Math.random() < madeye.probabilityBehaviorIdle) {
madeye.behavior = BEHAVIOR_IDLE;
} else {
madeye.position.Chase(harry.position, madeye.seekSpeed);
}
}
if (DetectCollisionWithBox(madeye.collision, harry.collision) && (!useShield)) {
if (madeye.isCollidable && (madeye.behavior != BEHAVIOR_HIDE)) {
LostLife();
}
}
madeye._x = madeye.position.x;
madeye._y = madeye.position.y;
}
function AnimateMadEye(anim) {
var _local1 = anim;
if (madeye.animation != _local1) {
madeye.gotoAndStop(_local1);
madeye.animation = _local1;
}
}
function InitHarry() {
harry.position = new Vector(WIDTH / 2, HEIGHT / 2, 0);
harry._x = harry.position.x;
harry._y = harry.position.y;
harry.isShielded = false;
harry.isConfuse = false;
harry.Hide();
}
function UpdateHarry() {
harry.position.Chase(cursor.position, harryChaseSpeed);
if (!IsInStage(cursor, WIDTH, HEIGHT)) {
harry.position.x = Clamp(harry.position.x, 0, WIDTH);
harry.position.y = Clamp(harry.position.y, 0, HEIGHT);
feedback.display("stay inside the wall");
}
if (harry.isConfuse) {
confuseTimeElapsed = getTimer() - confuseTimeStart;
if (confuseTimeElapsed < confuseDuration) {
harry.isConfuse = true;
harryChaseSpeed = confuseChaseSpeed;
confuse.Show();
confuse._x = harry.position.x;
confuse._y = harry.position.y;
} else {
harry.isConfuse = false;
harryChaseSpeed = harryChaseSpeedDefault;
confuse.Hide();
}
}
harry._x = harry.position.x;
harry._y = harry.position.y;
}
function InitSpell() {
i = 0;
while (i < listSpider.length) {
listSpider[i].isAlive = false;
listSpider[i]._x = -25;
listSpider[i]._y = -15;
i++;
}
}
function ResetSpell() {
spell = NONE;
SpiderRemove();
tile.Hide();
fire.gotoAndStop("HIDE");
fireFirstFrame = true;
confuseFirstFrame = true;
confuse.Hide();
harry.isConfuse = false;
harryChaseSpeed = harryChaseSpeedDefault;
confuse.Hide();
}
function UpdateSpell() {
switch (spell) {
case SPELL_SPIDER :
if (tile.isOpen && (spiderNumber < spiderNumberMax)) {
((Math.random() < probabilityAddSpider) ? (SpiderAdd()) : null);
}
break;
case SPELL_FIRE :
if (fireFirstFrame) {
moody.behavior = BEHAVIOR_WAIT;
fireFirstFrame = false;
fireSizeMax = false;
fireTimeStart = getTimer();
fireTimeElapsed = 0;
fireTerminated = false;
moody._rotation = 0;
} else if (!fireTerminated) {
if (DetectCollisionWithShape(harry.position.x, harry.position.y, moody.anim.collision) && (!useShield)) {
LostLife();
}
if (fireSizeMax) {
if (harry.position.x > moody._x) {
if (moody._rotation > -90) {
moody._rotation = moody._rotation - fireRotationTheta;
}
} else if (moody._rotation < 90) {
moody._rotation = moody._rotation + fireRotationTheta;
}
}
} else {
fireFirstFrame = true;
spell = NONE;
}
break;
case SPELL_CONFUSE :
if (confuseFirstFrame) {
confuseFirstFrame = false;
confuse.target.Set(harry.position.x, harry.position.y);
confuse._x = confuse.position.x;
confuse._y = confuse.position.y;
confuseSeekTimeElapsed = 0;
confuseSeekTimeStart = getTimer();
confuse.Show();
moody.behavior = BEHAVIOR_WAIT;
jukebox.PlaySound("Spell.Confuse");
} else if (confuse.position.DetectCollision(harry.position, confuseRadius) && (!useShield)) {
harry.isConfuse = true;
harryChaseSpeed = confuseChaseSpeed;
confuseTimeStart = getTimer();
confuseTimeElapsed = 0;
confuseFirstFrame = true;
spell = NONE;
moody.behavior = BEHAVIOR_IDLE;
} else {
confuseSeekTimeElapsed = getTimer() - confuseSeekTimeStart;
if (confuseSeekTimeElapsed < confuseSeekDuration) {
confuse.target.x = confuse.target.x + ((harry.position.x > confuse.position.x) ? (confuseSeekSpeed) : (-confuseSeekSpeed));
confuse.target.Y = confuse.target.Y + ((harry.position.y > confuse.position.y) ? (confuseSeekSpeed) : (-confuseSeekSpeed));
confuse.position.Chase(confuse.target, confuseSeekChaseSpeed);
confuse._x = confuse.position.x;
confuse._y = confuse.position.y;
} else {
confuse.Hide();
moody.behavior = BEHAVIOR_IDLE;
confuseFirstFrame = true;
spell = NONE;
}
}
}
if (tile.isOpen && (spell != SPELL_SPIDER)) {
tile.gotoAndPlay("CLOSE");
tile.isOpen = false;
}
}
function SpiderAdd() {
var _local1 = null;
i = 0;
while (i < listSpider.length) {
_local1 = listSpider[i];
if (!_local1.isAlive) {
SpiderRespawn(_local1);
return;
}
i++;
}
}
function SpiderRemove() {
var _local1 = null;
i = 0;
while (i < listSpider.length) {
_local1 = listSpider[i];
_local1.isAlive = false;
_local1._x = -25;
_local1._y = -25;
_local1._visible = false;
i++;
}
spiderNumber = 0;
}
function SpiderRespawn(mc) {
var _local1 = mc;
_local1.position = spiderStartPosition.Clone();
_local1.target = spiderStartPosition.Clone();
_local1._x = _local1.position.x;
_local1._y = _local1.position.y;
_local1._visible = true;
_local1.isAlive = true;
_local1.timeStart = getTimer();
_local1.timeElapsed = 0;
_local1.isAlive = true;
spiderNumber++;
}
function SpiderGenerate() {
var _local1 = this;
var _local2 = null;
i = 0;
while (i < spiderNumberMax) {
_local2 = spider.duplicateMovieClip("spell.spider_" + i, root.depth++);
_local2.position = new Vector(WIDTH / 2, HEIGHT / 2, 0);
_local2._x = -25;
_local2._y = -25;
_local2._visible = true;
_local2.target = new Vector(WIDTH / 2, HEIGHT / 2, 0);
_local2.velocity = new Vector(0, 0, 0);
_local2.isAlive = false;
_local2.timeStart = 0;
_local2.timeElapsed = 0;
_local2.onEnterFrame = function () {
var _local1 = this;
if (gamestate == STATE_PLAY) {
if (_local1.isAlive) {
if (_local1.position.DetectCollision(harry.position, spiderRadius)) {
LostLife();
}
_local1.target.x = _local1.target.x + ((Math.random() * spiderSpeed) - (spiderSpeed / 2));
_local1.target.y = _local1.target.y + ((Math.random() * spiderSpeed) - (spiderSpeed / 2));
_local1.position.Chase(_local1.target, spiderChaseSpeed);
_local1._x = _local1.position.x;
_local1._y = _local1.position.y;
if (_local1.timeElapsed > spiderLifetime) {
_local1.isAlive = false;
} else if (!IsInStage(_local1, WIDTH, HEIGHT)) {
_local1.isAlive = false;
} else {
_local1.timeElapsed = getTimer() - _local1.timeStart;
}
if (!_local1.isAlive) {
spiderNumber--;
_local1._x = -25;
_local1._y = -25;
_local1._visible = false;
}
}
}
};
listSpider.push(_local2);
i++;
}
}
function GenerateSpellBuffer() {
SpiderGenerate();
}
var listSpider = new Array();
function InitCursor() {
cursor.position = new Vector(WIDTH / 2, HEIGHT / 2, 0);
cursor._x = cursor.position.x;
cursor._y = cursor.position.y;
}
function UpdateCursor() {
cursor.position.Set(_xmouse, _ymouse, 0);
cursor._x = cursor.position.x;
cursor._y = cursor.position.y;
if (gamestate != STATE_PLAY) {
cursor.Show();
} else {
cursor.Hide();
}
}
function InitItem() {
item = null;
itemBook.Hide();
itemCauldron.Hide();
itemLife.Hide();
itemShield.Hide();
}
function UpdateItem() {
if (item == null) {
if (Math.random() < probabilityItemRespawn) {
switch (random(2)) {
case 0 :
item = itemPoint;
break;
case 1 :
item = itemCauldron;
}
Respawn(item, WIDTH - (wallNorthEast._x * 2), HEIGHT - (wallNorthEast._y * 2));
item._x = item._x + wallNorthEast._x;
item._y = item._y + wallNorthEast._y;
if (item != null) {
item.Show();
}
}
} else if (item.isReadyToCatch) {
if (DetectCollisionWithBox(item, harry.collision)) {
sparkle._x = item._x;
sparkle._y = item._y;
sparkle.gotoAndPlay("ANIM");
sparkle.Show();
jukebox.PlaySound("Item");
item.Hide();
switch (item.ID) {
case ID_ITEM_BOOK :
ItemBonus(bonusBook);
bonus10k._x = sparkle._x;
bonus10k._y = sparkle._y;
bonus10k.gotoAndPlay("ANIM");
bonus10k.Show();
break;
case ID_ITEM_CAULDRON :
ItemBonus(bonusCauldron);
bonus5k._x = sparkle._x;
bonus5k._y = sparkle._y;
bonus5k.gotoAndPlay("ANIM");
bonus5k.Show();
break;
case ID_ITEM_LIFE :
AddLife();
break;
case ID_ITEM_SHIELD :
useShield = true;
feedback.Display("invincibility shield");
IDCallbackShieldExprired = setInterval(CallbackShieldExprired, durationShield);
}
item = null;
}
}
if (item != null) {
item.Update();
}
if (useShield) {
shield.Show();
shield._x = harry.position.x;
shield._y = harry.position.y;
} else {
shield.Hide();
}
}
function CallbackShieldExprired() {
useShield = false;
shield.Hide();
feedback.Display("shield expired");
clearInterval(IDCallbackShieldExprired);
}
function InitHUD() {
score = 0;
life.gotoAndStop("LIFE" + nbOfLife);
scoreUI.Display(score, true);
var frame = 0;
}
function UpdateConsole() {
if (DEBUG) {
var _local1 = "";
switch (gamestate) {
case STATE_START :
_local1 = _local1 + "<game : START>\n";
break;
case STATE_INIT :
_local1 = _local1 + "<game : INIT>\n";
break;
case STATE_PLAY :
_local1 = _local1 + "<game : PLAY>\n";
break;
case STATE_PAUSE :
_local1 = _local1 + "<game : PAUSE>\n";
break;
case STATE_GAMEOVER :
_local1 = _local1 + "<game : GAMEOVER>\n";
}
switch (moody.behavior) {
case BEHAVIOR_IDLE :
_local1 = _local1 + "<moody : IDLE>\n";
break;
case BEHAVIOR_MOVE :
_local1 = _local1 + "<moody : MOVE>\n";
break;
case BEHAVIOR_WANDER :
_local1 = _local1 + "<moody : WANDER>\n";
break;
case BEHAVIOR_BLINK :
_local1 = _local1 + "<moody : BLINK>\n";
break;
case BEHAVIOR_SCAN :
_local1 = _local1 + "<moody : SCAN>\n";
break;
case BEHAVIOR_SEEK :
_local1 = _local1 + "<moody : SEEK>\n";
break;
case BEHAVIOR_SPELL :
_local1 = _local1 + "<moody : SPELL>\n";
break;
case BEHAVIOR_WAIT :
_local1 = _local1 + "<moody : WAIT>\n";
break;
case BEHAVIOR_LOOK :
_local1 = _local1 + "<moody : LOOK>\n";
}
switch (madeye.behavior) {
case BEHAVIOR_IDLE :
_local1 = _local1 + "<madeye : IDLE>\n";
break;
case BEHAVIOR_MOVE :
_local1 = _local1 + "<madeye : MOVE>\n";
break;
case BEHAVIOR_WANDER :
_local1 = _local1 + "<madeye : WANDER>\n";
break;
case BEHAVIOR_BLINK :
_local1 = _local1 + "<madeye : BLINK>\n";
break;
case BEHAVIOR_SCAN :
_local1 = _local1 + "<madeye : SCAN>\n";
break;
case BEHAVIOR_SEEK :
_local1 = _local1 + "<madeye : SEEK>\n";
break;
case BEHAVIOR_SPEEL :
_local1 = _local1 + "<madeye : SPELL>\n";
break;
case BEHAVIOR_HIDE :
_local1 = _local1 + "<madeye : HIDE>\n";
}
_local1 = _local1 + (("<collidable : " + madeye.isCollidable) + ">\n");
console.Display(_local1);
} else {
console.Display("");
}
}
this.onEnterFrame = Launch;
Instance of Symbol 208 MovieClip "tile" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
stop();
}
var startX = _x;
var startY = _y;
var isOpening = false;
var isOpen = false;
Hide();
}
Instance of Symbol 228 MovieClip "spider" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 230 MovieClip "itemCauldron" in Frame 40
onClipEvent (load) {
function Update() {
timeElapsed = getTimer() - timeStart;
if (timeElapsed > timeDuration) {
Hide();
game.item = null;
}
}
function Show() {
gotoAndPlay ("RESPAWN");
timeStart = getTimer();
timeElapsed = 0;
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
isReadyToCatch = false;
}
function CallbackCatch() {
Hide();
}
var ID = ID_ITEM_CAULDRON;
var startX = _x;
var startY = _y;
var timeStart = 0;
var timeElapsed = 0;
var timeDuration = 10000;
var isReadyToCatch = false;
Hide();
}
Instance of Symbol 232 MovieClip "itemPoint" in Frame 40
onClipEvent (load) {
function Update() {
timeElapsed = getTimer() - timeStart;
if (timeElapsed > timeDuration) {
Hide();
game.item = null;
}
}
function Show() {
gotoAndPlay ("RESPAWN");
timeStart = getTimer();
timeElapsed = 0;
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
isReadyToCatch = false;
}
function CallbackCatch() {
Hide();
}
var ID = ID_ITEM_BOOK;
var startX = _x;
var startY = _y;
var timeStart = 0;
var timeElapsed = 0;
var timeDuration = 5000;
var isReadyToCatch = false;
Hide();
}
Instance of Symbol 337 MovieClip "moody" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
Hide();
}
Instance of Symbol 339 MovieClip "sparkle1" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var target = game.madeye;
var startX = _x;
var startY = _y;
_x = target._x;
_y = target._y;
}
onClipEvent (enterFrame) {
if (target._visible) {
if (root.gamestate == STATE_PLAY) {
_x = (_x + ((target._x - _x) * game.sparkleChaseSpeed));
_y = (_y + ((target._y - _y) * game.sparkleChaseSpeed));
Show();
}
} else {
Hide();
}
}
Instance of Symbol 339 MovieClip "sparkle3" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var target = game.sparkle2;
var startX = _x;
var startY = _y;
_x = target._x;
_y = target._y;
}
onClipEvent (enterFrame) {
if (target._visible) {
if (root.gamestate == STATE_PLAY) {
_x = (_x + ((target._x - _x) * game.sparkleChaseSpeed));
_y = (_y + ((target._y - _y) * game.sparkleChaseSpeed));
Show();
}
} else {
Hide();
}
}
Instance of Symbol 339 MovieClip "sparkle2" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var target = game.sparkle1;
var startX = _x;
var startY = _y;
_x = target._x;
_y = target._y;
}
onClipEvent (enterFrame) {
if (target._visible) {
if (root.gamestate == STATE_PLAY) {
_x = (_x + ((target._x - _x) * game.sparkleChaseSpeed));
_y = (_y + ((target._y - _y) * game.sparkleChaseSpeed));
Show();
}
} else {
Hide();
}
}
Instance of Symbol 344 MovieClip "harry" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
root.spakle1.Hide();
root.spakle2.Hide();
root.spakle3.Hide();
}
var startX = _x;
var startY = _y;
}
Instance of Symbol 363 MovieClip "madeye" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
position.x = startX;
position.y = startY;
_x = position.x;
_y = position.y;
_visible = false;
}
var startX = _x;
var startY = _y;
Hide();
}
Instance of Symbol 365 MovieClip "death" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
root.item.Hide();
root.ResetSpell();
root.confuse.Hide();
root.messageBox.Show(root.messageGameOver, root.callbackGameOver);
stop();
}
var startX = _x;
var startY = _y;
Hide();
stop();
}
Instance of Symbol 367 MovieClip "sparkle" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
Hide();
stop();
}
Instance of Symbol 370 MovieClip "console" in Frame 40
onClipEvent (load) {
function Display(s) {
if (DEBUG) {
txt.text = s;
}
}
}
Instance of Symbol 372 MovieClip in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 375 MovieClip "scoreUI" in Frame 40
onClipEvent (load) {
function Display(s, isBonus) {
txt.text = s;
if (isBonus) {
txt.SetTextFormat(txtFormatBonus);
} else {
txt.SetTextFormat(txtFormatMalus);
}
}
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
var txtFormatBonus = new TextFormat();
var txtFormatMalus = new TextFormat();
txtFormatBonus.color = 16777215 /* 0xFFFFFF */;
txtFormatMalus.color = 13369344 /* 0xCC0000 */;
Hide();
}
Instance of Symbol 378 MovieClip "feedback" in Frame 40
onClipEvent (load) {
function Display(s) {
txt.text = s;
clearInterval(IDCallbackFeedbackClear);
IDCallbackFeedbackClear = setInterval(CallbackFeedbackClear, game.durationFeedback);
}
function CallbackFeedbackClear() {
txt.text = "";
clearInterval(IDCallbackFeedbackClear);
}
var IDCallbackFeedbackClear = 0;
}
Instance of Symbol 387 MovieClip "mute" in Frame 40
onClipEvent (load) {
root.isVolumeMute = false;
root.volumeDefault = 100;
root.volumeMute = 0;
root.sound = new Sound(root);
root.sound.setVolume(root.volumeDefault);
}
Instance of Symbol 390 MovieClip "messageBox" in Frame 40
onClipEvent (load) {
function Show(str, callback) {
message = str;
callbackFunction = callback;
_x = (WIDTH / 2);
_y = (HEIGHT / 2);
_visible = true;
gotoAndPlay ("ANIM");
root._quality = "HIGH";
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
root._quality = "MEDIUM";
}
startX = _x;
startY = _y;
var callbackFunction;
var message = "";
Hide();
}
Instance of Symbol 426 MovieClip "windowHighscore" in Frame 40
onClipEvent (load) {
function Show(callback) {
callbackFunction = callback;
Fill();
_x = 276;
_y = 162;
_visible = true;
root._quality = "HIGH";
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
root._quality = "MEDIUM";
}
function Fill() {
txtName01.text = game.highscore.Rank(1).name;
txtName02.text = game.highscore.Rank(2).name;
txtName03.text = game.highscore.Rank(3).name;
txtName04.text = game.highscore.Rank(4).name;
txtName05.text = game.highscore.Rank(5).name;
txtName06.text = game.highscore.Rank(6).name;
txtName07.text = game.highscore.Rank(7).name;
txtName08.text = game.highscore.Rank(8).name;
txtName09.text = game.highscore.Rank(9).name;
txtName10.text = game.highscore.Rank(10).name;
txtScore01.text = game.highscore.Rank(1).value;
txtScore02.text = game.highscore.Rank(2).value;
txtScore03.text = game.highscore.Rank(3).value;
txtScore04.text = game.highscore.Rank(4).value;
txtScore05.text = game.highscore.Rank(5).value;
txtScore06.text = game.highscore.Rank(6).value;
txtScore07.text = game.highscore.Rank(7).value;
txtScore08.text = game.highscore.Rank(8).value;
txtScore09.text = game.highscore.Rank(9).value;
txtScore10.text = game.highscore.Rank(10).value;
}
startX = _x;
startY = _y;
var callbackFunction;
_visible = false;
}
Instance of Symbol 431 MovieClip "inputBox" in Frame 40
onClipEvent (load) {
function Show(callback) {
message = str;
callbackFunction = callback;
_x = (WIDTH / 2);
_y = (HEIGHT / 2);
_visible = true;
gotoAndPlay ("ANIM");
root._quality = "HIGH";
}
function Hide() {
value = txtInput.text;
_x = startX;
_y = startY;
_visible = false;
root._quality = "MEDIUM";
isOpen = false;
}
var startX = _x;
var startY = _y;
var isOpen = false;
var callbackFunction;
var message = "";
var value = "anonyme";
Hide();
}
Instance of Symbol 435 MovieClip in Frame 40
onClipEvent (load) {
_visible = false;
_global.markerSouthWest = this;
var position = new Vector(_x, _y, 0);
}
Instance of Symbol 435 MovieClip in Frame 40
onClipEvent (load) {
_visible = false;
_global.markerNorthEast = this;
var position = new Vector(_x, _y, 0);
}
Instance of Symbol 435 MovieClip "wallNorthEast" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "wallNorthWest" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "wallSouthEast" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "wallSouthWest" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 437 MovieClip "_cursor" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
Hide();
}
Instance of Symbol 439 MovieClip "target" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
Hide();
}
Instance of Symbol 435 MovieClip "tile00" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "tile02" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "tile07" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "tile05" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "tile01" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "tile06" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "tile03" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 435 MovieClip "tile04" in Frame 40
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 31 MovieClip "cursor" in Frame 40
onClipEvent (load) {
function Show() {
feather._visible = true;
}
function Hide() {
feather._visible = false;
}
var startX = _x;
var startY = _y;
Hide();
}
Instance of Symbol 440 MovieClip "confuse" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
var position = new Vector(0, 0, 0);
var target = new Vector(0, 0, 0);
Hide();
}
Instance of Symbol 444 MovieClip "bonus10k" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
gotoAndStop ("HIDE");
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
Hide();
}
Instance of Symbol 448 MovieClip "bonus5k" in Frame 40
onClipEvent (load) {
function Show() {
_visible = true;
}
function Hide() {
gotoAndStop ("HIDE");
_x = startX;
_y = startY;
_visible = false;
}
var startX = _x;
var startY = _y;
Hide();
}
Symbol 17 MovieClip Frame 6
stop();
Symbol 18 MovieClip Frame 2
txtLoadedWhite._visible = false;
txtLoadedBlack._visible = false;
Instance of Symbol 8 MovieClip "txtLoadedBlack" in Symbol 18 MovieClip Frame 2
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 8 MovieClip "txtLoadedWhite" in Symbol 18 MovieClip Frame 2
onClipEvent (load) {
_visible = false;
}
Symbol 18 MovieClip Frame 17
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
Symbol 18 MovieClip Frame 23
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 28
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 33
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 37
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 41
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 46
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 50
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 54
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 59
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 64
txtLoadedWhite._visible = true;
txtLoadedBlack._visible = true;
stop();
Symbol 18 MovieClip Frame 93
root.gotoAndPlay("LOADED");
Symbol 450 MovieClip [__Packages.Highscore] Frame 0
class Highscore
{
var size, highscore;
function Highscore (s) {
var _local1 = this;
_local1.name = s;
_local1.so = null;
_local1.highscore = new Array();
_local1.size = 10;
}
function Destroy() {
var _local1 = this;
_local1.so.data.highscore = null;
_local1.so.flush();
_local1.highscore = new Array();
}
function Init() {
var _local1 = this;
_local1.so = SharedObject.getLocal(_local1.name);
if ((_local1.so.data.highscore == null) || (_local1.so.data.highscore == undefined)) {
_local1.Reset();
_local1.Fill();
}
_local1.highscore = _local1.so.data.highscore;
}
function Reset() {
var _local3 = this;
var _local1;
_local3.highscore = new Array();
var _local2 = 0;
while (_local2 < _local3.size) {
_local1 = new Object();
_local1.name = "-";
_local1.value = 0;
_local3.highscore.push(_local1);
_local2++;
}
_local3.Commit();
}
function Fill() {
var _local1 = this;
_local1.Submit("Philippe", 1000000);
_local1.Submit("Mell", 750000);
_local1.Submit("Stephan", 500000);
_local1.Submit("Max", 350000);
_local1.Submit("Steven", 300000);
_local1.Submit("Sylvester", 250000);
_local1.Submit("MissME", 200000);
_local1.Submit("Matthew", 150000);
_local1.Submit("Chris", 100000);
_local1.Submit("Brown", 50000);
}
function Commit() {
var _local1 = this;
_local1.so.data.highscore = _local1.highscore;
_local1.so.flush();
}
function Submit(name, score) {
var _local2 = this;
var _local3 = score;
var _local1;
_local1 = _local2.size - 1;
if (_local3 > _local2.highscore[_local1].value) {
_local1 = 0;
while (_local3 < _local2.highscore[_local1].value) {
_local1++;
}
var obj = new Object();
obj.name = name;
obj.value = _local3;
_local2.highscore.splice(_local1, 0, obj);
_local2.highscore = _local2.highscore.slice(0, _local2.size);
_local2.Commit();
return(true);
}
return(false);
}
function IsQualified(score) {
var _local1;
_local1 = size - 1;
if (score > highscore[_local1].value) {
return(true);
}
return(false);
}
function Rank(n) {
return(highscore[n - 1]);
}
function toString() {
var _local2 = this;
var _local3;
_local3 = "";
_local3 = _local3 + (("<Highscore \"" + _local2.name) + "\">\n");
var _local1 = 0;
while (_local1 < _local2.highscore.length) {
_local3 = _local3 + (((("\t<name :" + _local2.highscore[_local1].name) + "\tscore :") + _local2.highscore[_local1].value) + ">\n");
_local1++;
}
_local3 = _local3 + "</Highscore>\n";
return(_local3);
}
}
Symbol 451 MovieClip [__Packages.Vector] Frame 0
class Vector
{
var x, y, z;
function Vector (x, y, z) {
var _local1 = this;
_local1.x = x;
_local1.y = y;
_local1.z = z;
}
function Set(x, y, z) {
var _local1 = this;
_local1.x = x;
_local1.y = y;
_local1.z = z;
}
function Reset(x, y, z) {
var _local1 = this;
_local1.x = 0;
_local1.y = 0;
_local1.z = 0;
}
function Clone() {
var _local1 = this;
return(new Vector(_local1.x, _local1.y, _local1.z));
}
function Equal(v) {
var _local1 = v;
var _local2 = this;
return(((_local2.x == _local1.x) && (_local2.y == _local1.y)) && (_local2.z == _local1.z));
}
function Similar(v, precision) {
var f = 1;
var _local1 = 0;
while (_local1 < precision) {
f = f * 10;
_local1++;
}
var _local3 = Clone();
var _local2 = v.Clone();
_local3 = _local3.Scale(f);
_local2 = _local2.Scale(f);
_local3.x = Math.round(_local3.x);
_local3.y = Math.round(_local3.y);
_local3.z = Math.round(_local3.z);
_local2.x = Math.round(_local2.x);
_local2.y = Math.round(_local2.y);
_local2.z = Math.round(_local2.z);
return(((_local3.x == _local2.x) && (_local3.y == _local2.y)) && (_local3.z == _local2.z));
}
function Scale(n) {
var _local1 = n;
var _local2 = this;
return(new Vector(_local2.x * _local1, _local2.y * _local1, _local2.z * _local1));
}
function Negate() {
var _local1 = this;
_local1.x = -_local1.x;
_local1.y = -_local1.y;
_local1.z = -_local1.z;
}
function Plus(v) {
var _local1 = v;
var _local2 = this;
return(new Vector(_local2.x + _local1.x, _local2.y + _local1.y, _local2.z + _local1.z));
}
function Minus(v) {
var _local1 = v;
var _local2 = this;
return(new Vector(_local2.x - _local1.x, _local2.y - _local1.y, _local2.z - _local1.z));
}
function Product(v) {
var _local1 = v;
var _local2 = this;
return(new Vector(_local2.x * _local1.x, _local2.y * _local1.y, _local2.z * _local1.z));
}
function Divide(v) {
var _local1 = v;
var _local2 = this;
return(new Vector(_local2.x / _local1.x, _local2.y / _local1.y, _local2.z / _local1.z));
}
function Magnitude() {
var _local1 = this;
return(Math.sqrt(((_local1.x * _local1.x) + (_local1.y * _local1.y)) + (_local1.z * _local1.z)));
}
function Distance(v) {
return(v.Minus(this).Magnitude());
}
function IsNull() {
var _local1 = this;
return(((_local1.x == 0) && (_local1.y == 0)) && (_local1.z == 0));
}
function IsUnit() {
return(Magnitude() == 1);
}
function Normalize() {
var _local1 = this;
if (!_local1.IsNull()) {
var _local2 = _local1.Magnitude();
_local1.x = _local1.x / _local2;
_local1.y = _local1.y / _local2;
_local1.z = _local1.z / _local2;
}
}
function Dot(v) {
var _local1 = v;
var _local2 = this;
return(((_local2.x * _local1.x) + (_local2.y * _local1.y)) + (_local2.z * _local1.z));
}
function Cross(v) {
var _local1 = v;
var _local2 = this;
var cx = ((_local2.y * _local1.z) - (_local2.z * _local1.y));
var cy = ((_local2.z * _local1.x) - (_local2.x * _local1.z));
var _local3 = (_local2.x * _local1.y) - (_local2.y * _local1.x);
return(new Vector(cx, cy, _local3));
}
function Angle(v) {
var _local1 = v;
var _local2 = this;
if (_local2.IsNull()) {
return(0);
}
if (_local1.IsNull()) {
return(0);
}
if (_local1.Similar(_local2, 4)) {
return(0);
}
var _local3 = _local2.Magnitude() * _local1.Magnitude();
if (_local3 == 0) {
return(0);
}
var n = Math.acos(_local2.Dot(_local1) / _local3);
if (isNaN(n)) {
} else {
return(Math.acos(_local2.Dot(_local1) / _local3));
}
return(undefined);
}
function Projection(v) {
var _local1 = v;
return(_local1.Scale(Dot(_local1) / Math.pow(_local1.Magnitude(), 2)));
}
function Perpendiculaire(v) {
return(v.Minus(Projection(v)));
}
function DetectCollision(v, treshold) {
return(Minus(v).Magnitude() < treshold);
}
function Chase(v, speed) {
var _local1 = this;
var _local2 = v;
var _local3 = speed;
_local1.x = _local1.x + ((_local2.x - _local1.x) * _local3);
_local1.y = _local1.y + ((_local2.y - _local1.y) * _local3);
_local1.z = _local1.z + ((_local2.z - _local1.z) * _local3);
}
function RotateX(theta) {
var _local1 = this;
var _local2 = Math.sin(theta);
var _local3 = Math.cos(theta);
return(new Vector(_local1.x, (_local1.y * _local3) - (_local1.z * _local2), (_local1.y * _local2) + (_local1.z * _local3)));
}
function RotateY(theta) {
var _local1 = this;
var _local2 = Math.sin(theta);
var _local3 = Math.cos(theta);
return(new Vector((_local1.x * _local3) + (_local1.z * _local2), _local1.y, (_local1.x * (-_local2)) + (_local1.z * _local3)));
}
function RotateZ(theta) {
var _local1 = this;
var _local2 = Math.sin(theta);
var _local3 = Math.cos(theta);
return(new Vector((_local1.x * _local3) - (_local1.y * _local2), (_local1.x * _local2) + (_local1.y * _local3), _local1.z));
}
function Noise(amplitude) {
var _local1 = amplitude;
var vx = (x + ((Math.random() * (_local1 * 2)) - _local1));
var _local3 = y + ((Math.random() * (_local1 * 2)) - _local1);
var _local2 = z + ((Math.random() * (_local1 * 2)) - _local1);
return(new Vector(vx, _local3, _local2));
}
function Respawn(space) {
var _local1 = space;
var _local2 = this;
_local2.x = Math.random() * _local1.x;
_local2.y = Math.random() * _local1.y;
_local2.z = Math.random() * _local1.z;
}
function toString() {
var _local3 = Math.round(x * 1000) / 1000;
var _local2 = Math.round(y * 1000) / 1000;
var _local1 = Math.round(z * 1000) / 1000;
return(((((("(" + _local3) + ",") + _local2) + ",") + _local1) + ")");
}
}
Symbol 452 MovieClip [__Packages.Oscillator] Frame 0
class Oscillator
{
var m_IsStarted, m_Value, m_Amplitude, m_Frequency, m_Period, m_Shift, m_Offset;
function Oscillator () {
Init();
}
function Init() {
var _local1 = this;
_local1.m_Amplitude = 0;
_local1.m_Frequency = 0;
_local1.m_Period = 0;
_local1.m_Shift = 0;
_local1.m_Offset = 0;
_local1.m_IsStarted = false;
_local1.m_Value = 0;
_local1.m_ValueLast = 0;
_local1.m_Delta = 0;
_local1.m_Time = 0;
_local1.m_TimeFrameCurrent = getTimer();
_local1.m_TimeFrameLast = getTimer();
_local1.m_TimeElapsed = 0;
_local1.m_FirstFrame = true;
}
function IsStarted() {
return(m_IsStarted);
}
function Start() {
m_IsStarted = true;
}
function Stop() {
m_IsStarted = false;
}
function Value() {
return(m_Value);
}
function Delta() {
var _local1 = this;
if (_local1.m_FirstFrame) {
_local1.m_FirstFrame = false;
return(0);
}
return(_local1.m_Delta);
}
function Amplitude() {
return(m_Amplitude);
}
function Frequency() {
return(m_Frequency);
}
function Period() {
return(m_Period);
}
function Shift() {
return(m_Shift);
}
function Offset() {
return(m_Offset);
}
function SetAmplitude(n) {
m_Amplitude = n;
}
function SetFrequency(n) {
var _local1 = this;
_local1.m_Frequency = n;
_local1.m_Period = 1 / _local1.m_Frequency;
}
function SetPeriod(n) {
var _local1 = this;
_local1.m_Period = n;
_local1.m_Frequency = 1 / _local1.m_Period;
}
function SetShift(n) {
m_Shift = n;
}
function SetOffset(n) {
m_Offset = n;
}
function Oscillate() {
var _local1 = this;
return((_local1.m_Amplitude * Math.sin(((_local1.m_Time - _local1.m_Shift) * (Math.PI*2)) / _local1.m_Period)) + _local1.m_Offset);
}
function Reset() {
var _local1 = this;
_local1.m_Value = 0;
_local1.m_ValueLast = 0;
_local1.m_Delta = 0;
_local1.m_Time = 0;
_local1.m_TimeFrameCurrent = 0;
_local1.m_TimeElapsed = 0;
_local1.m_TimeFrameLast = 0;
_local1.m_FirstFrame = true;
}
function UpdateTime() {
var _local1 = this;
_local1.m_TimeFrameCurrent = getTimer();
_local1.m_TimeElapsed = _local1.m_TimeFrameCurrent - _local1.m_TimeFrameLast;
_local1.m_TimeFrameLast = _local1.m_TimeFrameCurrent;
_local1.m_Time = _local1.m_Time + _local1.m_TimeElapsed;
}
function Update() {
var _local1 = this;
if (_local1.m_IsStarted) {
_local1.m_ValueLast = _local1.m_Value;
_local1.m_Value = _local1.Oscillate();
_local1.m_Delta = _local1.m_Value - _local1.m_ValueLast;
_local1.UpdateTime();
}
}
function toString() {
var _local2 = this;
var _local1 = "";
_local1 = _local1 + "<Oscillator>\n";
_local1 = _local1 + (("\t<amplitude :" + _local2.m_Amplitude) + newline);
_local1 = _local1 + (("\t<frequency :" + _local2.m_Frequency) + newline);
_local1 = _local1 + (("\t<period :" + _local2.m_Period) + newline);
_local1 = _local1 + (("\t<shift :" + _local2.m_Shift) + newline);
_local1 = _local1 + (("\t<offset :" + _local2.m_Offset) + newline);
_local1 = _local1 + (("\t<value :" + (Math.round(_local2.m_Value * 100) / 100)) + newline);
_local1 = _local1 + (("\t<delta :" + (Math.round(_local2.m_Delta * 100) / 100)) + newline);
_local1 = _local1 + "</Oscillator>";
return(_local1);
}
}
Symbol 453 MovieClip [__Packages.Tween] Frame 0
class Tween
{
var m_IsStarted, m_IsFinish, m_IsReverse, m_Position, m_LastPosition;
function Tween () {
Reset();
}
function Reset() {
var _local1 = this;
_local1.m_Type = TYPE_LINEAR;
_local1.m_LoopType = LOOP_ONCE;
_local1.m_Mode = MODE_TIME_BASED;
_local1.m_Position = 0;
_local1.m_LastPosition = 0;
_local1.m_Start = 0;
_local1.m_Finish = 0;
_local1.m_Delta = 0;
_local1.m_Frame = 0;
_local1.m_Duration = 0;
_local1.m_IsStarted = false;
_local1.m_IsFinish = false;
_local1.m_IsReverse = false;
_local1.m_Follower = null;
_local1.m_Previous = null;
_local1.m_Next = null;
_local1.m_TimeCurrent = 0;
_local1.m_TimeElapsed = 0;
_local1.m_TimeLastFrame = 0;
}
function Init(type, loopType, startValue, deltaValue, duration) {
var _local1 = this;
_local1.Reset();
_local1.m_Type = type;
_local1.m_LoopType = loopType;
_local1.m_Start = startValue;
_local1.m_Delta = deltaValue;
_local1.m_Duration = duration;
_local1.m_Position = _local1.m_Start;
_local1.m_LastPosition = _local1.m_Position;
_local1.m_TimeCurrent = 0;
_local1.m_TimeElapsed = 0;
_local1.m_TimeLastFrame = 0;
}
function Start() {
var _local1 = this;
_local1.m_IsStarted = true;
_local1.m_IsFinish = false;
_local1.m_TimeLastFrame = getTimer();
}
function Stop() {
m_IsStarted = false;
}
function Rewind() {
var _local1 = this;
_local1.m_Frame = 0;
_local1.m_IsStarted = false;
_local1.m_IsFinish = false;
_local1.m_Position = _local1.m_Start;
_local1.m_LastPosition = _local1.m_Position;
_local1.m_TimeCurrent = 0;
_local1.m_TimeElapsed = 0;
_local1.m_TimeLastFrame = 0;
}
function IsStarted() {
return(m_IsStarted);
}
function IsFinish() {
return(m_IsFinish);
}
function IsReverse() {
return(m_IsReverse);
}
function Position() {
return(m_Position);
}
function PositionDelta() {
return(m_Position - m_LastPosition);
}
function Update() {
var _local1 = this;
if (_local1.m_IsStarted) {
_local1.m_TimeCurrent = getTimer();
_local1.m_TimeElapsed = _local1.m_TimeCurrent - _local1.m_TimeLastFrame;
_local1.m_TimeLastFrame = _local1.m_TimeCurrent;
if (!_local1.m_IsReverse) {
switch (_local1.m_Mode) {
case MODE_FRAME_BASED :
_local1.m_Frame++;
break;
case MODE_TIME_BASED :
_local1.m_Frame = _local1.m_Frame + _local1.m_TimeElapsed;
}
if (_local1.m_Frame > _local1.m_Duration) {
_local1.m_Frame = _local1.m_Duration;
}
if (_local1.m_Frame >= 0) {
_local1.HandleTween();
}
if (_local1.m_Frame >= _local1.m_Duration) {
_local1.HandleEndTween();
}
} else {
switch (_local1.m_Mode) {
case MODE_FRAME_BASED :
_local1.m_Frame--;
break;
case MODE_TIME_BASED :
_local1.m_Frame = _local1.m_Frame - _local1.m_TimeElapsed;
}
if (_local1.m_Frame < 0) {
_local1.m_Frame = 0;
}
if (_local1.m_Frame <= _local1.m_Duration) {
_local1.HandleTween();
}
if (_local1.m_Frame <= 0) {
_local1.HandleEndTween();
}
}
} else if (_local1.m_Follower != null) {
_local1.m_Follower.Update(_local1.m_TimeElapsed);
}
}
function HandleTween() {
var _local1 = this;
_local1.m_LastPosition = _local1.m_Position;
switch (_local1.m_Type) {
case TYPE_LINEAR :
_local1.m_Position = Linear(_local1.m_Frame, _local1.m_Start, _local1.m_Delta, _local1.m_Duration);
return;
case TYPE_QUADRATIC_IN :
_local1.m_Position = QuadraticEaseIn(_local1.m_Frame, _local1.m_Start, _local1.m_Delta, _local1.m_Duration);
return;
case TYPE_QUADRATIC_OUT :
_local1.m_Position = QuadraticEaseOut(_local1.m_Frame, _local1.m_Start, _local1.m_Delta, _local1.m_Duration);
return;
case TYPE_QUADRATIC_IN_OUT :
_local1.m_Position = QuadraticEaseInOut(_local1.m_Frame, _local1.m_Start, _local1.m_Delta, _local1.m_Duration);
return;
case TYPE_CUBIC_IN :
_local1.m_Position = CubicEaseIn(_local1.m_Frame, _local1.m_Start, _local1.m_Delta, _local1.m_Duration);
return;
case TYPE_CUBIC_OUT :
_local1.m_Position = CubicEaseOut(_local1.m_Frame, _local1.m_Start, _local1.m_Delta, _local1.m_Duration);
return;
case TYPE_CUBIC_IN_OUT :
_local1.m_Position = CubicEaseInOut(_local1.m_Frame, _local1.m_Start, _local1.m_Delta, _local1.m_Duration);
}
}
function HandleEndTween() {
var _local1 = this;
switch (_local1.m_LoopType) {
case LOOP_ONCE :
stop();
if (!_local1.m_IsReverse) {
if (_local1.m_Next != null) {
_local1.m_Follower = _local1.m_Next;
_local1.m_Follower.Start();
} else {
_local1.m_IsFinish = true;
_local1.m_IsStarted = false;
}
} else if (_local1.m_Previous != null) {
_local1.m_Follower = _local1.m_Previous;
_local1.m_Follower.Start();
} else {
_local1.m_IsFinish = true;
_local1.m_IsStarted = false;
}
return;
case LOOP_LOOP :
if (!_local1.m_IsReverse) {
if (_local1.m_Next != null) {
stop();
_local1.m_Follower = _local1.m_Next;
_local1.m_Follower.Start();
} else {
_local1.Rewind();
stop();
var _local2 = _local1;
while (_local2.Previous() != null) {
_local2 = _local2.Previous();
_local2.Rewind();
_local2.Stop();
}
_local2.Start();
}
} else if (_local1.m_Previous != null) {
stop();
_local1.m_Follower = _local1.m_Previous;
_local1.m_Follower.Start();
} else {
_local1.Rewind();
stop();
var _local2 = _local1;
while (_local2.Next() != null) {
_local2 = _local2.Next();
_local2.Rewind();
_local2.Stop();
}
_local2.Start();
}
return;
case LOOP_YOYO :
if (!_local1.m_IsReverse) {
_local1.m_IsReverse = true;
if (_local1.m_Next != null) {
stop();
_local1.m_Follower = _local1.m_Next;
_local1.m_Follower.Start();
}
} else {
_local1.m_IsReverse = false;
if (_local1.m_Previous == null) {
break;
}
stop();
_local1.m_Follower = _local1.m_Previous;
_local1.m_Follower.Start();
}
}
}
static function Linear(frame, start, delta, duration) {
return(((delta * frame) / duration) + start);
}
static function QuadraticEaseIn(frame, start, delta, duration) {
return(((delta * ((frame = frame / duration))) * frame) + start);
}
static function QuadraticEaseOut(frame, start, delta, duration) {
return((((-delta) * ((frame = frame / duration))) * (frame - 2)) + start);
}
static function QuadraticEaseInOut(frame, start, delta, duration) {
var _local1 = frame;
_local1 = _local1 / (duration / 2);
if (_local1 < 1) {
return((((delta / 2) * _local1) * _local1) + start);
}
_local1--;
return((((-delta) / 2) * ((_local1 * (_local1 - 2)) - 1)) + start);
}
static function CubicEaseIn(frame, start, delta, duration) {
return((delta * Math.pow(frame / duration, 3)) + start);
}
static function CubicEaseOut(frame, start, delta, duration) {
return((delta * (Math.pow((frame / duration) - 1, 3) + 1)) + start);
}
static function CubicEaseInOut(frame, start, delta, duration) {
var _local1 = frame;
_local1 = _local1 / (duration / 2);
if (_local1 < 1) {
return(((delta / 2) * Math.pow(_local1, 3)) + start);
}
return(((delta / 2) * (Math.pow(_local1 - 2, 3) + 2)) + start);
}
function toString() {
var _local2 = this;
var _local1 = "";
_local1 = _local1 + "<Tween>\\n";
_local1 = _local1 + (("\\t<start : " + _local2.m_Start) + ">\\n");
_local1 = _local1 + (("\\t<delta : " + (Math.round(_local2.m_Delta * 100) / 100)) + ">\\n");
_local1 = _local1 + (("\\t<duration : " + _local2.m_Duration) + ">\\n");
_local1 = _local1 + (("\\t<frame : " + (Math.round(_local2.m_Frame * 100) / 100)) + ">\\n");
_local1 = _local1 + (("\\t<position : " + (Math.round(_local2.Position() * 100) / 100)) + ">\\n");
_local1 = _local1 + (("\\t<posdelta : " + (Math.round(_local2.PositionDelta() * 100) / 100)) + ">\\n");
_local1 = _local1 + "</Tween>";
return(_local1);
}
static var TYPE_LINEAR = 0;
static var TYPE_QUADRATIC_IN = 1;
static var TYPE_QUADRATIC_OUT = 2;
static var TYPE_QUADRATIC_IN_OUT = 3;
static var TYPE_CUBIC_IN = 4;
static var TYPE_CUBIC_OUT = 5;
static var TYPE_CUBIC_IN_OUT = 6;
static var LOOP_ONCE = 0;
static var LOOP_LOOP = 1;
static var LOOP_YOYO = 2;
static var MODE_TIME_BASED = 0;
static var MODE_FRAME_BASED = 1;
}
Symbol 74 MovieClip Frame 15
stop();
Symbol 75 Button
on (release) {
root.gotoAndPLay("INSTRUCTION");
}
Symbol 76 MovieClip Frame 15
stop();
Symbol 77 Button
on (release) {
stopAllSounds();
root.gotoAndPLay("GAME");
}
Symbol 80 MovieClip Frame 75
stop();
Instance of Symbol 79 MovieClip in Symbol 80 MovieClip Frame 75
onClipEvent (load) {
_visible = false;
}
onClipEvent (mouseDown) {
if (this.hitTest(root._xmouse, root._ymouse, false)) {
if ((Key.isDown(16) && (Key.isDown(17))) && (Key.isDown(32))) {
root.messageBoxCredit.Show(null);
root.menu.scroll._visible = false;
}
}
}
Symbol 81 MovieClip Frame 20
stop();
Symbol 99 MovieClip Frame 13
stop();
Symbol 100 Button
on (release) {
Hide();
root.menu.scroll._visible = true;
CallbackFunction();
}
Symbol 103 MovieClip Frame 1
stop();
Symbol 103 MovieClip Frame 12
txt.text = message;
Symbol 103 MovieClip Frame 17
stop();
Symbol 141 MovieClip Frame 15
stop();
Symbol 142 Button
on (release) {
root.gotoAndPLay("MENU");
}
Symbol 143 MovieClip Frame 47
stop();
Symbol 183 MovieClip Frame 26
_parent.gotoAndPlay("IDLE");
Symbol 184 MovieClip Frame 1
stop();
Symbol 184 MovieClip Frame 10
stop();
Symbol 191 MovieClip Frame 37
stop();
Symbol 208 MovieClip Frame 1
isOpen = true;
stop();
Symbol 208 MovieClip Frame 2
isOpening = true;
Symbol 208 MovieClip Frame 28
isOpen = true;
stop();
Symbol 208 MovieClip Frame 86
Hide();
Symbol 229 MovieClip Frame 16
_parent.gotoAndPlay("IDLE");
Symbol 230 MovieClip Frame 1
stop();
Symbol 230 MovieClip Frame 10
stop();
Symbol 230 MovieClip Frame 20
isReadyToCatch = true;
stop();
Symbol 230 MovieClip Frame 31
stop();
Instance of Symbol 118 MovieClip "itemSnitch" in Symbol 231 MovieClip Frame 7
onClipEvent (load) {
function Show() {
timeStart = getTimer();
_visible = true;
}
function Hide() {
_x = startX;
_y = startY;
_visible = false;
}
function Update() {
if (tween.IsStarted()) {
timeElapsed = getTimer() - timeStart;
if (timeElapsed > timeDuration) {
Hide();
game.item = null;
} else {
tween.Update();
velocity.Set(tween.PositionDelta(), 0, 0);
velocity = velocity.RotateZ(angle);
position = position.plus(velocity);
position.x = Clamp(position.x, 0, WIDTH);
position.y = Clamp(position.y, 0, HEIGHT);
_x = position.x;
_y = position.y;
if (tween.IsFinish()) {
tween.Stop();
behavior = BEHAVIOR_IDLE;
}
}
} else if (Math.random() < game.probabilitySnitchMove) {
position.Set(_x, _y, 0);
DecideSnitch(DECISION_WANDER_POSITION);
DecideSnitch(DECISION_WANDER_ANGLE);
tween.Init(tweenType, tweenLoop, tweenStart, tweenDelta, tweenDuration);
tween.Start();
}
}
function DecideSnitch(decision) {
switch (decision) {
case DECISION_WANDER_POSITION :
positionFrom.x = position.x;
positionFrom.y = position.y;
do {
positionTo.x = Math.round(Math.random() * WIDTH);
positionTo.y = Math.round(Math.random() * HEIGHT);
} while (positionTo.DectectCollision(game.harry.position, radius));
return;
case DECISION_WANDER_ANGLE :
var _local1 = positionTo.Minus(position);
tweenDelta = _local1.Magnitude();
_local1.Normalize();
angle = AXIS_X.Angle(_local1);
var _local3 = AXIS_X.RotateZ(-angle);
var testPositive = AXIS_X.RotateZ(angle);
var _local2 = _local1.Angle(_local3);
var testPositiveTheta = _local1.Angle(testPositive);
if (_local2 < testPositiveTheta) {
angle = angle * -1;
} else {
angle = angle * 1;
}
}
}
var ID = ID_ITEM_SNITCH;
var startX = _x;
var startY = _y;
var position = new Vector(0, 0, 0);
var positionFrom = new Vector(0, 0, 0);
var positionTo = new Vector(0, 0, 0);
var velocity = new Vector(0, 0, 0);
var angle = 0;
var radius = 25;
var tweenType = Tween.TYPE_LINEAR;
var tweenLoop = Tween.LOOP_ONCE;
var tweenStart = 0;
var tweenDelta = 0;
var tweenDuration = game.snitchWanderTweenDuration;
var tweenDirection = NONE;
var tween = new Tween();
tween.Init(tweenType, tweenLoop, tweenStart, tweenDelta, tweenDuration);
var timeStart = 0;
var timeElapsed = 0;
var timeDuration = 3000;
Hide();
}
Symbol 231 MovieClip Frame 18
_parent.gotoAndPlay("IDLE");
Symbol 232 MovieClip Frame 1
stop();
Symbol 232 MovieClip Frame 10
stop();
Symbol 232 MovieClip Frame 20
isReadyToCatch = true;
stop();
Symbol 232 MovieClip Frame 30
stop();
Symbol 254 MovieClip Frame 1
_visible = false;
Symbol 258 MovieClip Frame 35
root.background.gotoAndPlay("SHAKE");
Symbol 258 MovieClip Frame 148
root.messageBox.Show(root.messageStartGame, root.CallbackStartGame);
stop();
Symbol 281 MovieClip Frame 90
root.confuse.position.Set(root.moody.position.x, root.moody.position.y + root.confuseOffset);
root.confuse._x = root.confuse.position.x;
root.confuse._y = root.confuse.position.y;
root.confuse.Show();
Symbol 281 MovieClip Frame 102
if (gamestate == STATE_GAMEOVER) {
root.moody.gotoAndStop("IDLE");
root.moody._rotation = 0;
}
root.moody.castAnimationEnd = true;
stop();
Symbol 286 MovieClip Frame 96
if (gamestate == STATE_GAMEOVER) {
root.moody.gotoAndStop("IDLE");
root.moody._rotation = 0;
}
root.moody.castAnimationEnd = true;
stop();
Symbol 324 MovieClip Frame 69
root.moody.castAnimationEnd = true;
Symbol 324 MovieClip Frame 84
game.fireSizeMax = true;
Symbol 324 MovieClip Frame 157
game.fireTerminated = true;
game.moody._rotation = 0;
if (root.gamestate == STATE_GAMEOVER) {
root.moody.gotoAndStop("IDLE");
root.moody._rotation = 0;
} else {
game.moody.behavior = BEHAVIOR_IDLE;
}
Symbol 336 MovieClip Frame 30
stop();
Symbol 337 MovieClip Frame 1
stop();
Symbol 337 MovieClip Frame 11
stop();
Symbol 337 MovieClip Frame 21
stop();
Symbol 337 MovieClip Frame 31
stop();
Symbol 337 MovieClip Frame 41
stop();
Symbol 337 MovieClip Frame 51
stop();
Symbol 337 MovieClip Frame 61
stop();
Symbol 337 MovieClip Frame 71
stop();
Symbol 337 MovieClip Frame 81
stop();
Symbol 337 MovieClip Frame 91
stop();
Symbol 337 MovieClip Frame 101
stop();
Instance of Symbol 254 MovieClip "collision" in Symbol 344 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 360 MovieClip Frame 59
root.madeye.hasRespawn = true;
_parent.gotoAndStop("IDLE");
stop();
Symbol 362 MovieClip Frame 30
root.madeye.Hide();
stop();
Symbol 363 MovieClip Frame 1
stop();
Symbol 363 MovieClip Frame 11
stop();
Symbol 363 MovieClip Frame 21
stop();
Symbol 363 MovieClip Frame 31
stop();
Symbol 363 MovieClip Frame 41
stop();
Symbol 365 MovieClip Frame 1
stop();
Symbol 365 MovieClip Frame 2
root.background.gotoAndPlay("SHAKE");
Symbol 365 MovieClip Frame 15
Hide();
stop();
Symbol 367 MovieClip Frame 1
stop();
Symbol 367 MovieClip Frame 16
Hide();
stop();
Symbol 382 Button
on (release) {
if (root.isVolumeMute) {
root.isVolumeMute = false;
root.sound.setVolume(root.volumeDefault);
this.gotoAndStop("ON");
} else {
root.isVolumeMute = true;
root.sound.setVolume(root.volumeMute);
this.gotoAndStop("OFF");
}
}
on (rollOver) {
if (root.isVolumeMute) {
this.gotoAndStop("OFF_OVER");
} else {
this.gotoAndStop("ON_OVER");
}
}
on (rollOut) {
if (root.isVolumeMute) {
this.gotoAndStop("OFF");
} else {
this.gotoAndStop("ON");
}
}
on (press) {
if (root.isVolumeMute) {
this.gotoAndStop("OFF_DOWN");
} else {
this.gotoAndStop("ON_DOWN");
}
}
Symbol 386 MovieClip Frame 10
stop();
Symbol 387 MovieClip Frame 1
stop();
Symbol 387 MovieClip Frame 10
stop();
Symbol 387 MovieClip Frame 20
stop();
Symbol 387 MovieClip Frame 30
stop();
Symbol 387 MovieClip Frame 40
stop();
Symbol 387 MovieClip Frame 50
stop();
Symbol 389 Button
on (release) {
Hide();
CallbackFunction();
}
Symbol 390 MovieClip Frame 11
txt.text = message;
Symbol 390 MovieClip Frame 16
stop();
Symbol 424 MovieClip Frame 13
stop();
Symbol 425 Button
on (rollOver) {
jukebox.PlaySound("Button.Over");
}
on (release) {
messageBox.Hide();
callbackFunction();
}
Symbol 426 MovieClip Frame 30
stop();
Symbol 431 MovieClip Frame 11
Symbol 431 MovieClip Frame 16
isOpen = true;
stop();
Symbol 440 MovieClip Frame 1
if (game.gamestate != STATE_PLAY) {
root.spell = NONE;
root.confuse.Hide();
}
Symbol 440 MovieClip Frame 30
if (game.gamestate != STATE_PLAY) {
root.spell = NONE;
root.confuse.Hide();
}
Symbol 440 MovieClip Frame 60
if (game.gamestate != STATE_PLAY) {
root.spell = NONE;
root.confuse.Hide();
}
Symbol 443 MovieClip Frame 20
_parent.Hide();
Symbol 444 MovieClip Frame 1
stop();
Symbol 444 MovieClip Frame 11
stop();
Symbol 444 MovieClip Frame 21
stop();
Symbol 447 MovieClip Frame 20
_parent.Hide();
Symbol 448 MovieClip Frame 1
stop();
Symbol 448 MovieClip Frame 11
stop();
Symbol 448 MovieClip Frame 21
stop();