Frame 1
if ((getBytesLoaded() / getBytesTotal()) == 1) {
gotoAndPlay (2);
} else {
_root.loaderstatus.text = (String(getBytesLoaded()) + " / ") + String(getBytesTotal());
_root.loaderbar.GotoAndStop(int((getBytesLoaded() / getBytesTotal()) * 100));
gotoAndPlay (1);
}
Instance of Symbol 160 MovieClip in Frame 1
on (release) {
getURL ("http://www.startgames.ws", "_blank");
}
Frame 101
com.novelgames.flashgames.common.MainDevelopment.initialize(this);
Symbol 35 MovieClip [food] Frame 1
#initclip 29
Object.registerClass("food", com.novelgames.flashgames.pacman.Food);
#endinitclip
Symbol 48 MovieClip [ghostBody] Frame 1
#initclip 17
Object.registerClass("ghostBody", com.novelgames.flashgames.pacman.GhostBody);
#endinitclip
Symbol 48 MovieClip [ghostBody] Frame 10
animationFinished();
Symbol 48 MovieClip [ghostBody] Frame 20
animationFinished();
Symbol 48 MovieClip [ghostBody] Frame 30
animationFinished();
Symbol 48 MovieClip [ghostBody] Frame 40
animationFinished();
Symbol 48 MovieClip [ghostBody] Frame 50
animationFinished();
Symbol 48 MovieClip [ghostBody] Frame 60
animationFinished();
Symbol 52 MovieClip [ghost] Frame 1
#initclip 18
Object.registerClass("ghost", com.novelgames.flashgames.pacman.Ghost);
#endinitclip
Symbol 59 MovieClip [lifeBar] Frame 1
#initclip 19
Object.registerClass("lifeBar", com.novelgames.flashgames.pacman.LifeBar);
#endinitclip
Symbol 70 MovieClip [gameOverDialog] Frame 1
#initclip 20
Object.registerClass("gameOverDialog", com.novelgames.flashgames.pacman.GameOverDialog);
#endinitclip
Symbol 70 MovieClip [gameOverDialog] Frame 19
animationFinished();
Symbol 74 MovieClip [winDialog] Frame 1
#initclip 21
Object.registerClass("winDialog", com.novelgames.flashgames.pacman.WinDialog);
#endinitclip
Symbol 74 MovieClip [winDialog] Frame 30
animationFinished();
Symbol 80 MovieClip [generatingDialog] Frame 1
#initclip 22
Object.registerClass("generatingDialog", com.novelgames.flashgames.pacman.GeneratingDialog);
#endinitclip
Symbol 91 MovieClip Frame 19
gotoAndPlay (1);
Symbol 102 MovieClip Frame 19
gotoAndPlay (1);
Symbol 112 MovieClip Frame 19
gotoAndPlay (1);
Symbol 122 MovieClip Frame 19
gotoAndPlay (1);
Symbol 123 MovieClip Frame 11
gotoAndPlay (1);
Symbol 124 MovieClip Frame 11
gotoAndPlay (1);
Symbol 125 MovieClip Frame 11
gotoAndPlay (1);
Symbol 126 MovieClip Frame 11
gotoAndPlay (1);
Symbol 145 MovieClip [pacman] Frame 1
#initclip 23
Object.registerClass("pacman", com.novelgames.flashgames.pacman.Pacman);
#endinitclip
Symbol 145 MovieClip [pacman] Frame 94
deadAnimationFinished();
Symbol 146 MovieClip [ghostHolder] Frame 1
#initclip 24
Object.registerClass("ghostHolder", com.novelgames.flashgames.pacman.GhostHolder);
#endinitclip
Symbol 147 MovieClip [foodHolder] Frame 1
#initclip 25
Object.registerClass("foodHolder", com.novelgames.flashgames.pacman.FoodHolder);
#endinitclip
Symbol 151 MovieClip [maze] Frame 1
#initclip 26
Object.registerClass("maze", com.novelgames.flashgames.pacman.Maze);
#endinitclip
Symbol 152 MovieClip [playArea] Frame 1
#initclip 27
Object.registerClass("playArea", com.novelgames.flashgames.pacman.PlayArea);
#endinitclip
Symbol 156 MovieClip [game] Frame 1
#initclip 28
Object.registerClass("game", com.novelgames.flashgames.pacman.Game);
#endinitclip
Symbol 168 MovieClip Frame 101
_root.play();
Symbol 229 MovieClip [__Packages.com.novelgames.flashgames.pacman.GhostBody] Frame 0
class com.novelgames.flashgames.pacman.GhostBody extends MovieClip
{
var colour, gotoAndPlay;
function GhostBody () {
super();
setColour(0);
}
function setColour(colour) {
this.colour = colour;
(gotoAndPlay("colour" + colour));// not popped
}
function animationFinished() {
(gotoAndPlay("colour" + colour));// not popped
}
}
Symbol 230 MovieClip [__Packages.com.novelgames.flashgames.pacman.Ghost] Frame 0
class com.novelgames.flashgames.pacman.Ghost extends MovieClip
{
var exitSpeedX, exitSpeedY, enterSpeedX, enterSpeedY, direction, state, x, y, startCount, startFrame, _x, _y, _parent, gotoAndStop, resurrectCount, _currentframe, body, colour;
function Ghost () {
super();
exitSpeedX = 0;
exitSpeedY = 0;
enterSpeedX = 0;
enterSpeedY = 0;
direction = NONE;
state = START;
x = 0;
y = 0;
}
function move() {
if (state == START) {
startCount++;
if (startCount < (startFrame - com.novelgames.flashgames.pacman.Config.GHOST_ENTEREXITHOMEFRAMES)) {
} else if (startCount == (startFrame - com.novelgames.flashgames.pacman.Config.GHOST_ENTEREXITHOMEFRAMES)) {
setExitSpeeds();
_x = _x + exitSpeedX;
_y = _y + exitSpeedY;
} else if (startCount < startFrame) {
_x = _x + exitSpeedX;
_y = _y + exitSpeedY;
} else if (startCount == startFrame) {
startCount = -1;
x = Math.round(_x / com.novelgames.flashgames.pacman.Config.BLOCKSIZE);
y = Math.round(_y / com.novelgames.flashgames.pacman.Config.BLOCKSIZE);
if (_parent._parent.isEating) {
state = EATING;
(gotoAndStop("eating"));// not popped
} else {
state = NORMAL;
(gotoAndStop("normal"));// not popped
}
direction = NONE;
}
} else if (((state == NORMAL) || (state == EATING)) || (state == DEAD)) {
if (direction == LEFT) {
_x = _x - com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else if (direction == RIGHT) {
_x = _x + com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else if (direction == UP) {
_y = _y - com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else if (direction == DOWN) {
_y = _y + com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
}
if (((_x % com.novelgames.flashgames.pacman.Config.BLOCKSIZE) == 0) && ((_y % com.novelgames.flashgames.pacman.Config.BLOCKSIZE) == 0)) {
x = Math.round(_x / com.novelgames.flashgames.pacman.Config.BLOCKSIZE);
y = Math.round(_y / com.novelgames.flashgames.pacman.Config.BLOCKSIZE);
if ((state == NORMAL) || (state == EATING)) {
direction = getDirection();
} else if (state == DEAD) {
direction = getDirection();
if (_parent._parent.maze.getIsHome(x, y)) {
resurrectCount = 0;
setEnterSpeeds();
state = RESURRECT;
}
}
}
} else if (state == RESURRECT) {
resurrectCount++;
if (resurrectCount <= com.novelgames.flashgames.pacman.Config.GHOST_ENTEREXITHOMEFRAMES) {
_x = _x + enterSpeedX;
_y = _y + enterSpeedY;
} else if (resurrectCount < com.novelgames.flashgames.pacman.Config.GHOST_RESURRECTFRAMES) {
} else if (resurrectCount == com.novelgames.flashgames.pacman.Config.GHOST_RESURRECTFRAMES) {
startCount = 0;
startFrame = com.novelgames.flashgames.pacman.Config.GHOST_ENTEREXITHOMEFRAMES + 1;
state = START;
}
}
}
function startEating() {
if (state == NORMAL) {
state = EATING;
(gotoAndStop("eating"));// not popped
}
}
function blinkEating() {
if (state == EATING) {
if (_currentframe != 2) {
(gotoAndStop("normal"));// not popped
} else {
(gotoAndStop("eating"));// not popped
}
}
}
function stopEating() {
if (state == EATING) {
state = NORMAL;
(gotoAndStop("normal"));// not popped
}
}
function die() {
state = DEAD;
(gotoAndStop("dead"));// not popped
}
function onLoad() {
(gotoAndStop("normal"));// not popped
initColour();
}
function initColour() {
body.setColour(colour);
}
function setExitSpeeds() {
var _local2 = _parent._parent.maze.getHomeExitPosition();
if (_local2 == 0) {
exitSpeedX = -com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
exitSpeedY = -com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else if (_local2 == 1) {
exitSpeedX = com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
exitSpeedY = -com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else if (_local2 == 2) {
exitSpeedX = -com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
exitSpeedY = com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else if (_local2 == 3) {
exitSpeedX = com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
exitSpeedY = com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
}
}
function setEnterSpeeds() {
var _local3 = _parent._parent.maze.homeX;
var _local2 = _parent._parent.maze.homeY;
if (x == _local3) {
enterSpeedX = com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else {
enterSpeedX = -com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
}
if (y == _local2) {
enterSpeedY = com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
} else {
enterSpeedY = -com.novelgames.flashgames.pacman.Config.GHOST_SPEED;
}
}
function getDirection() {
var _local2;
if (state == NORMAL) {
_local2 = _parent._parent.maze.getDirectionTo(x, y, _parent._parent.pacman.x, _parent._parent.pacman.y);
} else if (state == EATING) {
_local2 = _parent._parent.maze.getDirectionTo(x, y, _parent._parent.pacman.x, _parent._parent.pacman.y);
_local2 = getDirectionExcept(_local2);
} else if (state == DEAD) {
_local2 = _parent._parent.maze.getDirectionTo(x, y, _parent._parent.maze.homeX, _parent._parent.maze.homeY);
}
return(_local2);
}
function getDirectionExcept(theDirection) {
var _local3 = new Array();
if (theDirection == LEFT) {
if (_parent._parent.maze.getCanMove(x, y, x + 1, y)) {
return(RIGHT);
}
} else if (theDirection == RIGHT) {
if (_parent._parent.maze.getCanMove(x, y, x - 1, y)) {
return(LEFT);
}
} else if (theDirection == UP) {
if (_parent._parent.maze.getCanMove(x, y, x, y + 1)) {
return(DOWN);
}
} else if (theDirection == DOWN) {
if (_parent._parent.maze.getCanMove(x, y, x, y - 1)) {
return(UP);
}
}
if ((theDirection != LEFT) && (_parent._parent.maze.getCanMove(x, y, x - 1, y))) {
_local3.push(LEFT);
}
if ((theDirection != RIGHT) && (_parent._parent.maze.getCanMove(x, y, x + 1, y))) {
_local3.push(RIGHT);
}
if ((theDirection != UP) && (_parent._parent.maze.getCanMove(x, y, x, y - 1))) {
_local3.push(UP);
}
if ((theDirection != DOWN) && (_parent._parent.maze.getCanMove(x, y, x, y + 1))) {
_local3.push(DOWN);
}
return(_local3[Math.floor(Math.random() * _local3.length)]);
}
static var NONE = 0;
static var LEFT = 1;
static var RIGHT = 2;
static var UP = 3;
static var DOWN = 4;
static var START = 1;
static var NORMAL = 2;
static var EATING = 3;
static var DEAD = 4;
static var RESURRECT = 5;
}
Symbol 231 MovieClip [__Packages.com.novelgames.flashgames.pacman.Config] Frame 0
class com.novelgames.flashgames.pacman.Config
{
function Config () {
}
static var LIFE = 3;
static var DIMENSION_X = 12;
static var DIMENSION_Y = 7;
static var BLOCKSIZE = 50;
static var BASE_X = 25;
static var BASE_Y = 75;
static var PACMAN_SPEED = 10;
static var GHOST_SPEED = 5;
static var GHOST_ENTEREXITHOMEFRAMES = 5;
static var GHOST_RESURRECTFRAMES = 150;
static var NOOFPOWERFOODS = 2;
static var EATINGTIME = 180;
static var SCORE_GHOST = 200;
static var SCORE_NORMALFOOD = 10;
static var SCORE_POWERFOOD = 100;
static var SCORE_STAGECLEAR = 1000;
}
Symbol 232 MovieClip [__Packages.com.novelgames.flashgames.pacman.LifeBar] Frame 0
class com.novelgames.flashgames.pacman.LifeBar extends MovieClip
{
var gotoAndStop;
function LifeBar () {
super();
(gotoAndStop("life3"));// not popped
}
function setLife(life) {
(gotoAndStop("life" + life));// not popped
}
}
Symbol 233 MovieClip [__Packages.com.novelgames.flashgames.pacman.GameOverDialog] Frame 0
class com.novelgames.flashgames.pacman.GameOverDialog extends MovieClip
{
var gotoAndStop, gotoAndPlay, stop, _parent, playAgainButton;
function GameOverDialog () {
super();
(gotoAndStop("hide"));// not popped
}
function show() {
(gotoAndPlay("show"));// not popped
}
function animationFinished() {
(stop());// not popped
_parent.showEnterHighScore();
playAgainButton.onRelease = function () {
this._parent._parent._parent.gotoTitlePage();
};
}
}
Symbol 234 MovieClip [__Packages.com.novelgames.flashgames.pacman.WinDialog] Frame 0
class com.novelgames.flashgames.pacman.WinDialog extends MovieClip
{
var gotoAndStop, gotoAndPlay, _parent;
function WinDialog () {
super();
(gotoAndStop("hide"));// not popped
}
function show() {
(gotoAndPlay("show"));// not popped
}
function animationFinished() {
(gotoAndStop("hide"));// not popped
_parent.generateNextStage();
}
}
Symbol 235 MovieClip [__Packages.com.novelgames.flashgames.pacman.GeneratingDialog] Frame 0
class com.novelgames.flashgames.pacman.GeneratingDialog extends MovieClip
{
var bar;
function GeneratingDialog () {
super();
}
function setBar(percent) {
bar._width = percent * 200;
}
}
Symbol 236 MovieClip [__Packages.com.novelgames.flashgames.pacman.Pacman] Frame 0
class com.novelgames.flashgames.pacman.Pacman extends MovieClip
{
var direction, nextDirection, state, x, y, gotoAndStop, startX, startY, _parent, _x, _y, gotoAndPlay, stop;
function Pacman () {
super();
direction = NONE;
nextDirection = NONE;
state = NORMAL;
x = 0;
y = 0;
(gotoAndStop("normalLeft"));// not popped
Key.addListener(this);
}
function reset() {
do {
startX = Math.floor(Math.random() * com.novelgames.flashgames.pacman.Config.DIMENSION_X);
startY = Math.floor(Math.random() * com.novelgames.flashgames.pacman.Config.DIMENSION_Y);
} while (_parent.maze.getIsHome(startX, startY));
restart();
}
function restart() {
direction = NONE;
nextDirection = NONE;
state = NORMAL;
(gotoAndStop("normalLeft"));// not popped
x = startX;
y = startY;
_x = (x * com.novelgames.flashgames.pacman.Config.BLOCKSIZE) + com.novelgames.flashgames.pacman.Config.BASE_X;
_y = (y * com.novelgames.flashgames.pacman.Config.BLOCKSIZE) + com.novelgames.flashgames.pacman.Config.BASE_Y;
}
function startEating() {
state = EATING;
if (direction == LEFT) {
(gotoAndStop("eatingLeft"));// not popped
} else if (direction == RIGHT) {
(gotoAndStop("eatingRight"));// not popped
} else if (direction == UP) {
(gotoAndStop("eatingUp"));// not popped
} else if (direction == DOWN) {
(gotoAndStop("eatingDown"));// not popped
}
}
function stopEating() {
state = NORMAL;
if (direction == LEFT) {
(gotoAndStop("normalLeft"));// not popped
} else if (direction == RIGHT) {
(gotoAndStop("normalRight"));// not popped
} else if (direction == UP) {
(gotoAndStop("normalUp"));// not popped
} else if (direction == DOWN) {
(gotoAndStop("normalDown"));// not popped
}
}
function onEnterFrame() {
if (!_parent._parent.gameStarted) {
return(undefined);
}
move();
}
function onKeyDown() {
var _local2 = Key.getCode();
if (!_parent._parent.gameStarted) {
return(undefined);
}
if (_local2 == 37) {
nextDirection = LEFT;
} else if (_local2 == 39) {
nextDirection = RIGHT;
} else if (_local2 == 38) {
nextDirection = UP;
} else if (_local2 == 40) {
nextDirection = DOWN;
}
}
function move() {
var _local2;
if ((((_x - com.novelgames.flashgames.pacman.Config.BASE_X) % com.novelgames.flashgames.pacman.Config.BLOCKSIZE) == 0) && (((_y - com.novelgames.flashgames.pacman.Config.BASE_Y) % com.novelgames.flashgames.pacman.Config.BLOCKSIZE) == 0)) {
x = Math.round((_x - com.novelgames.flashgames.pacman.Config.BASE_X) / com.novelgames.flashgames.pacman.Config.BLOCKSIZE);
y = Math.round((_y - com.novelgames.flashgames.pacman.Config.BASE_Y) / com.novelgames.flashgames.pacman.Config.BLOCKSIZE);
_parent.foodHolder.eatFood(x, y);
direction = nextDirection;
if (direction == LEFT) {
if (state == NORMAL) {
(gotoAndStop("normalLeft"));// not popped
} else {
(gotoAndStop("eatingLeft"));// not popped
}
if (!_parent.maze.getCanMove(x, y, x - 1, y)) {
direction = NONE;
}
} else if (direction == RIGHT) {
if (state == NORMAL) {
(gotoAndStop("normalRight"));// not popped
} else {
(gotoAndStop("eatingRight"));// not popped
}
if (!_parent.maze.getCanMove(x, y, x + 1, y)) {
direction = NONE;
}
} else if (direction == UP) {
if (state == NORMAL) {
(gotoAndStop("normalUp"));// not popped
} else {
(gotoAndStop("eatingUp"));// not popped
}
if (!_parent.maze.getCanMove(x, y - 1, x, y)) {
direction = NONE;
}
} else if (direction == DOWN) {
if (state == NORMAL) {
(gotoAndStop("normalDown"));// not popped
} else {
(gotoAndStop("eatingDown"));// not popped
}
if (!_parent.maze.getCanMove(x, y, x, y + 1)) {
direction = NONE;
}
}
}
if (direction == LEFT) {
_x = _x - com.novelgames.flashgames.pacman.Config.PACMAN_SPEED;
} else if (direction == RIGHT) {
_x = _x + com.novelgames.flashgames.pacman.Config.PACMAN_SPEED;
} else if (direction == UP) {
_y = _y - com.novelgames.flashgames.pacman.Config.PACMAN_SPEED;
} else if (direction == DOWN) {
_y = _y + com.novelgames.flashgames.pacman.Config.PACMAN_SPEED;
}
_local2 = _parent.ghostHolder.getGhost(_x - com.novelgames.flashgames.pacman.Config.BASE_X, _y - com.novelgames.flashgames.pacman.Config.BASE_Y);
if (_local2) {
if (state == EATING) {
_local2.die();
_parent._parent.score = _parent._parent.score + com.novelgames.flashgames.pacman.Config.SCORE_GHOST;
_parent._parent.soundGhost.start();
} else {
_parent._parent.gameStarted = false;
state = DEAD;
(gotoAndPlay("dead"));// not popped
_parent._parent.soundDead.start();
}
}
}
function deadAnimationFinished() {
(stop());// not popped
_parent._parent.reduceLife();
}
static var NONE = 0;
static var LEFT = 1;
static var RIGHT = 2;
static var UP = 3;
static var DOWN = 4;
static var NORMAL = 1;
static var EATING = 2;
static var DEAD = 3;
}
Symbol 237 MovieClip [__Packages.com.novelgames.flashgames.pacman.GhostHolder] Frame 0
class com.novelgames.flashgames.pacman.GhostHolder extends MovieClip
{
var noOfGhosts, ghosts, attachMovie, _parent;
function GhostHolder () {
super();
noOfGhosts = 0;
ghosts = new Array();
}
function reset(noOfGhosts) {
var _local2;
this.noOfGhosts = noOfGhosts;
_local2 = 0;
while (_local2 < noOfGhosts) {
ghosts[_local2] = attachMovie("ghost", "ghost" + _local2, _local2);
ghosts[_local2].colour = _local2 % 6;
_local2++;
}
restart();
}
function removeAll() {
var _local2;
_local2 = 0;
while (_local2 < ghosts.length) {
ghosts[_local2].removeMovieClip();
ghosts[_local2] = null;
_local2++;
}
}
function restart() {
var _local2;
_local2 = 0;
while (_local2 < noOfGhosts) {
ghosts[_local2]._x = (_parent.maze.homeX * com.novelgames.flashgames.pacman.Config.BLOCKSIZE) + (com.novelgames.flashgames.pacman.Config.BLOCKSIZE / 2);
ghosts[_local2]._y = (_parent.maze.homeY * com.novelgames.flashgames.pacman.Config.BLOCKSIZE) + (com.novelgames.flashgames.pacman.Config.BLOCKSIZE / 2);
ghosts[_local2].startFrame = ((_local2 + 1) * 59) - 30;
ghosts[_local2].startCount = 0;
ghosts[_local2].direction = com.novelgames.flashgames.pacman.Ghost.NONE;
ghosts[_local2].state = com.novelgames.flashgames.pacman.Ghost.START;
_local2++;
}
}
function startEating() {
var _local2;
_local2 = 0;
while (_local2 < noOfGhosts) {
ghosts[_local2].startEating();
_local2++;
}
}
function blinkEating() {
var _local2;
_local2 = 0;
while (_local2 < noOfGhosts) {
ghosts[_local2].blinkEating();
_local2++;
}
}
function stopEating() {
var _local2;
_local2 = 0;
while (_local2 < noOfGhosts) {
ghosts[_local2].stopEating();
_local2++;
}
}
function getGhost(x, y) {
var _local2;
_local2 = 0;
while (_local2 < ghosts.length) {
if (ghosts[_local2].state == com.novelgames.flashgames.pacman.Ghost.DEAD) {
} else if ((Math.abs(ghosts[_local2]._x - x) <= 15) && (Math.abs(ghosts[_local2]._y - y) <= 15)) {
return(ghosts[_local2]);
}
_local2++;
}
}
function onEnterFrame() {
if (!_parent._parent.gameStarted) {
return(undefined);
}
moveGhosts();
}
function moveGhosts() {
var _local2;
_local2 = 0;
while (_local2 < noOfGhosts) {
ghosts[_local2].move();
_local2++;
}
}
}
Symbol 238 MovieClip [__Packages.com.novelgames.flashgames.pacman.FoodHolder] Frame 0
class com.novelgames.flashgames.pacman.FoodHolder extends MovieClip
{
var foods, eatenNo, _parent, attachMovie;
function FoodHolder () {
super();
foods = new Array();
eatenNo = 0;
}
function reset() {
var _local2;
var _local3;
var _local5;
var _local4;
removeAll();
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X * com.novelgames.flashgames.pacman.Config.DIMENSION_Y)) {
_local5 = _local2 % com.novelgames.flashgames.pacman.Config.DIMENSION_X;
_local4 = Math.floor(_local2 / com.novelgames.flashgames.pacman.Config.DIMENSION_X);
if (_parent.maze.getIsHome(_local5, _local4)) {
} else if ((_local5 == _parent.pacman.x) && (_local4 == _parent.pacman.y)) {
} else {
foods[_local2] = attachMovie("food", "food" + _local2, _local2);
foods[_local2].initialize(_local5 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE, _local4 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE, NORMAL);
}
_local2++;
}
_local2 = 0;
while (_local2 < com.novelgames.flashgames.pacman.Config.NOOFPOWERFOODS) {
_local3 = Math.floor((Math.random() * com.novelgames.flashgames.pacman.Config.DIMENSION_X) * com.novelgames.flashgames.pacman.Config.DIMENSION_Y);
if ((!foods[_local3]) || (foods[_local3].state == POWER)) {
_local2--;
} else {
foods[_local3].setPower();
}
_local2++;
}
eatenNo = 0;
}
function removeAll() {
var _local2;
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X * com.novelgames.flashgames.pacman.Config.DIMENSION_Y)) {
foods[_local2].removeMovieClip();
foods[_local2] = null;
_local2++;
}
}
function eatFood(x, y) {
var _local2 = foods[(y * com.novelgames.flashgames.pacman.Config.DIMENSION_X) + x];
if (!_local2) {
return(undefined);
}
if (_local2.state == NORMAL) {
_parent._parent.score = _parent._parent.score + com.novelgames.flashgames.pacman.Config.SCORE_NORMALFOOD;
_parent._parent.soundFood.start();
} else {
_parent._parent.score = _parent._parent.score + com.novelgames.flashgames.pacman.Config.SCORE_POWERFOOD;
_parent.startEating();
_parent._parent.soundPower.start();
}
_local2.removeMovieClip();
foods[(y * com.novelgames.flashgames.pacman.Config.DIMENSION_X) + x] = null;
eatenNo++;
if (eatenNo >= ((com.novelgames.flashgames.pacman.Config.DIMENSION_X * com.novelgames.flashgames.pacman.Config.DIMENSION_Y) - 5)) {
_parent.nextStage();
}
}
static var NORMAL = 1;
static var POWER = 2;
}
Symbol 239 MovieClip [__Packages.com.novelgames.flashgames.pacman.Food] Frame 0
class com.novelgames.flashgames.pacman.Food extends MovieClip
{
var _x, _y, state, gotoAndStop;
function Food () {
super();
}
function initialize(x, y, state) {
_x = x;
_y = y;
this.state = state;
if (state == com.novelgames.flashgames.pacman.FoodHolder.NORMAL) {
(gotoAndStop("normal"));// not popped
} else {
(gotoAndStop("power"));// not popped
}
}
function setPower() {
state = com.novelgames.flashgames.pacman.FoodHolder.POWER;
(gotoAndStop("power"));// not popped
}
}
Symbol 240 MovieClip [__Packages.com.novelgames.flashgames.pacman.Maze] Frame 0
class com.novelgames.flashgames.pacman.Maze extends MovieClip
{
var depth, roads, wallsH, wallsV, wallsC, generatingRoads, generatingDirections, generatingDirectionX, generatingDirectionY, homeX, homeY, theRoad, _parent, home, attachMovie;
function Maze () {
super();
depth = 0;
roads = new Array();
wallsH = new Array();
wallsV = new Array();
wallsC = new Array();
generatingRoads = false;
generatingDirections = false;
generatingDirectionX = 0;
generatingDirectionY = 0;
}
function reset() {
var _local2;
removeRoads();
generateRoads();
}
function onEnterFrame() {
generateNextDirection();
generateNextRoad();
}
function removeRoads() {
var _local2;
var _local3;
var _local4;
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
roads[_local2] = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1);
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
roads[_local2][_local3] = new com.novelgames.flashgames.pacman.Road();
roads[_local2][_local3].x = _local2;
roads[_local2][_local3].y = _local3;
roads[_local2][_local3].up = false;
roads[_local2][_local3].left = false;
roads[_local2][_local3].done = false;
roads[_local2][_local3].previous = null;
roads[_local2][_local3].directionTo = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_X);
_local4 = 0;
while (_local4 < com.novelgames.flashgames.pacman.Config.DIMENSION_X) {
roads[_local2][_local3].directionTo[_local4] = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_Y);
_local4++;
}
_local3++;
}
_local2++;
}
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
roads[_local2][com.novelgames.flashgames.pacman.Config.DIMENSION_Y].left = true;
_local2++;
}
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
roads[com.novelgames.flashgames.pacman.Config.DIMENSION_X][_local2].up = true;
_local2++;
}
}
function removeWalls() {
var _local3;
var _local2;
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
if (wallsH[_local3][_local2]) {
wallsH[_local3][_local2].removeMovieClip();
}
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
if (wallsV[_local3][_local2]) {
wallsV[_local3][_local2].removeMovieClip();
}
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
if (wallsC[_local3][_local2]) {
wallsC[_local3][_local2].removeMovieClip();
}
_local2++;
}
_local3++;
}
wallsH = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1);
wallsV = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1);
wallsC = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1);
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
wallsH[_local3] = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1);
wallsV[_local3] = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1);
wallsC[_local3] = new Array(com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1);
_local3++;
}
depth = 0;
}
function generateRoads() {
var _local3;
var _local2;
var _local7;
var _local6;
var _local5;
var _local4;
homeX = Math.floor(Math.random() * (com.novelgames.flashgames.pacman.Config.DIMENSION_X - 1));
homeY = Math.floor(Math.random() * (com.novelgames.flashgames.pacman.Config.DIMENSION_Y - 1));
roads[homeX][homeY].done = true;
roads[homeX + 1][homeY].left = true;
roads[homeX + 1][homeY].done = true;
roads[homeX][homeY + 1].up = true;
roads[homeX][homeY + 1].done = true;
roads[homeX + 1][homeY + 1].up = true;
roads[homeX + 1][homeY + 1].left = true;
roads[homeX + 1][homeY + 1].done = true;
_local3 = Math.floor(Math.random() * (com.novelgames.flashgames.pacman.Config.DIMENSION_X - 2));
if (_local3 >= homeX) {
_local3 = _local3 + 2;
}
_local2 = Math.floor(Math.random() * (com.novelgames.flashgames.pacman.Config.DIMENSION_Y - 2));
if (_local2 >= homeY) {
_local2 = _local2 + 2;
}
theRoad = roads[_local3][_local2];
theRoad.done = true;
generatingRoads = true;
}
function generateNextRoad() {
var _local4;
var _local2;
var _local3;
var _local5;
var _local7;
var _local6;
if (!generatingRoads) {
return(undefined);
}
_parent.addGenerateProgress();
_local4 = 0;
while (theRoad) {
_local5 = getAvailableRoads(theRoad);
if (_local5.length == 0) {
theRoad = theRoad.previous;
} else {
_local3 = _local5[Math.floor(Math.random() * _local5.length)];
_local3.previous = theRoad;
_local3.done = true;
if (_local3.x > theRoad.x) {
_local3.left = true;
} else if (_local3.x < theRoad.x) {
theRoad.left = true;
} else if (_local3.y > theRoad.y) {
_local3.up = true;
} else if (_local3.y < theRoad.y) {
theRoad.up = true;
}
theRoad = _local3;
}
_local4++;
if (_local4 > 30) {
return(undefined);
}
}
generatingRoads = false;
_local4 = 0;
while (_local4 < com.novelgames.flashgames.pacman.Config.DIMENSION_X) {
_local2 = 0;
while (_local2 < com.novelgames.flashgames.pacman.Config.DIMENSION_Y) {
if (getNoOfRoads(_local4, _local2) <= 1) {
addRandomRoad(_local4, _local2);
}
_local2++;
}
_local4++;
}
if ((((getNoOfRoads(homeX, homeY) == 2) && (getNoOfRoads(homeX + 1, homeY) == 2)) && (getNoOfRoads(homeX, homeY + 1) == 2)) && (getNoOfRoads(homeX + 1, homeY + 1) == 2)) {
if (homeX <= (com.novelgames.flashgames.pacman.Config.DIMENSION_X / 2)) {
_local7 = homeX + 1;
} else {
_local7 = homeX;
}
if (homeY <= (com.novelgames.flashgames.pacman.Config.DIMENSION_Y / 2)) {
_local6 = homeY + 1;
} else {
_local6 = homeY;
}
addRandomRoad(_local7, _local6);
}
createDirectionTos();
}
function getAvailableRoads(theRoad) {
var _local4 = new Array();
var _local3 = theRoad.x;
var _local2 = theRoad.y;
if ((_local3 >= 1) && (!roads[_local3 - 1][_local2].done)) {
_local4.push(roads[_local3 - 1][_local2]);
}
if ((_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X - 1)) && (!roads[_local3 + 1][_local2].done)) {
_local4.push(roads[_local3 + 1][_local2]);
}
if ((_local2 >= 1) && (!roads[_local3][_local2 - 1].done)) {
_local4.push(roads[_local3][_local2 - 1]);
}
if ((_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y - 1)) && (!roads[_local3][_local2 + 1].done)) {
_local4.push(roads[_local3][_local2 + 1]);
}
return(_local4);
}
function getNoOfRoads(x, y) {
var _local2 = 0;
if (roads[x][y].up) {
_local2++;
}
if (roads[x][y].left) {
_local2++;
}
if (roads[x + 1][y].left) {
_local2++;
}
if (roads[x][y + 1].up) {
_local2++;
}
return(_local2);
}
function addRandomRoad(x, y) {
var _local4 = new Array();
var _local5;
if ((x >= 1) && (!roads[x][y].left)) {
_local4.push(LEFT);
}
if ((x < (com.novelgames.flashgames.pacman.Config.DIMENSION_X - 1)) && (!roads[x + 1][y].left)) {
_local4.push(RIGHT);
}
if ((y >= 1) && (!roads[x][y].up)) {
_local4.push(UP);
}
if ((y < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y - 1)) && (!roads[x][y + 1].up)) {
_local4.push(DOWN);
}
_local5 = _local4[Math.floor(Math.random() * _local4.length)];
if (_local5 == LEFT) {
roads[x][y].left = true;
} else if (_local5 == RIGHT) {
roads[x + 1][y].left = true;
} else if (_local5 == UP) {
roads[x][y].up = true;
} else if (_local5 == DOWN) {
roads[x][y + 1].up = true;
}
}
function createWalls() {
var _local3;
var _local2;
var _local7;
var _local5;
var _local6;
var _local4;
home._x = homeX * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
home._y = homeY * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
removeWalls();
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
if (!roads[_local3][_local2].left) {
wallsH[_local3][_local2] = attachMovie("wallH", (("wallH" + _local3) + "_") + _local2, depth);
wallsH[_local3][_local2]._x = _local3 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
wallsH[_local3][_local2]._y = _local2 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
depth++;
}
if (!roads[_local3][_local2].up) {
wallsV[_local3][_local2] = attachMovie("wallV", (("wallV" + _local3) + "_") + _local2, depth);
wallsV[_local3][_local2]._x = _local3 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
wallsV[_local3][_local2]._y = _local2 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
depth++;
}
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
_local7 = wallVExists(_local3 - 1, _local2);
_local5 = wallVExists(_local3, _local2);
_local6 = wallHExists(_local3, _local2 - 1);
_local4 = wallHExists(_local3, _local2);
if (((_local7 || (_local5)) || (_local6)) || (_local4)) {
wallsC[_local3][_local2] = attachMovie("wallC", (("wallC" + _local3) + "_") + _local2, depth);
wallsC[_local3][_local2]._x = _local3 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
wallsC[_local3][_local2]._y = _local2 * com.novelgames.flashgames.pacman.Config.BLOCKSIZE;
depth++;
if (((_local7 && (_local5)) && (_local6)) && (_local4)) {
wallsC[_local3][_local2].gotoAndStop("all");
} else if (((_local7 && (_local5)) && (_local6)) && (!_local4)) {
wallsC[_local3][_local2].gotoAndStop("leftRightUp");
} else if (((_local7 && (_local5)) && (!_local6)) && (_local4)) {
wallsC[_local3][_local2].gotoAndStop("leftRightDown");
} else if (((_local7 && (!_local5)) && (_local6)) && (_local4)) {
wallsC[_local3][_local2].gotoAndStop("leftUpDown");
} else if ((((!_local7) && _local5) && _local6) && _local4) {
wallsC[_local3][_local2].gotoAndStop("rightUpDown");
} else if (((_local7 && _local5) && (!_local6)) && (!_local4)) {
wallsC[_local3][_local2].gotoAndStop("leftRight");
} else if (((_local7 && (!_local5)) && _local6) && (!_local4)) {
wallsC[_local3][_local2].gotoAndStop("leftUp");
} else if (((_local7 && (!_local5)) && (!_local6)) && _local4) {
wallsC[_local3][_local2].gotoAndStop("leftDown");
} else if ((((!_local7) && _local5) && _local6) && (!_local4)) {
wallsC[_local3][_local2].gotoAndStop("rightUp");
} else if ((((!_local7) && _local5) && (!_local6)) && _local4) {
wallsC[_local3][_local2].gotoAndStop("rightDown");
} else if ((((!_local7) && (!_local5)) && _local6) && _local4) {
wallsC[_local3][_local2].gotoAndStop("upDown");
} else if (((_local7 && (!_local5)) && (!_local6)) && (!_local4)) {
wallsC[_local3][_local2].gotoAndStop("left");
} else if ((((!_local7) && _local5) && (!_local6)) && (!_local4)) {
wallsC[_local3][_local2].gotoAndStop("right");
} else if ((((!_local7) && (!_local5)) && _local6) && (!_local4)) {
wallsC[_local3][_local2].gotoAndStop("up");
} else if ((((!_local7) && (!_local5)) && (!_local6)) && _local4) {
wallsC[_local3][_local2].gotoAndStop("down");
}
}
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < (com.novelgames.flashgames.pacman.Config.DIMENSION_X + 1)) {
_local2 = 0;
while (_local2 < (com.novelgames.flashgames.pacman.Config.DIMENSION_Y + 1)) {
if (wallsV[_local3][_local2]) {
_local7 = wallCExists(_local3, _local2);
_local5 = wallCExists(_local3 + 1, _local2);
if (_local7 && (_local5)) {
wallsV[_local3][_local2].gotoAndStop("leftRight");
} else if (_local7) {
wallsV[_local3][_local2].gotoAndStop("left");
} else if (_local5) {
wallsV[_local3][_local2].gotoAndStop("right");
}
}
if (wallsH[_local3][_local2]) {
_local6 = wallCExists(_local3, _local2);
_local4 = wallCExists(_local3, _local2 + 1);
if (_local6 && (_local4)) {
wallsH[_local3][_local2].gotoAndStop("upDown");
} else if (_local6) {
wallsH[_local3][_local2].gotoAndStop("up");
} else if (_local4) {
wallsH[_local3][_local2].gotoAndStop("down");
}
}
_local2++;
}
_local3++;
}
}
function wallVExists(x, y) {
if ((x < 0) || (x > com.novelgames.flashgames.pacman.Config.DIMENSION_X)) {
return(false);
}
if ((y < 0) || (y > com.novelgames.flashgames.pacman.Config.DIMENSION_Y)) {
return(false);
}
return(!roads[x][y].up);
}
function wallHExists(x, y) {
if ((x < 0) || (x > com.novelgames.flashgames.pacman.Config.DIMENSION_X)) {
return(false);
}
if ((y < 0) || (y > com.novelgames.flashgames.pacman.Config.DIMENSION_Y)) {
return(false);
}
return(!roads[x][y].left);
}
function wallCExists(x, y) {
if ((x < 0) || (x > com.novelgames.flashgames.pacman.Config.DIMENSION_X)) {
return(false);
}
if ((y < 0) || (y > com.novelgames.flashgames.pacman.Config.DIMENSION_Y)) {
return(false);
}
return(wallsC[x][y] != null);
}
function createDirectionTos() {
var _local3;
var _local2;
generatingDirections = true;
generatingDirectionX = 0;
generatingDirectionY = 0;
}
function generateNextDirection() {
var _local2;
if (!generatingDirections) {
return(undefined);
}
_parent.addGenerateProgress();
_local2 = 0;
while (_local2 < 2) {
createDirectionTo(roads[generatingDirectionX][generatingDirectionY]);
generatingDirectionX++;
if (generatingDirectionX >= com.novelgames.flashgames.pacman.Config.DIMENSION_X) {
generatingDirectionX = 0;
generatingDirectionY++;
if (generatingDirectionY >= com.novelgames.flashgames.pacman.Config.DIMENSION_Y) {
generatingDirections = false;
createWalls();
_parent.finishMaze();
return(undefined);
}
}
_local2++;
}
}
function createDirectionTo(theRoad) {
var _local5;
var _local8;
var _local3;
var _local2;
var _local7 = new Array();
var _local6 = new Array();
_local5 = 0;
while (_local5 < com.novelgames.flashgames.pacman.Config.DIMENSION_X) {
_local8 = 0;
while (_local8 < com.novelgames.flashgames.pacman.Config.DIMENSION_Y) {
theRoad.directionTo[_local5][_local8] = NONE;
_local8++;
}
_local5++;
}
_local3 = theRoad.x;
_local2 = theRoad.y;
theRoad.directionTo[_local3][_local2] = LEFT;
if (roads[_local3][_local2].left) {
_local7.push(roads[_local3 - 1][_local2]);
theRoad.directionTo[_local3 - 1][_local2] = LEFT;
}
if (roads[_local3 + 1][_local2].left) {
_local7.push(roads[_local3 + 1][_local2]);
theRoad.directionTo[_local3 + 1][_local2] = RIGHT;
}
if (roads[_local3][_local2].up) {
_local7.push(roads[_local3][_local2 - 1]);
theRoad.directionTo[_local3][_local2 - 1] = UP;
}
if (roads[_local3][_local2 + 1].up) {
_local7.push(roads[_local3][_local2 + 1]);
theRoad.directionTo[_local3][_local2 + 1] = DOWN;
}
while (_local7.length > 0) {
_local6 = new Array();
_local5 = 0;
while (_local5 < _local7.length) {
_local3 = _local7[_local5].x;
_local2 = _local7[_local5].y;
if (roads[_local3][_local2].left) {
if (theRoad.directionTo[_local3 - 1][_local2] == NONE) {
_local6.push(roads[_local3 - 1][_local2]);
theRoad.directionTo[_local3 - 1][_local2] = theRoad.directionTo[_local3][_local2];
}
}
if (roads[_local3 + 1][_local2].left) {
if (theRoad.directionTo[_local3 + 1][_local2] == NONE) {
_local6.push(roads[_local3 + 1][_local2]);
theRoad.directionTo[_local3 + 1][_local2] = theRoad.directionTo[_local3][_local2];
}
}
if (roads[_local3][_local2].up) {
if (theRoad.directionTo[_local3][_local2 - 1] == NONE) {
_local6.push(roads[_local3][_local2 - 1]);
theRoad.directionTo[_local3][_local2 - 1] = theRoad.directionTo[_local3][_local2];
}
}
if (roads[_local3][_local2 + 1].up) {
if (theRoad.directionTo[_local3][_local2 + 1] == NONE) {
_local6.push(roads[_local3][_local2 + 1]);
theRoad.directionTo[_local3][_local2 + 1] = theRoad.directionTo[_local3][_local2];
}
}
_local5++;
}
_local7 = _local6;
}
theRoad.directionTo[theRoad.x][theRoad.y] = NONE;
}
function getIsHome(x, y) {
if ((x == homeX) && (y == homeY)) {
return(true);
}
if ((x == homeX) && (y == (homeY + 1))) {
return(true);
}
if ((x == (homeX + 1)) && (y == homeY)) {
return(true);
}
if ((x == (homeX + 1)) && (y == (homeY + 1))) {
return(true);
}
return(false);
}
function getCanMove(x1, y1, x2, y2) {
if (getIsHome(x2, y2)) {
return(false);
}
if ((x2 == (x1 + 1)) && (y1 == y2)) {
return(roads[x2][y1].left);
}
if ((x2 == (x1 - 1)) && (y1 == y2)) {
return(roads[x1][y1].left);
}
if ((x1 == x2) && ((y1 + 1) == y2)) {
return(roads[x1][y2].up);
}
if ((x1 == x2) && ((y1 - 1) == y2)) {
return(roads[x1][y1].up);
}
return(false);
}
function getHomeExitPosition() {
var _local2 = new Array();
if (getNoOfRoads(homeX, homeY) > 2) {
_local2.push(0);
}
if (getNoOfRoads(homeX + 1, homeY) > 2) {
_local2.push(1);
}
if (getNoOfRoads(homeX, homeY + 1) > 2) {
_local2.push(2);
}
if (getNoOfRoads(homeX + 1, homeY + 1) > 2) {
_local2.push(3);
}
return(_local2[Math.floor(Math.random() * _local2.length)]);
}
function getDirectionTo(fromX, fromY, toX, toY) {
if (roads[fromX][fromY].directionTo[toX][toY] == undefined) {
createDirectionTo(roads[fromX][fromY]);
}
return(roads[fromX][fromY].directionTo[toX][toY]);
}
static var NONE = 0;
static var LEFT = 1;
static var RIGHT = 2;
static var UP = 3;
static var DOWN = 4;
}
Symbol 241 MovieClip [__Packages.com.novelgames.flashgames.pacman.Road] Frame 0
class com.novelgames.flashgames.pacman.Road
{
function Road () {
}
}
Symbol 242 MovieClip [__Packages.com.novelgames.flashgames.pacman.PlayArea] Frame 0
class com.novelgames.flashgames.pacman.PlayArea extends MovieClip
{
var isEating, eatingCount, noOfGhosts, generateProgress, maze, pacman, ghostHolder, _parent, generatingDialog, foodHolder, winDialog;
function PlayArea () {
super();
isEating = false;
eatingCount = 0;
noOfGhosts = 0;
generateProgress = 0;
maze._visible = false;
pacman._visible = false;
}
function restart() {
pacman.restart();
ghostHolder.restart();
}
function onLoad() {
reset(1);
hideThings();
}
function onEnterFrame() {
timeEating();
}
function reset(noOfGhosts) {
_parent.gameStarted = false;
this.noOfGhosts = noOfGhosts;
generateProgress = 0;
generatingDialog._visible = true;
maze.reset();
}
function finishMaze() {
pacman.reset();
foodHolder.reset();
ghostHolder.reset(noOfGhosts);
isEating = false;
_parent.gameStarted = true;
generatingDialog._visible = false;
showThings();
}
function addGenerateProgress() {
generateProgress++;
generatingDialog.setBar(generateProgress / 48);
}
function hideThings() {
maze._visible = false;
pacman._visible = false;
foodHolder._visible = false;
ghostHolder._visible = false;
}
function showThings() {
maze._visible = true;
pacman._visible = true;
foodHolder._visible = true;
ghostHolder._visible = true;
}
function startEating() {
pacman.startEating();
ghostHolder.startEating();
isEating = true;
eatingCount = 0;
}
function blinkEating() {
ghostHolder.blinkEating();
}
function stopEating() {
pacman.stopEating();
ghostHolder.stopEating();
isEating = false;
}
function timeEating() {
if (!isEating) {
return(undefined);
}
eatingCount++;
if (eatingCount >= com.novelgames.flashgames.pacman.Config.EATINGTIME) {
stopEating();
} else if (eatingCount >= (com.novelgames.flashgames.pacman.Config.EATINGTIME - 30)) {
blinkEating();
}
}
function nextStage() {
_parent.gameStarted = false;
_parent.score = _parent.score + com.novelgames.flashgames.pacman.Config.SCORE_STAGECLEAR;
winDialog.show();
_parent.soundWin.start();
}
function generateNextStage() {
reset(noOfGhosts + 1);
pacman._visible = false;
ghostHolder._visible = false;
}
}
Symbol 243 MovieClip [__Packages.com.novelgames.flashgames.pacman.Game] Frame 0
class com.novelgames.flashgames.pacman.Game extends MovieClip
{
var life, score, gameStarted, lifeBar, playArea, gameOverDialog, _parent;
function Game () {
super();
life = com.novelgames.flashgames.pacman.Config.LIFE;
score = 0;
gameStarted = false;
addSound("soundFood");
addSound("soundPower");
addSound("soundGhost");
addSound("soundDead");
addSound("soundWin");
}
function reduceLife() {
life--;
lifeBar.setLife(life);
if (life > 0) {
gameStarted = true;
playArea.restart();
} else {
gameOver();
}
}
function gameOver() {
gameOverDialog.show();
}
function showEnterHighScore() {
_parent.showEnterHighScore(score);
}
function addSound(name) {
this[name] = new Sound(this);
this[name].attachSound(name);
_parent.registerSound(this[name]);
}
}
Symbol 244 MovieClip [__Packages.com.novelgames.flashgames.common.MainDevelopment] Frame 0
class com.novelgames.flashgames.common.MainDevelopment extends MovieClip
{
var gotoAndStop, startButton, highScoresButton, creditsButton;
function MainDevelopment () {
super();
}
static function initialize(movieClip) {
movieClip.__proto__ = com.novelgames.flashgames.common.MainDevelopment.prototype;
movieClip.gotoTitlePage();
}
function gotoTitlePage() {
(gotoAndStop("title"));// not popped
startButton.onRelease = function () {
this._parent.gotoInstructionsPage();
};
highScoresButton.onRelease = function () {
this._parent.showHighScores();
};
creditsButton.onRelease = function () {
this._parent.showCredits();
};
}
function gotoInstructionsPage() {
(gotoAndStop("instructions"));// not popped
startButton.onRelease = function () {
this._parent.gotoGamePage();
};
}
function gotoGamePage() {
(gotoAndStop("game"));// not popped
}
function showHighScores() {
trace("showHighScores()");
}
function showCredits() {
trace("showCredits()");
}
function showEnterHighScore(score) {
trace(("showEnterHighScore(" + score) + ")");
}
function registerSound(theSound) {
trace("registerSound");
}
}
Symbol 213 Button
on (release) {
getURL ("http://www.startgames.ws", "_blank");
}
Symbol 218 Button
on (release) {
getURL ("http://www.startgames.ws/games_for_websites.html", "_blank");
}