Frame 1
ifFrameLoaded (57) {
gotoAndStop (10);
}
Frame 5
gotoAndPlay (1);
Frame 10
stop();
Frame 13
function main() {
if (gPlayerHit == false) {
getPlayerInput();
updateHead();
updateBall();
} else {
gotoAndPlay ("playerhit");
}
if (wingame) {
gotoAndPlay (75);
}
}
function systemInit() {
upKey = DEFAULT_UP;
downKey = DEFAULT_DOWN;
leftKey = DEFAULT_LEFT;
rightKey = DEFAULT_RIGHT;
sLeftKey = DEFAULT_SLEFT;
sUpKey = DEFAULT_SUP;
sRightKey = DEFAULT_SRIGHT;
}
function gameInit() {
gMans = 3;
gScore = 0;
gLevel = 1;
gHeadSpeed = 4;
gHeadDirection = 1;
}
function levelInit() {
gSpeed = MOVE_INCREMENT;
player.collide._visible = false;
player.busyBlocking = false;
ball.play("forward");
ball.collide._visible = false;
ball.x_vel = 3;
gPlayerHit = false;
player.gotoAndPlay("off");
ball.gotoAndPlay(1);
head.collide._visible = false;
wingame = false;
}
function bounceBall() {
trace("ball bounced!!!");
trace((("ball collide loc = " + (ball._x - ball.collide._x)) + ",") + (ball._y - ball.collide._y));
trace((("collide: " + ball.collide.hitTest(player.collide)) + " blocking = ") + player.blocking);
if (ball.collide.hitTest(player.collide) && (!player.blocking)) {
trace("hit the player - sorry!");
gPlayerHit = true;
return(false);
}
if (ball.collide.hitTest(player.collide) && (player.blocking)) {
switch (player.shield_dir) {
case "up" :
ball.x_vel = ball.x_vel + ((Math.random() * 1) - 0.5);
break;
case :
ball.x_vel = ball.x_vel - Math.ciel(Math.random() * 5);
break;
case :
ball.x_vel = ball.x_vel + Math.ciel(Math.random() * 5);
break;
}
return(true);
}
ball.gotoAndPlay("disappear");
}
function winGame() {
wingame = true;
}
function ballSmack() {
trace((("ball collide loc = " + (ball._x - ball.collide._x)) + ",") + (ball._y - ball.collide._y));
if (ball.collide.hitTest(head.collide)) {
trace("ball hit the mask!");
level++;
head.play();
}
ball.gotoAndPlay(1);
}
function updateBall() {
ball._x = ball._x + ball.x_vel;
if ((ball._x - ball.collide._x) < 140) {
ball.x_vel = ball.x_vel * -1;
}
if (410 < (ball._x - ball.collide._x)) {
ball.x_vel = ball.x_vel * -1;
}
}
function updateHead() {
head._x = head._x + (gHeadSpeed * gHeadDirection);
if ((0 < gHeadDirection) && (HEADRIGHTBOUND < head._x)) {
head._x = HEADRIGHTBOUND;
gHeadDirection = -1;
}
if ((gHeadDirection < 0) && (head._x < HEADLEFTBOUND)) {
head._x = HEADLEFTBOUND;
gHeadDirection = 1;
}
}
function playerHitTest() {
if (((player._x >= 308) && (rhino.state == "eating")) && (player.collision.hitTest(rhinozone))) {
playerHit();
yell_sound.start();
return(true);
}
var i = 0;
while (i < snakeArray.length) {
if (snakeArray[i].collision.hitTest(player)) {
playerHit();
snakehit_sound.start();
}
i++;
}
}
function playerHit() {
player._x = player._x - (50 * gLastDir);
if (player._x < TL_BOUND.x) {
player._x = TL_BOUND.x;
}
if (BR_BOUND.x < player._x) {
player._x = BR_BOUND.x;
}
if (gCarrying) {
player.foodcarry.gotoAndPlay("drop");
if (gReappearFoodTimer < 0) {
gReappearFoodTimer = 15;
}
}
gCarrying = false;
}
function displayScore() {
var extraDigits = (6 - gScore.toString().length);
var displayString = "";
var i = 1;
while (extraDigits >= i) {
displayString = displayString + "0";
i++;
}
displayString = displayString + gScore.toString();
score_display.text = displayString;
}
function getPlayerInput() {
var x_offset = 0;
var y_offset = 0;
if (Key.isDown(leftKey)) {
x_offset = -gSpeed;
}
if (Key.isDown(rightKey)) {
x_offset = gSpeed;
}
if ((x_offset != 0) || (y_offset != 0)) {
playerMove(x_offset, y_offset);
}
if (Key.isDown(32)) {
trace((("player loc = " + player._x) + ",") + player._y);
trace((("head loc = " + head._x) + ",") + head._y);
}
if (Key.isDown(sLeftKey) && (player.busyBlocking == false)) {
player.gotoAndPlay("left");
player.busyBlocking = true;
}
if (Key.isDown(sUpKey) && (player.busyBlocking == false)) {
player.gotoAndPlay("up");
player.busyBlocking = true;
}
if (Key.isDown(sRightKey) && (player.busyBlocking == false)) {
player.gotoAndPlay("right");
player.busyBlocking = true;
}
}
function playerMove(delta_x, delta_y) {
var store_x;
var store_y;
store_x = player._x;
store_y = player._y;
var x_movable = true;
var y_movable = true;
player._x = player._x + delta_x;
var i = 1;
while (5 >= i) {
if (eval ("level_mc.block" + i).hitTest(player)) {
x_movable = false;
}
i++;
}
player._x = player._x - delta_x;
player._y = player._y + delta_y;
var i = 1;
while (4 >= i) {
if (eval ("level_mc.block" + i).hitTest(player)) {
y_movable = false;
}
i++;
}
player._x = player._x + delta_x;
if (0 < delta_x) {
gLastDir = 1;
} else if (delta_x < 0) {
gLastDir = -1;
}
if (player._x < TL_BOUND.x) {
x_movable = false;
}
if (BR_BOUND.x < player._x) {
x_movable = false;
}
if (player._y < TL_BOUND.y) {
y_movable = false;
}
if (BR_BOUND.y < player._y) {
y_movable = false;
}
if (!x_movable) {
player._x = store_x;
}
if (!y_movable) {
player._y = store_y;
}
}
DEFAULT_UP = 38;
DEFAULT_DOWN = 40;
DEFAULT_LEFT = 37;
DEFAULT_RIGHT = 39;
DEFAULT_SLEFT = 65;
DEFAULT_SUP = 83;
DEFAULT_SRIGHT = 68;
MOVE_INCREMENT = 10;
TL_BOUND = new Object();
TL_BOUND.x = 58;
TL_BOUND.y = 187;
BR_BOUND = new Object();
BR_BOUND.x = 492;
BR_BOUND.y = 357;
HEADLEFTBOUND = 189;
HEADRIGHTBOUND = 355;
var upKey;
var downKey;
var leftKey;
var rightKey;
var sLeftKey;
var sRightKey;
var sUpKey;
var gMans;
var gScore;
var gLevel;
var gSpeed;
var gHeadSpeed;
var gHeadDirection;
var gPlayerHit;
rhinoColor = new Color("rhino");
rhinoTrans = new Object();
eat_sound = new Sound();
eat_sound.attachSound("rhino_eat");
systemInit();
gameInit();
levelInit();
Frame 14
main();
Frame 15
gotoAndPlay ("gameLoop");
Frame 22
player.gotoAndPlay("die");
ball.stop();
head._x = ((HEADRIGHTBOUND - HEADLEFTBOUND) / 2) + HEADLEFTBOUND;
Frame 74
levelInit();
gotoAndPlay ("gameLoop");
Frame 75
head.collide._visible = false;
Frame 105
gotoAndPlay (13);
Symbol 8 Button
on (release) {
gotoAndPlay (13);
}
Symbol 42 MovieClip Frame 1
stop();
Symbol 42 MovieClip Frame 6
stop();
Symbol 42 MovieClip Frame 11
stop();
Symbol 42 MovieClip Frame 16
stop();
Symbol 42 MovieClip Frame 22
stop();
Symbol 42 MovieClip Frame 29
_parent.winGame();
Symbol 48 MovieClip Frame 26
_parent.bounceBall();
Symbol 48 MovieClip Frame 51
_parent.ballSmack();
Symbol 48 MovieClip Frame 61
gotoAndPlay (1);
_x = head._x;
Symbol 65 MovieClip Frame 1
blocking = false;
Symbol 65 MovieClip Frame 3
busyBlocking = false;
stop();
Symbol 65 MovieClip Frame 8
blocking = true;
shield_dir = "up";
Symbol 65 MovieClip Frame 12
gotoAndPlay ("off");
Symbol 65 MovieClip Frame 14
blocking = true;
shield_dir = "right";
Symbol 65 MovieClip Frame 18
gotoAndPlay ("off");
Symbol 65 MovieClip Frame 21
blocking = true;
shield_dir = "left";
Symbol 65 MovieClip Frame 25
gotoAndPlay ("off");
Symbol 65 MovieClip Frame 52
stop();