Frame 1
function circleCircleDetect(bug) {
var _local3 = bug._x - _root.mcLadyBug._x;
var _local2 = bug._y - _root.mcLadyBug._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
return((bug.radius + _root.mcLadyBug.radius) < _local5);
}
function Smashing() {
_root.mcLadyBug.gotoAndPlay(2);
_root.mcInstructions.txtTitle.text = "HELICOPTER CRASHED!\rCLICK TO PLAY AGAIN...";
_root.mcInstructions._visible = true;
sndCrickets.stop();
sndSmash = new Sound(this);
sndSmash.attachSound("smash");
sndSmash.setVolume(40);
sndSmash.start();
_root.mcPlayAgain._visible = true;
Mouse.show();
if (_root.Best < parseFloat(_root.mcTimer.txtTimer.text)) {
_root.Best = parseFloat(_root.mcTimer.txtTimer.text);
_root.mcTimer.txtBestTime.text = _root.Best;
}
}
function StartSound() {
sndCrickets = new Sound(this);
sndCrickets.attachSound("crickets");
sndCrickets.setVolume(100);
sndCrickets.start(0, 999);
sndCrickets.onSoundComplete = function () {
sndCrickets.start(0, 999);
};
}
function ResetGame() {
z = bugcounter - 30;
while (z < (bugcounter + 1)) {
_root["mcBug" + z].removeMovieClip();
z++;
}
_root.mcPlayAgain._visible = false;
_root.Go = true;
_root.mcLadyBug.gotoAndStop(1);
StartSound();
_root.mystart = getTimer() / 1000;
}
_root.bugcounter = 10000;
_root.bugframes = 0;
_root.Go = false;
_root.mystart = 0;
_root.Best = 0;
_root.newbug = 6;
_root.bugspeed = 17;
_root.bugradius = 15;
_root.ladybugradius = 15;
z = 0;
while (z < 100) {
x = Math.random() * 440;
y = Math.random() * 440;
size = (Math.random() * 40) + 60;
_root.attachMovie("mcBush", "mcBush" + z, z + 1000);
_root["mcBush" + z]._x = x;
_root["mcBush" + z]._y = y;
_root["mcBush" + z]._xscale = size;
_root["mcBush" + z]._yscale = size;
z++;
}
_root.attachMovie("mcPlayAgain", "mcPlayAgain", 81000);
_root.mcPlayAgain._visible = false;
_root.mcPlayAgain._x = 220;
_root.mcPlayAgain._y = 220;
_root.attachMovie("mcTitle", "mcTitle", 82000);
_root.mcTitle._x = 220;
_root.mcTitle._y = 220;
_root.attachMovie("mcBottomBar", "mcBottomBar", 83000);
_root.mcBottomBar._x = 220;
_root.mcBottomBar._y = 425;
_root.attachMovie("mcTimer", "mcTimer", 80000);
_root.mcTimer._x = 400;
_root.mcTimer._y = 50;
_root.attachMovie("mcLadyBug", "mcLadyBug", 30000);
_root.mcLadyBug._x = -1000;
_root.mcLadyBug._y = -1000;
_root.mcLadyBug.radius = _root.ladybugradius;
MovieClip.prototype.pointAt = function (x, y) {
var _local2 = x - this._x;
var _local3 = y - this._y;
var _local5 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
var _local4;
if (_local3 < 0) {
_local4 = (Math.PI*2) - Math.acos(_local2 / _local5);
} else {
_local4 = Math.acos(_local2 / _local5);
}
this._rotation = (_local4 * 180) / Math.PI;
};
mcLadyBug.onEnterFrame = function () {
if (_root.Go == true) {
Mouse.hide();
this.pointAt(this._parent._xmouse, this._parent._ymouse);
this._x = _xmouse;
this._y = _ymouse;
updateAfterEvent();
}
};
stop();
Instance of Symbol 45 MovieClip "mcEngine" in Frame 1
onClipEvent (enterFrame) {
if (_root.Go == true) {
_root.bugframes++;
if (_root.bugframes == _root.newbug) {
side = Math.floor(Math.random() * 4) + 1;
bug = Math.floor(Math.random() * 4) + 1;
_root.attachMovie("mcBug" + bug, "mcBug" + _root.bugcounter, _root.bugcounter);
_root["mcBug" + _root.bugcounter].radius = _root.bugradius;
switch (side) {
case 1 :
x = Math.random() * 440;
_root["mcBug" + _root.bugcounter]._x = x;
_root["mcBug" + _root.bugcounter]._y = _root["mcBug" + _root.bugcounter]._height * -1;
_root["mcBug" + _root.bugcounter]._rotation = 180;
_root["mcBug" + _root.bugcounter].onEnterFrame = function () {
if (_root.Go == true) {
this._y = this._y + _root.bugspeed;
if (_root.circleCircleDetect(this) == false) {
_root.Go = false;
_root.Smashing();
}
if (this._y > (this._height + 440)) {
this.removeMovieClip();
}
}
};
break;
case 2 :
y = Math.random() * 440;
_root["mcBug" + _root.bugcounter]._y = y;
_root["mcBug" + _root.bugcounter]._x = _root["mcBug" + _root.bugcounter]._width + 440;
_root["mcBug" + _root.bugcounter]._rotation = 270;
_root["mcBug" + _root.bugcounter].onEnterFrame = function () {
if (_root.Go == true) {
this._x = this._x - _root.bugspeed;
if (_root.circleCircleDetect(this) == false) {
_root.Go = false;
_root.Smashing();
}
if (this._x < (this._width * -1)) {
this.removeMovieClip();
}
}
};
break;
case 3 :
x = Math.random() * 440;
_root["mcBug" + _root.bugcounter]._x = x;
_root["mcBug" + _root.bugcounter]._y = _root["mcBug" + _root.bugcounter]._height + 440;
_root["mcBug" + _root.bugcounter]._rotation = 0;
_root["mcBug" + _root.bugcounter].onEnterFrame = function () {
if (_root.Go == true) {
this._y = this._y - _root.bugspeed;
if (_root.circleCircleDetect(this) == false) {
_root.Go = false;
_root.Smashing();
}
if (this._y < (this._height * -1)) {
this.removeMovieClip();
}
}
};
break;
case 4 :
y = Math.random() * 440;
_root["mcBug" + _root.bugcounter]._y = y;
_root["mcBug" + _root.bugcounter]._x = _root["mcBug" + _root.bugcounter]._width * -1;
_root["mcBug" + _root.bugcounter]._rotation = 90;
_root["mcBug" + _root.bugcounter].onEnterFrame = function () {
if (_root.Go == true) {
this._x = this._x + _root.bugspeed;
if (_root.circleCircleDetect(this) == false) {
_root.Go = false;
_root.Smashing();
}
if (this._x > (this._width + 440)) {
this.removeMovieClip();
}
}
};
}
_root.bugcounter++;
_root.bugframes = 0;
}
}
}
Symbol 8 Button
on (release) {
getURL ("http://www.lostjungle.com");
}
Symbol 9 Button
on (release) {
getURL ("http://www.lostjungle.com/add.php?game=ladybug");
}
Symbol 16 MovieClip [mcTimer] Frame 1
this.onEnterFrame = function () {
if (_root.Go == true) {
if (Math.floor(thetime) >= 10) {
thetime = substring((getTimer() / 1000) - _root.mystart, 1, 4);
} else {
thetime = substring((getTimer() / 1000) - _root.mystart, 1, 3);
}
switch (length(thetime)) {
case 1 :
thetime = thetime + ".0";
break;
case 2 :
thetime = thetime + "0";
break;
}
this.txtTimer.text = thetime;
}
};
Symbol 18 MovieClip [mcLadyBug] Frame 1
stop();
Symbol 18 MovieClip [mcLadyBug] Frame 20
stop();
Symbol 32 Button
on (release) {
_root.ResetGame();
}
Symbol 40 Button
on (release) {
_root.mcTitle._visible = false;
_root.ResetGame();
}