Frame 1
_global.controls = 1;
_global.score;
enter_btn.onRelease = function () {
gotoAndStop (2);
};
checkkb_btn.gotoAndStop(4);
checkms_btn.gotoAndStop(1);
checkkb_btn.onPress = function () {
if (checkms_btn._currentframe == 4) {
checkms_btn.gotoAndStop(1);
_global.controls = 2;
}
checkkb_btn.gotoAndStop(4);
_global.controls = 1;
};
checkms_btn.onPress = function () {
if (checkkb_btn._currentframe == 4) {
checkkb_btn.gotoAndStop(1);
_global.controls = 1;
}
checkms_btn.gotoAndStop(4);
_global.controls = 2;
};
stop();
Frame 2
var wc = new WorldController(10);
wc.createPlayer();
stop();
Frame 3
Mouse.show();
_root.finalscore = _global.score;
restart_btn.onRelease = function () {
gotoAndStop (1);
};
Symbol 3 MovieClip [Ball] Frame 1
#initclip 8
Object.registerClass("Ball", BallController);
#endinitclip
Symbol 6 MovieClip [player] Frame 1
#initclip 6
Object.registerClass("player", PlayerController);
#endinitclip
Symbol 10 MovieClip [Baws] Frame 1
#initclip 7
Object.registerClass("Baws", BawsController);
#endinitclip
Symbol 44 MovieClip [__Packages.PlayerController] Frame 0
class PlayerController extends MovieClip
{
var moveInc, useMouse, pX, pY, _x, _y, _rotation;
function PlayerController () {
super();
moveInc = 10;
useMouse = 0;
trace(_root.checkkb_btn._currentframe);
if (_global.controls == 1) {
pX = Stage.height / 2;
pY = Stage.height / 2;
} else {
pX = _root._xmouse;
pY = _root._ymouse;
Mouse.hide();
}
_x = pX;
_y = pY;
}
function move(d) {
if (d == 1) {
_y = _y - moveInc;
_rotation = _rotation - 45;
}
if (d == 2) {
_y = _y + moveInc;
_rotation = _rotation + 45;
}
if (d == 3) {
_x = _x - moveInc;
_rotation = _rotation - 45;
}
if (d == 4) {
_x = _x + moveInc;
_rotation = _rotation + 45;
}
}
function onEnterFrame() {
_root.wc.enteredFrame();
}
}
Symbol 45 MovieClip [__Packages.BawsController] Frame 0
class BawsController extends MovieClip
{
var nSpeed, _x, _y, hitTest;
function BawsController () {
super();
nSpeed = 1;
trace("I COME FOR YOU PUNY CRAB");
}
function onEnterFrame() {
if (_root.wc.p._x < _x) {
_x = _x - nSpeed;
}
if (_root.wc.p._y < _y) {
_y = _y - nSpeed;
}
if (_root.wc.p._x > _x) {
_x = _x + nSpeed;
}
if (_root.wc.p._y > _y) {
_y = _y + nSpeed;
}
if (hitTest(_root.wc.p)) {
trace("HA HA HA HA");
_root.wc.endGame();
_root.gotoAndStop(3);
}
}
}
Symbol 46 MovieClip [__Packages.BallController] Frame 0
class BallController extends MovieClip
{
var unLoad, nXspeed, nYspeed, stop, _x, _y, _width, _height, _alpha, unloadMovie, removeMovieClip;
function BallController () {
super();
unLoad = 0;
nXspeed = Math.floor(Math.random() * 10) - 5;
nYspeed = Math.floor(Math.random() * 10) - 5;
var _local3 = new Color(this);
_local3.setRGB(Math.random() * 16777215);
stop();
}
function onEnterFrame() {
_x = _x + nXspeed;
_y = _y + nYspeed;
if ((_x > (Stage.width - _width)) or (_x < 0)) {
nXspeed = nXspeed * -1;
}
if ((_y > (Stage.height - _height)) or (_y < 0)) {
nYspeed = nYspeed * -1;
}
if (unLoad == 1) {
_alpha = _alpha - 10;
}
if (_alpha <= 0) {
(unloadMovie());// not popped
(removeMovieClip());// not popped
}
}
var playerWidth = 37.5;
}
Symbol 47 MovieClip [__Packages.WorldController] Frame 0
class WorldController
{
var bSpawn, fCount, em, p, b;
function WorldController (n) {
bSpawn = 0;
fCount = 0;
trace("create WC");
em = new Emitter();
em.emit(n);
_global.score = 0;
_root.totalScore = 0;
}
function createPlayer() {
trace("Create player");
p = _root.attachMovie("player", "player", 0);
}
function createBoss() {
trace("BOSS");
b = _root.attachMovie("baws", "baws", 1000);
b._x = 0;
b._y = 0;
}
function enteredFrame() {
if ((_root.warning._alpha == 0) and (bSpawn == 0)) {
_root.warning._alpha = 100;
} else {
_root.warning._alpha = 0;
}
fCount++;
if ((fCount > 90) and (bSpawn == 0)) {
bSpawn = 1;
createBoss();
}
if (_global.controls == 1) {
if (Key.isDown(38)) {
p.move(1);
}
if (Key.isDown(40)) {
p.move(2);
}
if (Key.isDown(37)) {
p.move(3);
}
if (Key.isDown(39)) {
p.move(4);
}
} else {
p._x = _root._xmouse;
p._y = _root._ymouse;
}
em.frame();
}
function endGame() {
unloadMovie (p);
unloadMovie (b);
em.killAll();
em = null;
}
}
Symbol 48 MovieClip [__Packages.Emitter] Frame 0
class Emitter
{
var lastX, lastY, num, balls;
function Emitter () {
var _local3;
var _local2;
lastX = 50;
lastY = 200;
num = 0;
balls = new Array();
}
function emit(n) {
if (num == 0) {
num = n;
} else {
num++;
}
trace("-emit " + num);
var _local2;
ci = 100;
_local2 = 0;
while (_local2 < num) {
balls.push(makeBallRandom());
_local2++;
}
}
function makeBallRandom() {
var _local3;
var _local2;
_local3 = Math.random() * (Stage.width - 150);
if (_local3 < 150) {
_local3 = 150;
}
_local2 = Math.random() * (Stage.height - 150);
if (_local2 < 150) {
_local2 = 150;
}
return(createBall(_local3, _local2));
}
function makeBallLined() {
return(createBall((lastX = lastX + 50), lastY));
}
function createBall(x, y) {
trace("Spawning ball");
var _local3 = _root.attachMovie("Ball", ("ball" + ci) + "_mc", ci);
_local3.setParent(this);
var _local4;
ci++;
_local3._x = x;
_local3._y = y;
_local4 = (Math.random() * 150) + 50;
_local3._xscale = _local4;
_local3._yscale = _local4;
return(_local3);
}
function frame() {
var _local4;
_local4 = 0;
while (_local4 < balls.length) {
if (balls[_local4].hitTest(_root.player)) {
balls[_local4].unLoad = 1;
balls[_local4].gotoAndStop(6);
balls.splice(_local4, 1);
_global.score++;
_root.totalScore = _global.score;
if (balls.length == 0) {
emit();
_root.wc.b.nSpeed = _root.wc.b.nSpeed + 0.5;
_root.wc.p.nSpeed = _root.wc.p.nSpeed + 0.5;
}
}
_local4++;
}
}
function killAll() {
var _local2;
_local2 = 0;
while (_local2 < balls.length) {
unloadMovie (balls[_local2]);
balls[_local2] = null;
_local2++;
}
}
var ci = 100;
}