Frame 1
Stage.scaleMode = "noScale";
stop();
Frame 2
function startLevel() {
var _local1 = _root;
level = 0;
berries = new Array();
y = 1;
while (y < 12) {
x = 1;
while (x < 15) {
if (!background.hitTest(x * 50, y * 50, true)) {
attachMovie("berry", "berry" + level, level);
clip = _local1["berry" + level];
clip._x = x * 50;
clip._y = y * 50;
berries.push(clip);
level++;
}
x++;
}
y++;
}
attachMovie("fox", "fox", level++);
fox._x = 300;
fox._y = 300;
fox.move = {x:0, y:0};
fox.dest = {x:300, y:300};
fox.nextmove = 0;
attachMovie("bunny", "bunny", level++);
bunny._x = 50;
bunny._y = 50;
bunny.move = {x:0, y:0};
bunny.dest = {x:50, y:50};
bunny.nextmove = 0;
bunny.last = {x:50, y:50};
}
function move() {
if (getTimer() > fox.nextmove) {
fox.nextmove = getTimer() + 10;
fox._x = fox._x + (fox.move.x * 1);
fox._y = fox._y + (fox.move.y * 1);
if ((fox._x == fox.dest.x) and (fox._y == fox.dest.y)) {
eatBerry();
nextMove();
}
}
}
function eatBerry() {
allGone = true;
i = 0;
while (i < berries.length) {
if (((berries[i]._currentFrame == 1) and (berries[i]._x == fox._x)) and (berries[i]._y == fox._y)) {
berries[i].gotoAndStop("nothing");
score++;
} else if (berries[i]._currentFrame == 1) {
allGone = false;
}
i++;
}
if (allGone) {
gotoAndPlay ("level over");
gameLevel++;
}
}
function nextMove() {
fox.move.x = 0;
fox.move.y = 0;
if (Key.isDown(37)) {
fox.move.x = -1;
fox._xscale = Math.abs(fox._xscale);
} else if (Key.isDown(39)) {
fox.move.x = 1;
fox._xscale = -Math.abs(fox._xscale);
} else if (Key.isDown(38)) {
fox.move.y = -1;
} else if (Key.isDown(40)) {
fox.move.y = 1;
}
newx = fox._x + (fox.move.x * 50);
newy = fox._y + (fox.move.y * 50);
okToMove = false;
i = 0;
while (i < berries.length) {
if ((berries[i]._x == newx) and (berries[i]._y == newy)) {
fox.dest.x = newx;
fox.dest.y = newy;
okToMove = true;
}
i++;
}
if (!okToMove) {
fox.move.x = 0;
fox.move.y = 0;
}
}
function moveBunny() {
if (getTimer() > bunny.nextmove) {
bunny.nextmove = (getTimer() + 20) - (gameLevel * 10);
bunny._x = bunny._x + (bunny.move.x * 1);
bunny._y = bunny._y + (bunny.move.y * 1);
if ((bunny._x == bunny.dest.x) and (bunny._y == bunny.dest.y)) {
possibilities = new Array();
i = 0;
while (i < berries.length) {
xdiff = Math.abs(berries[i]._x - bunny._x);
ydiff = Math.abs(berries[i]._y - bunny._y);
if (((xdiff == 50) and (ydiff == 0)) or ((xdiff == 0) and (ydiff == 50))) {
possibilities.push(berries[i]);
}
i++;
}
do {
r = int(Math.random() * possibilities.length);
bunny.dest.x = possibilities[r]._x;
bunny.dest.y = possibilities[r]._y;
bunny.move.x = (possibilities[r]._x - bunny._x) / 50;
bunny.move.y = (possibilities[r]._y - bunny._y) / 50;
} while (((bunny.dest.x == lastx) and (bunny.dest.y == lasty)) and (possibilities.length > 1));
lastx = bunny._x;
lasty = bunny._y;
}
}
if ((Math.abs(bunny._x - fox._x) <= 70) and (Math.abs(bunny._y - fox._y) <= 110)) {
if (lives < 1) {
i = 0;
while (i < berries.length) {
berries[i].gotoAndStop("nothing");
i++;
}
fox.removeMovieClip();
bunny.removeMovieClip();
gotoAndStop ("game over");
} else {
i = 0;
while (i < berries.length) {
berries[i].gotoAndStop("nothing");
fox.removeMovieClip();
bunny.removeMovieClip();
i++;
}
lives--;
gotoAndStop ("lost life");
}
}
}
stop();
Instance of Symbol 40 MovieClip in Frame 2
onClipEvent (load) {
_root.startLevel();
}
onClipEvent (enterFrame) {
_root.move();
_root.moveBunny();
}
Frame 3
stop();
Frame 4
stop();
Frame 5
stop();
Symbol 6 MovieClip [berry] Frame 1
stop();
Symbol 21 MovieClip [fox0] Frame 274
gotoAndPlay (2);
Instance of Symbol 21 MovieClip [fox0] in Symbol 22 MovieClip [fox] Frame 1
onClipEvent (enterFrame) {
k = 275;
if (Key.isDown(37)) {
if (this._currentFrame < k) {
this.gotoAndPlay("eat");
}
}
if (Key.isDown(39)) {
if (this._currentFrame < k) {
this.gotoAndPlay("eat");
}
}
if (Key.isDown(38)) {
if (this._currentFrame < k) {
this.gotoAndPlay("eat");
}
}
if (Key.isDown(40)) {
if (this._currentFrame < k) {
this.gotoAndPlay("eat");
}
}
}
Symbol 28 Button
on (press) {
lives = 3;
score = 0;
gameLevel = 1;
gotoAndPlay ("play");
}
Symbol 38 Button
on (press) {
getURL ("http://www.animenewsrider.com/andev", "_blank");
}
Symbol 42 Button
on (press) {
gotoAndPlay ("play");
}
Symbol 47 Button
on (press) {
gotoAndPlay ("start");
}