function HammerheadObj()
{
this.myName = "hammerhead";
this.layerNum = 0;
this.xMin = -50;
this.xMax = 760;
this.yMin = 40;
this.yMax = 160;
this.userInteraction = false;
this.defaultSpeed = 5.000000E-001;
this.currSpeed = this.defaultSpeed;
this.drawChar();
this.swim();
this.startCta();
this.startBlink();
} // End of the function
HammerheadObj.prototype.drawChar = function ()
{
var obj = this;
if (!_root.holderMc)
{
_root.holderMc = _root;
} // end if
attachMovie("char_"+this.myName+"_mc",this.myName+"_mc",this.layerNum++);
this.targetMc = _root.holderMc[this.myName + "_mc"];
this.targetMc._x = this.xMax;
this.targetMc._y = this.yMin;
this.targetMc.enabled = true;
this.targetMc.onRollOver = function ()
{
if (obj.targetMc.enabled == true)
{
obj.targetMc.enabled = false;
obj.userInteraction = true;
obj.targetMc.eyes_mc.gotoAndStop(5);
obj.flapFin();
} // end if
};
};
HammerheadObj.prototype.swim = function ()
{
var obj = this;
this.targetMc.onEnterFrame = function ()
{
if (obj.targetMc._x < obj.xMin)
{
if (obj.userInteraction == true)
{
delete obj.targetMc.onEnterFrame;
obj.endSequence();
}
else
{
obj.targetMc._x = obj.xMax;
} // end else if
}
else
{
obj.targetMc._x = obj.targetMc._x - obj.currSpeed;
} // end else if
if (obj.targetMc._x > 380 && obj.targetMc._x < 420)
{
tailmonitor.disableBtn(seaweed_mc);
_root.seaweed_mc.gotoAndPlay("left");
_root.wibbleMonitor(seaweed_mc);
} // end if
};
};
HammerheadObj.prototype.flapFin = function ()
{
this.stopCta();
this.stopBlink();
this.targetMc.tail_mc.gotoAndPlay("flap");
this.boostInt = setInterval(this, "boost", 200);
};
HammerheadObj.prototype.boost = function ()
{
clearInterval(this.boostInt);
var maxBoost = 15;
var obj = this;
this.targetMc.tail_mc.onEnterFrame = function ()
{
obj.currSpeed = maxBoost;
--maxBoost;
if (maxBoost <= obj.defaultSpeed)
{
delete obj.targetMc.tail_mc.onEnterFrame;
obj.targetMc.enabled = true;
obj.targetMc.eyes_mc.gotoAndStop(2);
obj.startBlink();
obj.startCta();
} // end if
};
};
HammerheadObj.prototype.startCta = function ()
{
var _loc4 = 5;
var _loc5 = 5;
var _loc2 = random(_loc5) + _loc4;
var _loc3 = _loc2 * 1000;
this.ctaInterval = setInterval(this, "flapFin", _loc3);
};
HammerheadObj.prototype.stopCta = function ()
{
clearInterval(this.ctaInterval);
};
HammerheadObj.prototype.startBlink = function ()
{
var _loc4 = 1;
var _loc5 = 3;
var _loc2 = random(_loc5) + _loc4;
var _loc3 = _loc2 * 1000;
this.blinkInterval = setInterval(this, "blink", _loc3);
};
HammerheadObj.prototype.stopBlink = function ()
{
clearInterval(this.blinkInterval);
};
HammerheadObj.prototype.blink = function ()
{
this.stopBlink();
var obj = this;
this.targetMc.eyelid_mc.play();
var keyframe = 3;
var pupilStates = this.targetMc.eyes_mc._totalframes;
this.targetMc.eyelid_mc.onEnterFrame = function ()
{
if (obj.targetMc.eyelid_mc._currentframe == keyframe)
{
obj.targetMc.eyes_mc.gotoAndStop(random(pupilStates) + 1);
} // end if
if (obj.targetMc.eyelid_mc._currentframe == 1)
{
delete obj.targetMc.eyelid_mc.onEnterFrame;
obj.startBlink();
} // end if
};
};
HammerheadObj.prototype.endSequence = function ()
{
this.targetMc.removeMovieClip();
_root.tailmanager.defineNextChar();
};
hammerhead = new HammerheadObj();