Frame 1
stopAllSounds();
OnLevel = 0;
CameraX = -5000;
CameraY = -5000;
CoinsLeft = 4;
_quality = "High";
play();
Frame 2
if (CoinsLeft == 0) {
gotoAndPlay (470);
}
Frame 3
ifFrameLoaded (424) {
gotoAndPlay (51);
}
Frame 15
ifFrameLoaded (424) {
gotoAndPlay (51);
}
Frame 18
gotoAndPlay (15);
Frame 51
stopAllSounds();
OnLevel = 0;
CameraX = -5000;
CameraY = -5000;
CoinsLeft = 4;
Frame 52
if (CoinsLeft == 0) {
gotoAndPlay (470);
}
Frame 289
stopAllSounds();
CameraX = -10000;
CameraY = -10000;
_quality = "High";
Frame 303
stop();
Frame 382
stop();
Frame 408
so = sharedobject.getLocal("DweditFlash");
HighScore = so.data.HighScore;
if (HighScore < 1) {
HighScore = 1;
so.data.HighScore = HighScore;
so.flush();
}
OnLevel = 1;
BeatLevel = ("Beat Level " + HighScore) + " to unlock the next level.";
Frame 409
stop();
Frame 410
OnLevel--;
Frame 424
ifFrameLoaded (535) {
gotoAndPlay (470);
}
Frame 427
gotoAndPlay (424);
Frame 470
var level;
var maze;
var w;
var h;
var mw;
var mh;
var CameraX;
var CameraY;
var OnLevel;
var CoinsLeft;
var Character;
stopAllSounds();
if (CoinsLeft == 0) {
_root.coinwav.gotoAndPlay(2);
}
_quality = "low";
CameraX = -5000;
CameraY = -5000;
OnLevel++;
so = sharedobject.getLocal("DweditFlash");
if (HighScore < OnLevel) {
HighScore = OnLevel;
so.data.HighScore = HighScore;
so.flush();
}
CoinsLeft = 4;
Frame 471
txtLevel = "Level " + OnLevel;
Frame 531
back.gotoAndStop(((OnLevel - 1) % 8) + 1);
Frame 532
gotoAndPlay (534);
Instance of Symbol 96 MovieClip "chiu" in Frame 532
onClipEvent (load) {
this.gotoAndPlay((_root.Character * 20) + 1);
}
onClipEvent (enterFrame) {
function MoveChiu() {
var X;
var Y;
var x1;
var y1;
var x2;
var y2;
X = ChiuX + XSpeed;
Y = ChiuY;
if (checkforwalls(X, Y + 5, X, Y + 58)) {
X = (int(X / 32) + 1) * 32;
}
if (checkforwalls(X + 32, Y + 5, X + 32, Y + 58)) {
X = int(X / 32) * 32;
}
Y = ChiuY + YSpeed;
if (checkforwalls(X, Y + 64, X + 31, Y + 64)) {
Y = int(Y / 32) * 32;
OnGround = true;
} else {
OnGround = false;
}
if (checkforwalls(X, Y - 0, X + 31, Y - 0)) {
Y = (int(Y / 32) + 1) * 32;
}
ChiuX = X;
ChiuY = Y;
}
function checkforwalls(x1, y1, x2, y2) {
var X;
var Y;
x1 = int(x1 / 32);
x2 = int(x2 / 32);
y1 = int(y1 / 32);
y2 = int(y2 / 32);
Y = y1;
while (y2 >= Y) {
X = x1;
while (x2 >= X) {
if (0 < _root.level[X + (Y * _root.w)]) {
_root.debugtext.text = "true";
return(true);
}
X++;
}
Y++;
}
return(false);
}
var ChiuX;
var ChiuY;
var XSpeed;
var YSpeed;
var Jump;
var OnGround;
if (Key.isDown(37)) {
XSpeed = XSpeed - 6;
this._xscale = -Math.abs(this._xscale);
}
if (Key.isDown(39)) {
XSpeed = XSpeed + 6;
this._xscale = Math.abs(this._xscale);
}
if (Jump == 0) {
YSpeed = YSpeed + 4;
} else {
YSpeed = -20;
Jump++;
if (!(Key.isDown(17) || (Key.isDown(38)))) {
Jump = 0;
}
if (3 < Jump) {
Jump = 0;
}
}
if ((OnGround == true) && (Key.isDown(17) || (Key.isDown(38)))) {
Jump = 1;
}
if (24 < YSpeed) {
YSpeed = 24;
}
MoveChiu();
XSpeed = XSpeed * 0.5;
if (0.5 >= Math.abs(XSpeed)) {
XSpeed = 0;
}
if (XSpeed == 0) {
this.stop();
} else {
this.play();
}
_root.CameraX = ChiuX - 241;
_root.CameraY = ChiuY - 168;
if (_root.CameraX < 0) {
_root.CameraX = 0;
}
if (((_root.w * 32) - 550) < _root.CameraX) {
_root.CameraX = (_root.w * 32) - 550;
}
if (_root.CameraY < 0) {
_root.CameraY = 0;
}
if (((_root.h * 32) - 400) < _root.CameraY) {
_root.CameraY = (_root.h * 32) - 400;
}
this._x = ((-_root.CameraX) + ChiuX) + 16;
this._y = ((-_root.CameraY) + ChiuY) + 40;
}
Instance of Symbol 156 MovieClip "block" in Frame 532
onClipEvent (enterFrame) {
var X;
var Y;
if (X < (_root.CameraX - 32)) {
this.removeMovieClip();
}
if ((_root.CameraX + 576) < X) {
this.removeMovieClip();
}
if (Y < (_root.CameraY - 32)) {
this.removeMovieClip();
}
if ((_root.CameraY + 432) < Y) {
this.removeMovieClip();
}
this._x = X - _root.CameraX;
this._y = Y - _root.CameraY;
}
Instance of Symbol 158 MovieClip "mrworld" in Frame 532
onClipEvent (load) {
_root.maze = new Array();
_root.level = new Array();
_root.lessvert = false;
}
onClipEvent (enterFrame) {
function HandleCamera() {
var cx;
var cy;
var by;
var rx;
cx = int(_root.CameraX / 32);
cy = int(_root.CameraY / 32);
by = 13;
rx = 18;
if (cx < OldCameraX) {
GenerateBlocks(cx, cy, cx, cy + by);
}
if (OldCameraX < cx) {
GenerateBlocks(cx + rx, cy, cx + rx, cy + by);
}
if (cy < OldCameraY) {
GenerateBlocks(cx, cy, cx + rx, cy);
}
if (OldCameraY < cy) {
GenerateBlocks(cx, cy + by, cx + rx, cy + by);
}
}
function CreateMaze() {
var x;
var y;
if (MazeGenerated == true) {
return(-1);
}
MazeGenerated = true;
_root.mw = _root.OnLevel + 6;
_root.mh = _root.OnLevel + 6;
x = 0;
while (_root.mw >= x) {
y = 0;
while (_root.mh >= y) {
_root.maze[x + (y * (_root.mw + 1))] = 0;
y++;
}
x++;
}
MazeStep(0, 0);
}
function GetSquare(x, y) {
if ((((x < 0) || (_root.mw < x)) || (y < 0)) || (_root.mh < y)) {
return(-1);
}
return(_root.maze[x + (y * (_root.mw + 1))]);
}
function SetSquare(x, y, z) {
if ((((x < 0) || (_root.mw < x)) || (y < 0)) || (_root.mh < y)) {
return(-1);
}
_root.maze[x + (y * (_root.mw + 1))] = _root.maze[x + (y * (_root.mw + 1))] + z;
}
function MazeStep(x, y) {
var Dirs;
var D;
var DirTotal;
Dirs = new Array();
while (true) {
DirTotal = 0;
if (GetSquare(x + 1, y + 0) == 0) {
Dirs[DirTotal] = 0;
DirTotal++;
}
if (GetSquare(x - 1, y + 0) == 0) {
Dirs[DirTotal] = 2;
DirTotal++;
}
if (_root.lessvert == true) {
if (GetSquare(x + 1, y + 0) == 0) {
Dirs[DirTotal] = 0;
DirTotal++;
}
if (GetSquare(x - 1, y + 0) == 0) {
Dirs[DirTotal] = 2;
DirTotal++;
}
}
if (GetSquare(x + 0, y + 1) == 0) {
Dirs[DirTotal] = 1;
DirTotal++;
}
if (GetSquare(x + 0, y - 1) == 0) {
Dirs[DirTotal] = 3;
DirTotal++;
}
if (DirTotal == 0) {
return(undefined);
}
D = Dirs[int(Math.random() * DirTotal)];
var _local1 = 0;
switch (D) {
case _local1 :
SetSquare(x, y, 1);
SetSquare(x + 1, y, 4);
MazeStep(x + 1, y + 0);
break;
case 1 :
SetSquare(x, y, 2);
SetSquare(x, y + 1, 8);
MazeStep(x + 0, y + 1);
break;
case 2 :
SetSquare(x, y, 4);
SetSquare(x - 1, y, 1);
MazeStep(x - 1, y + 0);
break;
case 3 :
SetSquare(x, y, 8);
SetSquare(x, y - 1, 2);
MazeStep(x + 0, y - 1);
}
}
}
function CreateWorld() {
if (LevelGenerated == true) {
return(-1);
}
BlockTotal = 0;
LevelGenerated = true;
_root.w = (_root.mw + 1) * 6;
_root.h = (_root.mh + 1) * 6;
LevelBox(0, 0, _root.w, _root.h, 0);
CreateRooms();
GenerateBlocks(0, 0, _root.w, _root.h);
_root.chiu.ChiuX = (192 * int(_root.mw / 2)) + 64;
_root.chiu.ChiuY = (192 * int(_root.mw / 2)) + 64;
CreateCoin(2, 1.5, 0);
CreateCoin((_root.mw * 6) + 2, 1.5, 1);
CreateCoin(2, (_root.mh * 6) + 1.5, 2);
CreateCoin((_root.mw * 6) + 2, (_root.mh * 6) + 1.5, 3);
}
function CreateCoin(x, y, z) {
_root.coin.duplicateMovieClip("coin" + z, z);
_root["coin" + z]._visible = true;
_root["coin" + z].X = X * 32;
_root["coin" + z].Y = Y * 32;
}
function CreateRooms() {
var x;
var y;
x = 0;
while (_root.mw >= x) {
y = 0;
while (_root.mh >= y) {
CreateRoomNew(x, y);
y++;
}
x++;
}
}
function CreateRoom(sx, sy) {
var x;
var y;
var x1;
var y1;
var z;
z = GetSquare(sx, sy);
x1 = sx * 6;
y1 = sy * 6;
LevelBox(x1 + 0, y1 + 0, x1 + 0, y1 + 0, 1);
LevelBox(x1 + 5, y1 + 0, x1 + 5, y1 + 0, 1);
LevelBox(x1 + 0, y1 + 5, x1 + 0, y1 + 5, 1);
LevelBox(x1 + 5, y1 + 5, x1 + 5, y1 + 5, 1);
if ((z & 1) == 0) {
LevelBox(x1 + 5, y1 + 1, x1 + 5, y1 + 1, 1);
LevelBox(x1 + 5, y1 + 2, x1 + 5, y1 + 4, 1);
LevelBox(x1 + 4, y1 + 2, x1 + 4, y1 + 2, 2);
}
if ((z & 4) == 0) {
LevelBox(x1 + 0, y1 + 1, x1 + 0, y1 + 1, 1);
LevelBox(x1 + 0, y1 + 2, x1 + 0, y1 + 4, 1);
LevelBox(x1 + 1, y1 + 5, x1 + 1, y1 + 5, 2);
if (z == 11) {
LevelBox(x1 + 4, y1 + 2, x1 + 4, y1 + 2, 2);
}
}
if ((z & 2) == 0) {
LevelBox(x1 + 0, y1 + 5, x1 + 5, y1 + 5, 1);
if (z & 8) {
LevelBox(x1 + 1, y1 + 1, x1 + 4, y1 + 4, 0);
CreatePipe(x1 + 2, y1 + 2, 2);
}
}
if ((z & 8) == 0) {
LevelBox(x1 + 0, y1 + 0, x1 + 5, y1 + 0, 1);
LevelBox(x1 + 1, y1 + 1, x1 + 4, y1 + 4, 0);
if (((z & 4) == 0) && (z & 2)) {
LevelBox(x1 + 1, y1 + 4, x1 + 1, y1 + 4, 0);
}
}
if ((z & 15) == 15) {
LevelBox(x1 + 4, y1 + 2, x1 + 4, y1 + 2, 2);
}
}
function CreateRoomNew(sx, sy) {
var x;
var y;
var x1;
var y1;
var z;
z = GetSquare(sx, sy);
x1 = sx * 6;
y1 = sy * 6;
LevelBox2(x1 + 0, y1 + 0, x1 + 0, y1 + 0, 10, 5);
LevelBox2(x1 + 5, y1 + 0, x1 + 5, y1 + 0, 10, 5);
LevelBox2(x1 + 0, y1 + 5, x1 + 0, y1 + 5, 20, 2);
LevelBox2(x1 + 5, y1 + 5, x1 + 5, y1 + 5, 26, 2);
if ((z & 1) == 0) {
LevelBox2(x1 + 5, y1 + 0, x1 + 5, y1 + 5, 10, 5);
LevelBox2(x1 + 4, y1 + 2, x1 + 4, y1 + 2, 26, 2);
LevelBox(x1 + 4, y1 + 3, x1 + 4, y1 + 3, 31);
LevelBox2(x1 + 5, y1 + 2, x1 + 5, y1 + 2, 28, 3);
}
if ((z & 4) == 0) {
LevelBox2(x1 + 0, y1 + 0, x1 + 0, y1 + 5, 10, 5);
LevelBox2(x1 + 1, y1 + 5, x1 + 1, y1 + 5, 20, 2);
LevelBox(x1 + 1, y1 + 6, x1 + 1, y1 + 6, 25);
LevelBox2(x1 + 0, y1 + 5, x1 + 0, y1 + 5, 22, 3);
if ((z & 11) == 11) {
LevelBox(x1 + 4, y1 + 2, x1 + 4, y1 + 2, 2);
}
}
if ((z & 2) == 0) {
LevelBox2(x1 + 0, y1 + 5, x1 + 5, y1 + 5, 15, 5);
if ((z & 1) == 0) {
LevelBox2(x1 + 5, y1 + 5, x1 + 5, y1 + 5, 28, 3);
}
if ((z & 4) == 0) {
LevelBox2(x1 + 0, y1 + 5, x1 + 0, y1 + 5, 22, 3);
}
if ((z & 4) == 4) {
LevelBox(x1 + 0, y1 + 1, x1 + 0, y1 + 1, 0);
}
if (z & 8) {
LevelBox(x1 + 1, y1 + 0, x1 + 4, y1 + 4, 0);
CreatePipe(x1 + 2, y1 + 2, 2);
}
}
if ((z & 8) == 0) {
LevelBox2(x1 + 0, y1 + 0, x1 + 5, y1 + 0, 10, 5);
LevelBox(x1 + 1, y1 + 1, x1 + 4, y1 + 4, 0);
}
if ((z & 15) == 15) {
LevelBox(x1 + 4, y1 + 2, x1 + 4, y1 + 2, 2);
}
}
function CreatePipe(x, y, pipeh) {
var y1;
LevelBox(x, y, x, y, 4);
LevelBox(x + 1, y, x + 1, y, 5);
y1 = y + 1;
while ((y + pipeh) >= y1) {
LevelBox(x, y1, x, y1, 6);
LevelBox(x + 1, y1, x + 1, y1, 7);
y1++;
}
}
function GenerateBlocks(x1, y1, x2, y2) {
var X;
var Y;
_root.block._visible = false;
X = x1;
while (x2 >= X) {
Y = y1;
while (y2 >= Y) {
if (0 < _root.level[X + (Y * _root.w)]) {
_root.block.duplicateMovieClip("block" + BlockTotal, BlockTotal);
_root["block" + BlockTotal]._visible = true;
_root["block" + BlockTotal].X = X * 32;
_root["block" + BlockTotal].Y = Y * 32;
_root["block" + BlockTotal].gotoAndStop(_root.level[X + (Y * _root.w)]);
BlockTotal++;
}
Y++;
}
X++;
}
}
function LevelBox(x1, y1, x2, y2, z) {
var X;
var Y;
X = x1;
while (x2 >= X) {
Y = y1;
while (y2 >= Y) {
_root.level[X + (Y * _root.w)] = z;
Y++;
}
X++;
}
}
function LevelBox2(x1, y1, x2, y2, z, z2) {
var X;
var Y;
X = x1;
while (x2 >= X) {
Y = y1;
while (y2 >= Y) {
_root.level[X + (Y * _root.w)] = z + int(Math.random() * z2);
Y++;
}
X++;
}
}
var LevelGenerated;
var BlockTotal;
var MazeGenerated;
var OldCameraX;
var OldCameraY;
CreateMaze();
MouseStuff();
CreateWorld();
HandleCamera();
OldCameraX = int(_root.CameraX / 32);
OldCameraY = int(_root.CameraY / 32);
}
Instance of Symbol 161 MovieClip "coin" in Frame 532
onClipEvent (load) {
Z = false;
C = false;
}
onClipEvent (enterFrame) {
var X;
var Y;
var Z;
var C;
this._x = X - _root.CameraX;
this._y = Y - _root.CameraY;
if ((X < 1) && (Y < 1)) {
this.removeMovieClip();
return(undefined);
}
Z = false;
if (((((_root.chiu.ChiuX + 16) >= X) && ((X + 32) >= (_root.chiu.ChiuX - 16))) && ((_root.chiu.ChiuY + 64) >= Y)) && ((Y + 32) >= _root.chiu.ChiuY)) {
Z = true;
}
if ((Z == true) && (C == false)) {
C = true;
_root.coinwav.gotoAndPlay(2);
_root.CoinsLeft--;
if (0 >= _root.CoinsLeft) {
_parent.gotoAndPlay(2);
}
this.removeMovieClip();
X = -1;
Y = -1;
return(undefined);
}
}
Frame 536
gotoAndPlay (537);
Frame 539
stop();
Frame 540
gotoAndPlay (537);
Symbol 39 Button
on (release) {
play();
}
Symbol 52 Button
on (release) {
play();
Character = 0;
}
Symbol 53 Button
on (release) {
play();
Character = 1;
}
Symbol 54 Button
on (release) {
play();
Character = 2;
}
Symbol 61 Button
on (release) {
OnLevel--;
if (OnLevel < 1) {
OnLevel = 1;
}
}
Symbol 62 Button
on (release) {
OnLevel++;
if (HighScore < OnLevel) {
OnLevel = HighScore;
}
}
Symbol 65 Button
on (release) {
play();
}
Symbol 72 MovieClip Frame 1
stop();
Symbol 90 MovieClip Frame 1
stop();
Symbol 96 MovieClip Frame 9
gotoAndPlay (1);
Symbol 96 MovieClip Frame 30
gotoAndPlay (21);
Symbol 96 MovieClip Frame 53
gotoAndPlay (41);
Symbol 96 MovieClip Frame 64
gotoAndPlay (61);
Symbol 156 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 1
stop();
Symbol 163 MovieClip Frame 1
stopAllSounds();
Symbol 163 MovieClip Frame 3
stop();